Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 135134

Summary: Cannot unpack 7z archives
Product: Portage Development Reporter: Paul Bredbury <brebs>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: enhancement Keywords: InVCS
Priority: High    
Version: 2.1   
Hardware: All   
OS: Linux   
URL: http://sourceforge.net/project/showfiles.php?group_id=117445&package_id=130270
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 115839    
Attachments: ebuild.sh.diff
ezquake-1517.ebuild
capture stdout and dump it to stderr if an error occurs
ebuild.sh.diff
capture stdout and dump it to stderr if an error occurs

Description Paul Bredbury 2006-06-01 03:54:10 UTC
Hi, here is a patch to add support for unpacking 7z archives in ebuilds. The normal command would of course be:

unpack myarchive.7z

File "ezquake_source_1517.7z" in the URL provided, is an example 7z archive.

Unfortunately, 7z doesn't have a "quiet" option, so it lists the files as it unpacks them.
Comment 1 Paul Bredbury 2006-06-01 03:55:03 UTC
Created attachment 88075 [details, diff]
ebuild.sh.diff
Comment 2 Paul Bredbury 2006-06-01 04:15:41 UTC
Created attachment 88078 [details]
ezquake-1517.ebuild

Here is an example ebuild to unpack a 7z file, using the above patch.

A failed request for a "quiet" option in 7z is at:
http://sourceforge.net/forum/forum.php?thread_id=1270756&forum_id=383044
Comment 3 Zac Medico gentoo-dev 2006-06-01 05:31:38 UTC
Created attachment 88083 [details, diff]
capture stdout and dump it to stderr if an error occurs

That silly 7z program outputs to stdout instead of stderr when it exits with an error!  Anyway, this patch should do the trick.

We will not add a p7zip dependency to portage itself so it's the ebuild maintainer's responsibility to add DEPEND="app-arch/p7zip" to any ebuild that needs to unpack a 7z file.

Are there any complaints about this patch or shall we commit it?
Comment 4 Paul Bredbury 2006-06-01 06:03:58 UTC
Created attachment 88089 [details, diff]
ebuild.sh.diff

The "my_output=" always returns zero, even when 7z returns 2 when I tested it on a deliberately-corrupted archive.

The enclosed patch makes the first run silent, and then runs it again visibly if there was an error. I suppose this is the best compromise.
Comment 5 Zac Medico gentoo-dev 2006-06-01 06:17:00 UTC
Created attachment 88091 [details, diff]
capture stdout and dump it to stderr if an error occurs

(In reply to comment #4)
> The "my_output=" always returns zero, even when 7z returns 2 when I tested it
> on a deliberately-corrupted archive.

Whoops.  Actually, it's the "local" builtin that always returns zero.  This updated patch fixes it by declaring the variable on a separate line.
Comment 6 Paul Bredbury 2006-06-01 06:27:49 UTC
Your patch works great - please commit.
Comment 7 Zac Medico gentoo-dev 2006-06-01 06:49:17 UTC
Thanks, this is in svn r3447.
Comment 8 Zac Medico gentoo-dev 2006-06-01 19:46:19 UTC
This has been released in 2.1_rc3-r5.