8000 Package single-file composer.phar for Guix · Issue #11051 · composer/composer · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Package single-file composer.phar for Guix #11051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
trev-dev opened this issue Sep 9, 2022 · 4 comments
Closed

Package single-file composer.phar for Guix #11051

trev-dev opened this issue Sep 9, 2022 · 4 comments
Labels

Comments

@trev-dev
Copy link
trev-dev commented Sep 9, 2022

Maybe related to #9830

I was able to package composer in a cheesy way by using guix's copy-build-system. All this does is patch the shebangs and move it into the profile's /bin directory where it can be found on path.

Turns out one cannot "just simply patch a shebang" because it causes the resulting composer executible to fail some Sha512 checksum. Fair enough!

Any suggestions for how to properly update the hash? Let me know if I'm off base here.

Fatal error: Uncaught PharException: phar "/gnu/store/pymc4ippfvhlhk1sf5vbg7sdih6h70jg-php-composer-2.4.1/bin/composer" SHA512 signature could not be verified: broken signature in /gnu/store/pymc4ippfvhlhk1sf5vbg7sdih6h70jg-php-composer-2.4.1/bin/composer:28
Stack trace:
#0 /gnu/store/pymc4ippfvhlhk1sf5vbg7sdih6h70jg-php-composer-2.4.1/bin/composer(28): Phar::mapPhar('composer.phar')
#1 {main}
  thrown in /gnu/store/pymc4ippfvhlhk1sf5vbg7sdih6h70jg-php-composer-2.4.1/bin/composer on line 28
@Seldaek
Copy link
Member
Seldaek commented Sep 14, 2022

Why would you need to patch the shebang exactly? Sorry I am not very familiar with guix. Is it because you need to directly reference a php which is not in the PATH?

Anyway you could update the signature, we do it as well when compiling the phar, see https://github.com/Seldaek/phar-utils/blob/main/src/Timestamps.php#L103-L130

Or you could create a proxy file like:

#!/path/to/php
<?php

include __DIR__.'/composer.phar';

On php 8+ this works fine without outputting the phar file's shebang.

@vladgorenkin
Copy link

@trev-dev i would guess it's also possible to remove 'patch-shebang phase and add php as propagated-inputs if you are not packaging composer properly anyway

@trev-dev
Copy link
Author

@vladgorenkin I think this is probably the way to as the original shebang points to /usr/bin/env php, this works in Guix.

@trev-dev
Copy link
Author

For anyone who cares about this, I tried deleting the shebang patches and surrendered when I realized that the copy-build-system did too much for my tastes. I switched to the trivial build system and kept it "simple". Guix Simple, that is.

https://git.sr.ht/~trevdev/guix-channel/tree/main/item/trevdev/packages/php.scm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants
0