diff options
| author | Richard Purdie <richard@openedhand.com> | 2006-07-24 08:24:07 +0000 |
|---|---|---|
| committer | Richard Purdie <richard@openedhand.com> | 2006-07-24 08:24:07 +0000 |
| commit | 215379647bc3cfaccdd52730c9b643524f95102b (patch) | |
| tree | f2db24d917029524df07d7faecd030d231ddf9ec | |
| parent | f75754d05bfac568380d2b6c8f7fb33186082a58 (diff) | |
| download | poky-215379647bc3cfaccdd52730c9b643524f95102b.tar.gz | |
ipkg-utils: Fix a bug in the md5sum field handling and add some extra checks (md5sum, size) to ipkg-make-index when reusing data from the previous package file.
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@544 311d38ba-8fff-0310-9ca6-ca027cbcb966
3 files changed, 58 insertions, 3 deletions
diff --git a/meta/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb b/meta/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb index ab8f4d63e0..bfb91f2f56 100644 --- a/meta/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb +++ b/meta/packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb | |||
| @@ -2,12 +2,13 @@ include ipkg-utils_${PV}.bb | |||
| 2 | SRC_URI += "file://ipkg-utils-fix.patch;patch=1" | 2 | SRC_URI += "file://ipkg-utils-fix.patch;patch=1" |
| 3 | 3 | ||
| 4 | RDEPENDS = "" | 4 | RDEPENDS = "" |
| 5 | PR = "r7" | 5 | PR = "r8" |
| 6 | 6 | ||
| 7 | inherit native | 7 | inherit native |
| 8 | 8 | ||
| 9 | # Avoid circular dependencies from package_ipk.bbclass | 9 | # Avoid circular dependencies from package_ipk.bbclass |
| 10 | PACKAGES = "" | 10 | PACKAGES = "" |
| 11 | FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/ipkg-utils" | ||
| 11 | 12 | ||
| 12 | do_stage() { | 13 | do_stage() { |
| 13 | for i in ${INSTALL}; do | 14 | for i in ${INSTALL}; do |
diff --git a/meta/packages/ipkg-utils/ipkg-utils/index_speedup.patch b/meta/packages/ipkg-utils/ipkg-utils/index_speedup.patch new file mode 100644 index 0000000000..bef28a9df1 --- /dev/null +++ b/meta/packages/ipkg-utils/ipkg-utils/index_speedup.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | Index: ipkg-utils/ipkg-make-index | ||
| 2 | =================================================================== | ||
| 3 | --- ipkg-utils.orig/ipkg-make-index 2005-03-20 18:10:54.000000000 +0000 | ||
| 4 | +++ ipkg-utils/ipkg-make-index 2006-07-24 09:18:16.000000000 +0100 | ||
| 5 | @@ -37,6 +37,21 @@ | ||
| 6 | if os.path.exists(pkg_dir + "/" + filename + ".asc"): | ||
| 7 | os.rename(pkg_dir + "/" + filename + ".asc", locale_dir + "/" + filename + ".asc") | ||
| 8 | |||
| 9 | +def md5sum(file): | ||
| 10 | + import md5 | ||
| 11 | + sum = md5.new() | ||
| 12 | + f = open(file, "r") | ||
| 13 | + while 1: | ||
| 14 | + data = f.read(1024) | ||
| 15 | + if not data: break | ||
| 16 | + sum.update(data) | ||
| 17 | + f.close() | ||
| 18 | + if sys.version[:1] > '2': | ||
| 19 | + # when using Python 2.0 or newer | ||
| 20 | + return sum.hexdigest() | ||
| 21 | + else: | ||
| 22 | + return string.join(map((lambda x:"%02x" % ord(x)),sum.digest()),'') | ||
| 23 | + | ||
| 24 | old_filename = None | ||
| 25 | packages_filename = None | ||
| 26 | filelist_filename = "Packages.filelist" | ||
| 27 | @@ -87,7 +102,7 @@ | ||
| 28 | files.sort() | ||
| 29 | for filename in files: | ||
| 30 | basename = os.path.basename(filename) | ||
| 31 | - if old_pkg_hash.has_key(basename): | ||
| 32 | + if old_pkg_hash.has_key(basename) and old_pkg_hash[basename].md5 == md5sum(filename) and old_pkg_hash[basename].size == os.stat(filename)[6]: | ||
| 33 | if (verbose): | ||
| 34 | sys.stderr.write("Found %s in Packages\n" % (filename,)) | ||
| 35 | pkg = old_pkg_hash[basename] | ||
| 36 | Index: ipkg-utils/ipkg.py | ||
| 37 | =================================================================== | ||
| 38 | --- ipkg-utils.orig/ipkg.py 2005-01-20 23:09:10.000000000 +0000 | ||
| 39 | +++ ipkg-utils/ipkg.py 2006-07-24 09:16:44.000000000 +0100 | ||
| 40 | @@ -210,8 +210,13 @@ | ||
| 41 | value = value + '\n' + line | ||
| 42 | if name == 'size': | ||
| 43 | self.size = int(value) | ||
| 44 | + elif name == 'md5sum': | ||
| 45 | + self.md5 = value | ||
| 46 | elif self.__dict__.has_key(name): | ||
| 47 | self.__dict__[name] = value | ||
| 48 | + else: | ||
| 49 | + print "Lost field %s, %s" % (name,value) | ||
| 50 | + | ||
| 51 | if line[0] == '\n': | ||
| 52 | return # consumes one blank line at end of package descriptoin | ||
| 53 | else: | ||
diff --git a/meta/packages/ipkg-utils/ipkg-utils_1.6+cvs20050404.bb b/meta/packages/ipkg-utils/ipkg-utils_1.6+cvs20050404.bb index 12ed042f15..48c7445828 100644 --- a/meta/packages/ipkg-utils/ipkg-utils_1.6+cvs20050404.bb +++ b/meta/packages/ipkg-utils/ipkg-utils_1.6+cvs20050404.bb | |||
| @@ -5,9 +5,10 @@ LICENSE = "GPL" | |||
| 5 | CONFLICTS = "ipkg-link" | 5 | CONFLICTS = "ipkg-link" |
| 6 | RDEPENDS = "python" | 6 | RDEPENDS = "python" |
| 7 | SRCDATE = "20050404" | 7 | SRCDATE = "20050404" |
| 8 | PR = "r11" | 8 | PR = "r12" |
| 9 | 9 | ||
| 10 | SRC_URI = "${HANDHELDS_CVS};module=ipkg-utils" | 10 | SRC_URI = "${HANDHELDS_CVS};module=ipkg-utils \ |
| 11 | file://index_speedup.patch;patch=1" | ||
| 11 | 12 | ||
| 12 | S = "${WORKDIR}/ipkg-utils" | 13 | S = "${WORKDIR}/ipkg-utils" |
| 13 | 14 | ||
