diff options
author | Koen Kooi <koen@dominion.thruhere.net> | 2011-02-07 15:27:27 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-07 21:13:19 +0000 |
commit | 36efa8933d979c1037754e37829c8be6529711e9 (patch) | |
tree | 49baad4c8838b7f926780df3f743ce9a40dd0251 | |
parent | 500c66337c7cb5e3044a02ef761097713e47f523 (diff) | |
download | poky-36efa8933d979c1037754e37829c8be6529711e9.tar.gz |
rpm: catch up with fetcher2
Update the rpm recipe after the recent changes to the fetcher API. Koen wrote
the original patch, Richard cleaned it up and fixed it.
This code needs to be merged into the fetcher instead at some point soon.
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-devtools/rpm/rpm_5.4.0.bb | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.0.bb b/meta/recipes-devtools/rpm/rpm_5.4.0.bb index e158b80cd1..ba1a2a2341 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.0.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.0.bb | |||
@@ -328,12 +328,19 @@ FILE_${PN}-dev = "${includedir}/rpm \ | |||
328 | ###%{_rpmhome}/lib/librpmjsm.la | 328 | ###%{_rpmhome}/lib/librpmjsm.la |
329 | ###%{_rpmhome}/lib/librpmjsm.so | 329 | ###%{_rpmhome}/lib/librpmjsm.so |
330 | 330 | ||
331 | def subprocess_setup(): | ||
332 | import signal | ||
333 | # Python installs a SIGPIPE handler by default. This is usually not what | ||
334 | # non-Python subprocesses expect. | ||
335 | # SIGPIPE errors are known issues with gzip/bash | ||
336 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) | ||
337 | |||
331 | # If base_do_unpack is refactored this may have to be adjusted | 338 | # If base_do_unpack is refactored this may have to be adjusted |
332 | python base_do_unpack_append() { | 339 | python base_do_unpack_append() { |
333 | import subprocess | 340 | import subprocess |
334 | 341 | ||
335 | for url in src_uri: | 342 | for url in bb.data.getVar("SRC_URI", d, True).split(): |
336 | local = bb.fetch2.localpath(url) | 343 | local = bb.fetch2.localpath(url, d) |
337 | if local is None: | 344 | if local is None: |
338 | continue | 345 | continue |
339 | local = os.path.realpath(local) | 346 | local = os.path.realpath(local) |
@@ -344,7 +351,7 @@ python base_do_unpack_append() { | |||
344 | cmd = "%s %s | cpio -i" % (cmdname, efile) | 351 | cmd = "%s %s | cpio -i" % (cmdname, efile) |
345 | cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', localdata, 1), cmd) | 352 | cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', localdata, 1), cmd) |
346 | old_cwd = os.getcwd() | 353 | old_cwd = os.getcwd() |
347 | newdir = ("%s/%s" % (old_cwd, 'srpm-unpack')) | 354 | newdir = os.path.join(d.getVar("WORKDIR", True), 'srpm-unpack') |
348 | bb.mkdirhier(newdir) | 355 | bb.mkdirhier(newdir) |
349 | os.chdir(newdir) | 356 | os.chdir(newdir) |
350 | ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) | 357 | ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) |
@@ -352,16 +359,18 @@ python base_do_unpack_append() { | |||
352 | if ret != 0: | 359 | if ret != 0: |
353 | raise bb.build.FuncFailed('Unpack command failed: %s (%s)' % (cmd, ret)) | 360 | raise bb.build.FuncFailed('Unpack command failed: %s (%s)' % (cmd, ret)) |
354 | 361 | ||
355 | srpm_uri = bb.data.getVar('SRPM_UNPACK', localdata, True) | 362 | srpm_uri = bb.data.getVar('SRPM_UNPACK', localdata, True).split() |
356 | if not srpm_uri: | 363 | if len(srpm_uri) == 0: |
357 | return | 364 | return |
358 | 365 | ||
359 | # Note, not really URI's! Just a list of files | 366 | rootdir = bb.data.getVar('WORKDIR', localdata, True) |
360 | for url in srpm_uri.split(): | 367 | srpm_file_uri = [ "file://" + rootdir + "/srpm-unpack/" + uri for uri in srpm_uri]; |
361 | local = os.path.join(bb.data.getVar('WORKDIR', localdata, 1), "srpm-unpack/" + url) | 368 | |
362 | ret = oe_unpack_file(local, localdata, 'file://' + url) | 369 | try: |
363 | if not ret: | 370 | fetcher = bb.fetch2.Fetch(srpm_file_uri, localdata, cache=False) |
364 | raise bb.build.FuncFailed("oe_unpack_file failed with return value %s" % ret) | 371 | fetcher.unpack(rootdir, srpm_file_uri) |
372 | except bb.fetch2.BBFetchException, e: | ||
373 | raise bb.build.FuncFailed(e) | ||
365 | } | 374 | } |
366 | 375 | ||
367 | do_configure() { | 376 | do_configure() { |