Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 462612 - unpacker.eclass: provide a function for self extracting zip archives (not makeself)
Summary: unpacker.eclass: provide a function for self extracting zip archives (not mak...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-21 18:35 UTC by Julian Ospald
Modified: 2013-03-23 21:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
unpacker.eclass.diff (unpacker.eclass.diff,770 bytes, patch)
2013-03-21 18:35 UTC, Julian Ospald
Details | Diff
unpacker.eclass.diff (unpacker.eclass.diff,1.18 KB, patch)
2013-03-22 23:37 UTC, Julian Ospald
Details | Diff
unpacker.eclass.diff (unpacker.eclass.diff,1.18 KB, patch)
2013-03-22 23:39 UTC, Julian Ospald
Details | Diff
unpacker.eclass.diff (unpacker.eclass.diff,923 bytes, patch)
2013-03-23 14:51 UTC, Julian Ospald
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julian Ospald 2013-03-21 18:35:55 UTC
Created attachment 342860 [details, diff]
unpacker.eclass.diff

proposal attached, maybe you want to do the error handling different
Comment 1 SpanKY gentoo-dev 2013-03-21 22:38:53 UTC
Comment on attachment 342860 [details, diff]
unpacker.eclass.diff

i'm not seeing the usefulness of this, and it can be accomplished with `unpack`

 ln -s "${DISTDIR}/fooblahblah" file.zip
 unpack ./file.zip
Comment 2 Julian Ospald 2013-03-21 22:50:18 UTC
that does not work unless you do:

nonfatal unpack ./file.zip

which disables error handling completely
Comment 3 SpanKY gentoo-dev 2013-03-21 23:40:08 UTC
(In reply to comment #2)

the code really doesn't explain that.  the focus on "self extracting" is noise.  you can make note in the description that this is useful in that scenario.

call the func "unpack_zip", and document clearly what the point is -- to ignore non-fatal warnings

drop the `type` check.  the latter $? check will catch that case.

add a call to unpack_banner before you actually do the unpack.

you should also pass along the -o flag.

update _unpacker to call this for *.zip files.

finally, you can convert some existing packages like games-fps/etqw-demo.  have it inherit 'unpacker', and call unpack_zip manually.  you can update games-fps/ut2004-muralis by inheriting 'unpacker', and deleting src_unpack entirely.  i'm sure there's other games examples.
Comment 4 Julian Ospald 2013-03-22 23:33:50 UTC
unfortunately:

_unpacker() {
[...]
	assert "unpacking ${a} failed (comp=${comp} arch=${arch})"
}

This function call would cause failure in the example of games-fps/ut2004-muralis if we remove src_unpack, however calling unpack_zip directly would work ofc.

We could add a check for that assert call and skip it if we have arch="unpack_zip"? However that means changing the default behavior of the eclass regarding .zip files.
Comment 5 Julian Ospald 2013-03-22 23:37:22 UTC
Created attachment 342948 [details, diff]
unpacker.eclass.diff

proposal
Comment 6 Julian Ospald 2013-03-22 23:39:37 UTC
Created attachment 342950 [details, diff]
unpacker.eclass.diff

typo
Comment 7 SpanKY gentoo-dev 2013-03-23 07:38:42 UTC
Comment on attachment 342950 [details, diff]
unpacker.eclass.diff

>+# This function has an error tolerance of 1 by default.

this sentence doesn't make sense.  rephrase it to say:
# This function ignores all non-fatal errors (i.e. warnings).
# That is useful for zip archives with extra crap attached
# (e.g. self-extracting archives).

>-	assert "unpacking ${a} failed (comp=${comp} arch=${arch})"
>+	# respect special error handling of unpack_zip
>+	[[ ${arch} == "unpack_zip" ]] || assert "unpacking ${a} failed (comp=${comp} arch=${arch})"

err, no.  fix the unpack_zip code so it returns 0 normally.

[[ $? -le 1 ]] || die "unpacking ${zip} failed"
Comment 8 Julian Ospald 2013-03-23 14:51:18 UTC
Created attachment 342992 [details, diff]
unpacker.eclass.diff

ah, I understand now :D
Comment 9 SpanKY gentoo-dev 2013-03-23 18:10:05 UTC
Comment on attachment 342992 [details, diff]
unpacker.eclass.diff

>+# @USAGE: <one selfzip file>

i would use "<zip file>" and be done

w/this change, does converting those other game ebuilds work as suggested ?  if so, feel free to commit (with that comment fix) and update those games as well as any others you find ...
Comment 10 Julian Ospald 2013-03-23 21:18:53 UTC
+  23 Mar 2013; Julian Ospald <hasufell@gentoo.org> unpacker.eclass:
+  add unpack_zip function to unpacker.eclass wrt #462612