RFC: allow subdir for SRC_URI entries
Hi folks,
I desperately need this patch. ;)
It allows one to specify ";subdir=<DIR>" in SRC_URI entries. Having the effect that the respective file is either unpacked or copied into that very directory which is treated as:
${WORKDIR}/<DIR>
It is not really ${WORKDIR} but the cwd when do_unpack is run. In most cases this is ${WORKDIR}. If it is something else the recipe writer will have a reason for that.
With this patch we can finally deal easily with tarbombs.
Regards
Robert
classes/base.bbclass +11 -0
@@ -725,9 +725,20 @@ def oe_unpack_file(file, data, url = None): if os.path.samefile(file, dest): return True + # Change to subdir before executing command + save_cwd = os.getcwd(); + parm = bb.decodeurl(url)[5] + if 'subdir' in parm: + newdir = ("%s/%s" % (os.getcwd(), parm['subdir'])) + bb.mkdirhier(newdir) + os.chdir(newdir) + cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd) bb.note("Unpacking %s to %s/" % (file, os.getcwd())) ret = os.system(cmd) + + os.chdir(save_cwd) + return ret == 0 addtask unpack after do_fetch
conf/distro/chinook-compat.conf +3 -1
@@ -172,12 +172,14 @@ PREFERRED_VERSION_hildon-thumbnail = "0.14" PREFERRED_VERSION_osso-gwconnect = "1.0.12" PREFERRED_VERSION_osso-gnome-vfs2 = "2.16.3" +PREFERRED_VERSION_shared-mime-info = "0.22" + # Java stuff PREFERRED_PROVIDER_midpath = "midpath-maemo" PREFERRED_PROVIDER_midpath-backend-gtk = "midpath-backend-gtk-hildon" # Need jamvm-initial since cacao 0.98 seems to get miscompiled with newer GCCs. -PREFERRED_PROVIDER_virtual/java-initial = "jamvm-initial" +#PREFERRED_PROVIDER_virtual/java-initial = "jamvm-initial" PREFERRED_PROVIDER_virtual/javac-native = "ecj-bootstrap-native"
packages/dpkg/dpkg.inc +2 -1
@@ -2,7 +2,8 @@ DESCRIPTION = "Package maintenance system for Debian." LICENSE = "GPL" SECTION = "base" -SRC_URI = "${DEBIAN_MIRROR}/main/d/dpkg/dpkg_${PV}.tar.gz \ +#SRC_URI = "${DEBIAN_MIRROR}/main/d/dpkg/dpkg_${PV}.tar.gz \ +SRC_URI = "http://mirrors.ludost.net/gentoo/distfiles/dpkg_${PV}.tar.gz \ file://ignore_extra_fields.patch;patch=1 \ file://noupdalt.patch;patch=1"
packages/update-alternatives/update-alternatives-dpkg-native_1.13.22.bb +6 -1
@@ -1,8 +1,13 @@ require update-alternatives-dpkg.inc inherit native +SRC_URI = "\ + http://www.scratchbox.org/download/files/sbox-files/dpkg_${PV}.tar.gz \ + file://paths.patch;patch=1 \ + " + PROVIDES += "virtual/update-alternatives-native" -DEPENDS = "perl-native dpkg-native" +DEPENDS = "perl-native" DEFAULT_PREFERENCE = "-1" do_stage () {
packages/update-alternatives/update-alternatives-dpkg_1.13.22.bb +5 -0
@@ -1,5 +1,10 @@ require update-alternatives-dpkg.inc +SRC_URI = "\ + http://www.scratchbox.org/download/files/sbox-files/dpkg_${PV}.tar.gz \ + file://paths.patch;patch=1 \ + " + RPROVIDES_${PN} = "update-alternatives" RDEPENDS_${PN} = "perl dpkg"
Quoted 7 lines · Robert Schuster
Hi folks,
I desperately need this patch. ;)It allows one to specify ";subdir=<DIR>" in
SRC_URIentries. Having the effect that the respective file is either unpacked or copied into that very directory which is treated as:
Quoted 7 lines
${WORKDIR}/<DIR>
It is not really ${WORKDIR} but the cwd when
do_unpackis run. In most cases this is ${WORKDIR}. If it is something else the recipe writer will have a reason for that.With this patch we can finally deal easily with tarbombs.
I have another use case:
Multiple git:// uris in SRC_URI.
When building ffmpeg from git you need to checkout libswscale from git as well and move it in ${S}, which breaks since *every* git repo is put in WORKDIR/git
While speaking about the git fetcher:
foo_2.0+git.bb: git://foo/bar;branch=pm
foo_2.1+git.bb: git://foo/bar;branch=master
That will trigger a russian roulette which branch it's going to fetch or unpack, you can end up with 2.1+git trying to checkout the pm branch.
regards,
koen
Quoted 24 lines · Koen Kooi
Quoted 7 lines · Robert Schuster
Hi folks,
I desperately need this patch. ;)It allows one to specify ";subdir=<DIR>" in
SRC_URIentries. Having the effect that the respective file is either unpacked or copied into that very directory which is treated as:Quoted 7 lines
${WORKDIR}/<DIR>
It is not really ${WORKDIR} but the cwd when
do_unpackis run. In most cases this is ${WORKDIR}. If it is something else the recipe writer will have a reason for that.With this patch we can finally deal easily with tarbombs.
I have another use case:
Multiple
git://uris inSRC_URI.When building ffmpeg from git you need to checkout libswscale from git as well and move it in ${S}, which breaks since *every* git repo is put in WORKDIR/git
Quoted 7 lines
While speaking about the git fetcher:
foo_2.0+git.bb:
git://foo/bar;branch=pm
foo_2.1+git.bb:git://foo/bar;branch=masterThat will trigger a russian roulette which branch it's going to fetch or unpack, you can end up with 2.1+git trying to checkout the pm branch.
For this maybe we should make name= format used when we use SRCREV_FORMAT more generic?
Graeme