Fix a couple of minor bugs...
cover Fix a couple of minor bugs...
The primary change is to the fetcher to enable it to be able to unpack SRPMs.
The second is a bug fix for something minor that just came in from the mailing list. It's a slight change to an error msg.
Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: mhatle/fetcher
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=mhatle/fetcher
Thanks,
Mark Hatle <[email protected]>
---
Mark Hatle (2):
fetch2: Add SRPM knowledge
insane.bbclass: Fix config.log error message
bitbake/lib/bb/fetch2/__init__.py | 62 +++++++++++++++++++------------ meta/classes/insane.bbclass | 2 +- meta/recipes-devtools/rpm/rpm_5.4.0.bb | 52 +------------------------- scripts/rpm2cpio.sh | 53 +++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 75 deletions(-) create mode 100755 scripts/rpm2cpio.sh
Signature · 1 line
1.7.3.4
PATCH 1/2 fetch2: Add SRPM knowledge
Enable the fetcher to be able to unpack and SRPM. By default the system will unpack the contents of the SRPM into the WORKDIR.
A new syntax "unpack=file" was developed for the SRC_URI, to allow for a recipe to extract a specific file within an SRPM. An unpack operation will then be executed on the extracted file.
In order to apply extracted patches (or unpack files not specified with unpack), you must specify the path using WORKDIR, i.e.:
file://${WORKDIR}/mypatch.patch
--- bitbake/lib/bb/fetch2/__init__.py | 62 +++++++++++++++++++------------ meta/recipes-devtools/rpm/rpm_5.4.0.bb | 52 +------------------------- scripts/rpm2cpio.sh | 53 +++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 74 deletions(-) create mode 100755 scripts/rpm2cpio.sh
bitbake/lib/bb/fetch2/__init__.py +38 -24
@@ -607,6 +607,7 @@ class FetchMethod(object): def unpack(self, urldata, rootdir, data): import subprocess + iterate = False file = urldata.localpath dots = file.split(".") if dots[-1] in ['gz', 'bz2', 'Z']:
@@ -614,6 +615,7 @@ class FetchMethod(object): else: efile = file cmd = None + if file.endswith('.tar'): cmd = 'tar x --no-same-owner -f %s' % file elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'):
@@ -633,36 +635,43 @@ class FetchMethod(object): if 'dos' in urldata.parm: cmd = '%s -a' % cmd cmd = "%s '%s'" % (cmd, file) - elif os.path.isdir(file): - filesdir = os.path.realpath(bb.data.getVar("FILESDIR", data, True)) - destdir = "." - if file[0:len(filesdir)] == filesdir: - destdir = file[len(filesdir):file.rfind('/')] - destdir = destdir.strip('/') - if len(destdir) < 1: - destdir = "." - elif not os.access("%s/%s" % (rootdir, destdir), os.F_OK): - os.makedirs("%s/%s" % (rootdir, destdir)) - cmd = 'cp -pPR %s %s/%s/' % (file, rootdir, destdir) + elif file.endswith('.src.rpm') or file.endswith('.srpm'): + if 'unpack' in urldata.parm: + unpack_file = ("%s" % urldata.parm['unpack']) + cmd = 'rpm2cpio.sh %s | cpio -i %s' % (file, unpack_file) + iterate = True + iterate_file = unpack_file + else: + cmd = 'rpm2cpio.sh %s | cpio -i' % (file) else: - if not 'patch' in urldata.parm: - # The "destdir" handling was specifically done for FILESPATH - # items. So, only do so for file:// entries. - if urldata.type == "file" and urldata.path.find("/") != -1: - destdir = urldata.path.rsplit("/", 1)[0] - else: + # If file == dest, then avoid any copies, as we already put the file into dest! + dest = os.path.join(rootdir, os.path.basename(file)) + if (file != dest) and not (os.path.exists(dest) and os.path.samefile(file, dest)): + if os.path.isdir(file): + filesdir = os.path.realpath(bb.data.getVar("FILESDIR", data, True)) destdir = "." - bb.mkdirhier("%s/%s" % (rootdir, destdir)) - cmd = 'cp %s %s/%s/' % (file, rootdir, destdir) + if file[0:len(filesdir)] == filesdir: + destdir = file[len(filesdir):file.rfind('/')] + destdir = destdir.strip('/') + if len(destdir) < 1: + destdir = "." + elif not os.access("%s/%s" % (rootdir, destdir), os.F_OK): + os.makedirs("%s/%s" % (rootdir, destdir)) + cmd = 'cp -pPR %s %s/%s/' % (file, rootdir, destdir) + else: + if not 'patch' in urldata.parm: + # The "destdir" handling was specifically done for FILESPATH + # items. So, only do so for file:// entries. + if urldata.type == "file" and urldata.path.find("/") != -1: + destdir = urldata.path.rsplit("/", 1)[0] + else: + destdir = "." + bb.mkdirhier("%s/%s" % (rootdir, destdir)) + cmd = 'cp %s %s/%s/' % (file, rootdir, destdir) if not cmd: return - dest = os.path.join(rootdir, os.path.basename(file)) - if os.path.exists(dest): - if os.path.samefile(file, dest): - return - # Change to subdir before executing command save_cwd = os.getcwd(); os.chdir(rootdir)
@@ -680,6 +689,11 @@ class FetchMethod(object): if ret != 0: raise UnpackError("Unpack command %s failed with return value %s" % (cmd, ret), urldata.url) + if iterate is True: + iterate_urldata = urldata + iterate_urldata.localpath = "%s/%s" % (rootdir, iterate_file) + self.unpack(urldata, rootdir, data) + return def try_premirror(self, url, urldata, d):
meta/recipes-devtools/rpm/rpm_5.4.0.bb +2 -50
73 lines not on this page · raw message
scripts/rpm2cpio.sh new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
1.7.3.4
PATCH 2/2 insane.bbclass: Fix config.log error message
In reply to Mark Hatle[BUG #702]
The previous error message was confusing. It was looking for both library and include host contamination, but the message only indicated include files.
--- meta/classes/insane.bbclass | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
meta/classes/insane.bbclass +1 -1
@@ -575,7 +575,7 @@ python do_qa_configure() { os.path.join(root,"config.log") if "config.log" in files: if os.system(statement) == 0: - bb.fatal("""This autoconf log indicates errors, it looked at host includes. + bb.fatal("""This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities. Rerun configure task after fixing this. The path was '%s'""" % root) if "configure.ac" in files:
Signature · 1 line
1.7.3.4