Gentoo Archives: gentoo-dev

From: Brian Harring <ferringb@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Defining S= from ebuild phase, src_unpack() ?
Date: Mon, 03 Jan 2011 16:40:42
Message-Id: 20110103163940.GE18816@hrair
In Reply to: Re: [gentoo-dev] Defining S= from ebuild phase, src_unpack() ? by Thomas Kahle
1 On Mon, Jan 03, 2011 at 04:15:01PM +0100, Thomas Kahle wrote:
2 > On 17:02 Mon 03 Jan , Alex Alexander wrote:
3 > > On Mon, Jan 03, 2011 at 04:40:57PM +0200, Samuli Suominen wrote:
4 > > > Quoting PMS, Chapter 8:
5 > > >
6 > > > This is very inconvinent rule for example, github tarballs where the
7 > > > directory changes with every release. I've used this:
8 > > >
9 > > > src_unpack() {
10 > > > unpack ${A}
11 > > > cd *-${PN}-*
12 > > > S=`pwd`
13 > > > }
14 > > >
15 > > I've used that method to work around some github-tarballed packages
16 > > as well, seems to work pretty well.
17 >
18 > github ebuilds will continue to be a topic, would you consider a
19 > github.eclass useful at some point?
20
21 Just a quick brain dump, but the following (after someone validates it
22 removing my typos) should work-
23
24 """
25 S=foon-1.2
26 GITHUB_S="${S}-*"
27
28 github_src_unpack() {
29 einfo "upstream needs a wedgie"
30 if [ -n "${GITHUB_UNPACKER}" ]; then
31 ${GITHUB_UNPACKER}
32 else
33 unpack ${A}
34 fi
35 # reset to workdir, on the offchange a custom unpacker dropped us
36 # elsewhere.
37 ( cd ${WORKDIR} && ln -s ${GITHUB_S} ${S}; )
38 [ -e "${S}" ] || die "failed to symlink around github whackyness"
39 }
40 """
41
42 As said, I likely typo'd something in there, but you get the idea.
43 The GITHUB_UNPACKER bit allows you to point it at a different unpack
44 function- that unpacker however will have to stay out of ${S} (should
45 anyways, should be doing any mods from src_prepare).
46
47 Step #2 is to go yell at upstream that a tagged release shouldn't
48 have the sha1 rev slapped onto the directory name- that belongs in a
49 file w/in the release.
50
51 Personally, I'm not much for having ${S} be non-constant- strikes me
52 it'll allow for some odd bugs if eclasses store the value during inherit.
53
54 ~harring