question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

run_command - run all the user defined commands in shell

See original GitHub issue
[dhodovsk@shiny hello-world]$ ll .print_version.sh 
-rwxrwxr-x. 1 dhodovsk dhodovsk 60 Jan 27 13:47 .print_version.sh
[dhodovsk@shiny hello-world]$ cat .packit.yaml 
---
specfile_path: hello.spec
synced_files:
  - hello.spec
upstream_project_name: hello
downstream_package_name: hello
actions:
  create-archive:
  - python3 setup.py sdist --dist-dir .
  - .print_version.sh
[dhodovsk@shiny hello-world]$ packit srpm
Packit 0.8.1 is being used.
Input is a directory: /home/dhodovsk/repos/github.com/packit-service/hello-world
WARNING  'upstream_project_name' configuration key was renamed to 'upstream_package_name', please update your configuration file
Input directory is an upstream repository.
Using user-defined script for ActionName.create_archive: [['python3', 'setup.py', 'sdist', '--dist-dir', '.'], ['.print_version.sh']]
ERROR    Preparing of the upstream to the SRPM build failed: [Errno 2] No such file or directory: '.print_version.sh': '.print_version.sh'
[dhodovsk@shiny hello-world]$ 

It works OK when its called using bash:

[dhodovsk@shiny hello-world]$ cat .packit.yaml 
---
specfile_path: hello.spec
synced_files:
  - hello.spec
upstream_project_name: hello
downstream_package_name: hello
actions:
  create-archive:
  - python3 setup.py sdist --dist-dir .
  - bash .print_version.sh
[dhodovsk@shiny hello-world]$ packit srpm
Packit 0.8.1 is being used.
Input is a directory: /home/dhodovsk/repos/github.com/packit-service/hello-world
WARNING  'upstream_project_name' configuration key was renamed to 'upstream_package_name', please update your configuration file
Input directory is an upstream repository.
Using user-defined script for ActionName.create_archive: [['python3', 'setup.py', 'sdist', '--dist-dir', '.'], ['bash', '.print_version.sh']]
Created archive: /home/dhodovsk/repos/github.com/packit-service/hello-world/hello-0.1.0.tar.gz
SRPM is /home/dhodovsk/repos/github.com/packit-service/hello-world/hello-0.7.0.4.gace1326-1.fc30.src.rpm
SRPM: /home/dhodovsk/repos/github.com/packit-service/hello-world/hello-0.7.0.4.gace1326-1.fc30.src.rpm

If it is not possible, we should document it clearer in doc.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
csomhcommented, Jul 28, 2020

Would introducing a shell and exec form for actions help resolving some of these problems? This would be similar to how ENTRYPOINT works in a Dockerfile.

This way if a command is provided in exec form, it would be also executed as such, if it’s provided in shell form it would be executed as such and the code wouldn’t have to deal with conversions.

As users wrote exec form for actions until now, I think there is no consistent way to suddenly take those commands and try to run it in shell.

Probably the above would require introducing versioning in package configuration, as the change would be backwards incompatible.

1reaction
csomhcommented, Oct 1, 2020

I am not sure if it is worth handling config versioning.

  • Do we know about some user that really needs this?

I’m not aware of any and I don’t know about anyone being bothered by the need to add “bash -c” for their commands to use a shell.

I have the feeling that on the long run solving this (supporting both exec and shell) would be nice. And it would nice if the solution would follow and already existing (and known) one. But we will need versioning for this in order to not to brake compatibility.

On the short term it’s not a priority, though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Execute a Command with a Shell Script in Linux
Creating and Running a Basic Shell Script · Press ESC · Type : (colon character) · Type wq · Press ENTER.
Read more >
How to run command or code in parallel in bash shell under ...
Use the wait command built-in command with & . The xargs command. This page shows how to run commands or code in parallel...
Read more >
How can one run user-defined commands in the ... - Ask Ubuntu
The easiest way I can think of is to create a script in ~/.local/bin (or in /usr/local/bin if the command should be available...
Read more >
How can we run a command stored in a variable?
Simply declare a function with the command inside, and run the function as if it were a command. Expansions in commands within the...
Read more >
Running commands in the shell - PowerShell | Microsoft Learn
The PowerShell call operator ( & ) lets you run commands that are stored in variables and represented by strings or script blocks....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found