diff options
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 92 | ||||
| -rw-r--r-- | bitbake/lib/bb/utils.py | 12 | ||||
| -rw-r--r-- | meta/recipes-devtools/rpm/rpm_5.4.0.bb | 2 |
3 files changed, 66 insertions, 40 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index d8bee063e7..9008121126 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
| @@ -658,6 +658,13 @@ class FetchMethod(object): | |||
| 658 | import subprocess | 658 | import subprocess |
| 659 | iterate = False | 659 | iterate = False |
| 660 | file = urldata.localpath | 660 | file = urldata.localpath |
| 661 | |||
| 662 | try: | ||
| 663 | unpack = bb.utils.to_boolean(urldata.parm.get('unpack'), True) | ||
| 664 | except ValueError, exc: | ||
| 665 | bb.fatal("Invalid value for 'unpack' parameter for %s: %s" % | ||
| 666 | (file, urldata.parm.get('unpack'))) | ||
| 667 | |||
| 661 | dots = file.split(".") | 668 | dots = file.split(".") |
| 662 | if dots[-1] in ['gz', 'bz2', 'Z']: | 669 | if dots[-1] in ['gz', 'bz2', 'Z']: |
| 663 | efile = os.path.join(bb.data.getVar('WORKDIR', data, True),os.path.basename('.'.join(dots[0:-1]))) | 670 | efile = os.path.join(bb.data.getVar('WORKDIR', data, True),os.path.basename('.'.join(dots[0:-1]))) |
| @@ -665,34 +672,41 @@ class FetchMethod(object): | |||
| 665 | efile = file | 672 | efile = file |
| 666 | cmd = None | 673 | cmd = None |
| 667 | 674 | ||
| 668 | if file.endswith('.tar'): | 675 | if unpack: |
| 669 | cmd = 'tar x --no-same-owner -f %s' % file | 676 | if file.endswith('.tar'): |
| 670 | elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'): | 677 | cmd = 'tar x --no-same-owner -f %s' % file |
| 671 | cmd = 'tar xz --no-same-owner -f %s' % file | 678 | elif file.endswith('.tgz') or file.endswith('.tar.gz') or file.endswith('.tar.Z'): |
| 672 | elif file.endswith('.tbz') or file.endswith('.tbz2') or file.endswith('.tar.bz2'): | 679 | cmd = 'tar xz --no-same-owner -f %s' % file |
| 673 | cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file | 680 | elif file.endswith('.tbz') or file.endswith('.tbz2') or file.endswith('.tar.bz2'): |
| 674 | elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'): | 681 | cmd = 'bzip2 -dc %s | tar x --no-same-owner -f -' % file |
| 675 | cmd = 'gzip -dc %s > %s' % (file, efile) | 682 | elif file.endswith('.gz') or file.endswith('.Z') or file.endswith('.z'): |
| 676 | elif file.endswith('.bz2'): | 683 | cmd = 'gzip -dc %s > %s' % (file, efile) |
| 677 | cmd = 'bzip2 -dc %s > %s' % (file, efile) | 684 | elif file.endswith('.bz2'): |
| 678 | elif file.endswith('.tar.xz'): | 685 | cmd = 'bzip2 -dc %s > %s' % (file, efile) |
| 679 | cmd = 'xz -dc %s | tar x --no-same-owner -f -' % file | 686 | elif file.endswith('.tar.xz'): |
| 680 | elif file.endswith('.xz'): | 687 | cmd = 'xz -dc %s | tar x --no-same-owner -f -' % file |
| 681 | cmd = 'xz -dc %s > %s' % (file, efile) | 688 | elif file.endswith('.xz'): |
| 682 | elif file.endswith('.zip') or file.endswith('.jar'): | 689 | cmd = 'xz -dc %s > %s' % (file, efile) |
| 683 | cmd = 'unzip -q -o' | 690 | elif file.endswith('.zip') or file.endswith('.jar'): |
| 684 | if 'dos' in urldata.parm: | 691 | try: |
| 685 | cmd = '%s -a' % cmd | 692 | dos = bb.utils.to_boolean(urldata.parm.get('dos'), False) |
| 686 | cmd = "%s '%s'" % (cmd, file) | 693 | except ValueError, exc: |
| 687 | elif file.endswith('.src.rpm') or file.endswith('.srpm'): | 694 | bb.fatal("Invalid value for 'dos' parameter for %s: %s" % |
| 688 | if 'unpack' in urldata.parm: | 695 | (file, urldata.parm.get('dos'))) |
| 689 | unpack_file = ("%s" % urldata.parm['unpack']) | 696 | cmd = 'unzip -q -o' |
| 690 | cmd = 'rpm2cpio.sh %s | cpio -i %s' % (file, unpack_file) | 697 | if dos: |
| 691 | iterate = True | 698 | cmd = '%s -a' % cmd |
| 692 | iterate_file = unpack_file | 699 | cmd = "%s '%s'" % (cmd, file) |
| 693 | else: | 700 | elif file.endswith('.src.rpm') or file.endswith('.srpm'): |
| 694 | cmd = 'rpm2cpio.sh %s | cpio -i' % (file) | 701 | if 'extract' in urldata.parm: |
| 695 | else: | 702 | unpack_file = urldata.parm.get('extract') |
| 703 | cmd = 'rpm2cpio.sh %s | cpio -i %s' % (file, unpack_file) | ||
| 704 | iterate = True | ||
| 705 | iterate_file = unpack_file | ||
| 706 | else: | ||
| 707 | cmd = 'rpm2cpio.sh %s | cpio -i' % (file) | ||
| 708 | |||
| 709 | if not unpack or not cmd: | ||
| 696 | # If file == dest, then avoid any copies, as we already put the file into dest! | 710 | # If file == dest, then avoid any copies, as we already put the file into dest! |
| 697 | dest = os.path.join(rootdir, os.path.basename(file)) | 711 | dest = os.path.join(rootdir, os.path.basename(file)) |
| 698 | if (file != dest) and not (os.path.exists(dest) and os.path.samefile(file, dest)): | 712 | if (file != dest) and not (os.path.exists(dest) and os.path.samefile(file, dest)): |
| @@ -706,17 +720,17 @@ class FetchMethod(object): | |||
| 706 | destdir = "." | 720 | destdir = "." |
| 707 | elif not os.access("%s/%s" % (rootdir, destdir), os.F_OK): | 721 | elif not os.access("%s/%s" % (rootdir, destdir), os.F_OK): |
| 708 | os.makedirs("%s/%s" % (rootdir, destdir)) | 722 | os.makedirs("%s/%s" % (rootdir, destdir)) |
| 709 | cmd = 'cp -pPR %s %s/%s/' % (file, rootdir, destdir) | 723 | #cmd = 'cp -pPR %s %s/%s/' % (file, rootdir, destdir) |
| 724 | cmd = 'tar -cf - -C "%d" -ps . | tar -xf - -C "%s/%s/"' % (file, rootdir, destdir) | ||
| 710 | else: | 725 | else: |
| 711 | if not 'patch' in urldata.parm: | 726 | # The "destdir" handling was specifically done for FILESPATH |
| 712 | # The "destdir" handling was specifically done for FILESPATH | 727 | # items. So, only do so for file:// entries. |
| 713 | # items. So, only do so for file:// entries. | 728 | if urldata.type == "file" and urldata.path.find("/") != -1: |
| 714 | if urldata.type == "file" and urldata.path.find("/") != -1: | 729 | destdir = urldata.path.rsplit("/", 1)[0] |
| 715 | destdir = urldata.path.rsplit("/", 1)[0] | 730 | else: |
| 716 | else: | 731 | destdir = "." |
| 717 | destdir = "." | 732 | bb.mkdirhier("%s/%s" % (rootdir, destdir)) |
| 718 | bb.mkdirhier("%s/%s" % (rootdir, destdir)) | 733 | cmd = 'cp %s %s/%s/' % (file, rootdir, destdir) |
| 719 | cmd = 'cp %s %s/%s/' % (file, rootdir, destdir) | ||
| 720 | 734 | ||
| 721 | if not cmd: | 735 | if not cmd: |
| 722 | return | 736 | return |
| @@ -725,7 +739,7 @@ class FetchMethod(object): | |||
| 725 | save_cwd = os.getcwd(); | 739 | save_cwd = os.getcwd(); |
| 726 | os.chdir(rootdir) | 740 | os.chdir(rootdir) |
| 727 | if 'subdir' in urldata.parm: | 741 | if 'subdir' in urldata.parm: |
| 728 | newdir = ("%s/%s" % (rootdir, urldata.parm['subdir'])) | 742 | newdir = ("%s/%s" % (rootdir, urldata.parm.get('subdir'))) |
| 729 | bb.mkdirhier(newdir) | 743 | bb.mkdirhier(newdir) |
| 730 | os.chdir(newdir) | 744 | os.chdir(newdir) |
| 731 | 745 | ||
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 0b5aa0d5f7..b2f8bb6f89 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
| @@ -831,3 +831,15 @@ def init_logger(logger, verbose, debug, debug_domains): | |||
| 831 | 831 | ||
| 832 | if debug_domains: | 832 | if debug_domains: |
| 833 | bb.msg.set_debug_domains(debug_domains) | 833 | bb.msg.set_debug_domains(debug_domains) |
| 834 | |||
| 835 | def to_boolean(string, default=None): | ||
| 836 | if not string: | ||
| 837 | return default | ||
| 838 | |||
| 839 | normalized = string.lower() | ||
| 840 | if normalized in ("y", "yes", "1", "true"): | ||
| 841 | return True | ||
| 842 | elif normalized in ("n", "no", "0", "false"): | ||
| 843 | return False | ||
| 844 | else: | ||
| 845 | raise ValueError("Invalid value for to_boolean: %s" % string) | ||
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.0.bb b/meta/recipes-devtools/rpm/rpm_5.4.0.bb index 566325ea4a..56fcd9c62f 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.0.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.0.bb | |||
| @@ -47,7 +47,7 @@ PR = "r11" | |||
| 47 | 47 | ||
| 48 | # rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed | 48 | # rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed |
| 49 | # in order to extract the distribution SRPM into a format we can extract... | 49 | # in order to extract the distribution SRPM into a format we can extract... |
| 50 | SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.0-0.20101229.src.rpm;unpack=rpm-5.4.0.tar.gz \ | 50 | SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.0-0.20101229.src.rpm;extract=rpm-5.4.0.tar.gz \ |
| 51 | file://perfile_rpmdeps.sh \ | 51 | file://perfile_rpmdeps.sh \ |
| 52 | file://rpm-autogen.patch \ | 52 | file://rpm-autogen.patch \ |
| 53 | file://rpm-libsql-fix.patch \ | 53 | file://rpm-libsql-fix.patch \ |
