Welcome to the Pacman bug tracker. Please search the current bugs and feature requests before filing a new one! Use advanced search and select "Search in Comments".

* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproducible test case whenever possible.

FS#17213 - Add UPX compression as a packaging option

Attached to Project: Pacman
Opened by Bryce (bruce) - Friday, 20 November 2009, 01:42 GMT
Last edited by Allan McRae (Allan) - Saturday, 25 June 2011, 12:54 GMT
Task Type Feature Request
Category makepkg
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version git
Due in Version 4.0.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Add an option to automatically use UPX to compress binaries during the makepkg packaging phase.

I understand that this isn't necessarily a feature anyone else desires, but I was bored and was fiddling and came up with a patch that (seems to) work and thought I might post it somewhere :)
I have tested it successfully building a few packages, and will test it more as time goes on :)
Cheers :)
ps. UPX seems to gracefully fail if it can't successfully compress the file, so it shouldn't break anything. I hope.
(This is for version 3.3.3, but that isn't an option in "Reported Version".)
This task depends upon

Closed by  Allan McRae (Allan)
Saturday, 25 June 2011, 12:54 GMT
Reason for closing:  Implemented
Additional comments about closing: /commit/?id=b803a33a
Comment by Xavier (shining) - Friday, 20 November 2009, 08:58 GMT
Hm interesting, I didn't know about upx.
A few comments :
1) don't use pacman -Q upx, use type upx and then use upx. or just check for /usr/bin/upx executable.
2) the patch is reversed : new vs old instead of old vs new
3) you should make a patch against the git version, but in this case it probably does not matter since the new code is quite independent from the rest

Anyway, just address these comments if your patch is going to be merged and you are asked to address them.
Comment by Bryce (bruce) - Sunday, 22 November 2009, 23:37 GMT
Thanks for the feedback :)
Attached an updated version which addresses your concerns :)
Comment by Dan McGee (toofishes) - Thursday, 08 July 2010, 05:23 GMT
Interesting idea. I'm not against this being incorporated; Allan, any thoughts?
Comment by Allan McRae (Allan) - Thursday, 08 July 2010, 05:55 GMT
I am also not against this either... and the patch looks close enough (apart from the smiley in the message!). Assigning to me so it does not get lost.
Comment by Bryce (bruce) - Friday, 09 July 2010, 20:46 GMT
Hey! Everyone loves a smiley :p
I've been using it since I submitted it, and it seems to be working fine :)
Comment by Dan McGee (toofishes) - Wednesday, 12 January 2011, 06:32 GMT
I think this got lost, Allan?
Comment by Allan McRae (Allan) - Wednesday, 12 January 2011, 08:15 GMT
Lost... lazy assignee... same thing! :) It is on my TODO list for before the next release.
Comment by Bryce (bruce) - Sunday, 13 February 2011, 10:35 GMT
Can I somewhat bump this with the 3.5 release in mind? :)
Comment by Allan McRae (Allan) - Monday, 14 February 2011, 00:50 GMT
Yes you can! I have put a bookmark to this page in right at the top of my browser so I constantly will be reminded about this. Hopefully I will have time later this week.
Comment by Bryce (bruce) - Sunday, 27 March 2011, 03:22 GMT
Guessing this didn't make the 3.5 boat :-p
I was having a look at upx in more detail and found that compression flags can be set in the UPX environment variable, so I updated the patch to allow it to be set in makepkg.conf (for example to use lzma compression).
Cheers :)
Comment by Bryce (bruce) - Thursday, 02 June 2011, 23:39 GMT
One last bump attempt?
Cheers :)
Comment by Allan McRae (Allan) - Thursday, 02 June 2011, 23:55 GMT
I did pull this locally, but never got around to adding the documentation to properly merge it. So progress is being made.

I am pulling together a bunch of old makepkg patches at the moment so will make sure this gets done. Really this time!
Comment by Bryce (bruce) - Friday, 03 June 2011, 00:04 GMT
Cheers :-)
Umm, just as a random aside, the latest patch has lzma compression in the example as a config option, turns out it appears to have worse performance than normal, so I'd suggest not actually having that there :-)
And cheers again, I was just thinking the other day that I'd never figured out what had happened to this :-p
Comment by Allan McRae (Allan) - Wednesday, 15 June 2011, 09:07 GMT
Here is a patch with all documentation and some slight changes added (e.g. setting UPXFLAGS will pass these variables to UPX).

@Bryce: can you test this? Also, provided further details for the contribution line if you wish them to be added.
Comment by Dan McGee (toofishes) - Wednesday, 15 June 2011, 14:24 GMT
Might want to send this to the mailing list too, Allan. Quick comment is what happens if UPX isn't installed? We should probably bail early if we notice this rather than wait for the compression phase to roll around.
Comment by Bryce (bruce) - Wednesday, 15 June 2011, 23:11 GMT
Tested, works fine to my eye :-)
Based on Dan's feedback, could this be a solution?
(My git-foo isn't great, so attaching as a format-patch and just as a diff :-s )
Comment by Allan McRae (Allan) - Friday, 17 June 2011, 08:50 GMT
I want to go a slightly different route with the checking for needed software and add a check_software() function to makepkg that pull all the scattered software checks into one function and has makepkg bail early with missing software.

I will post this patch and the check_software one to the mailing list soon.