From 215379647bc3cfaccdd52730c9b643524f95102b Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 24 Jul 2006 08:24:07 +0000 Subject: 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 --- .../ipkg-utils-native_1.6+cvs20050404.bb | 3 +- .../ipkg-utils/ipkg-utils/index_speedup.patch | 53 ++++++++++++++++++++++ .../ipkg-utils/ipkg-utils_1.6+cvs20050404.bb | 5 +- 3 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 meta/packages/ipkg-utils/ipkg-utils/index_speedup.patch 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 ab8f4d63e..bfb91f2f5 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 SRC_URI += "file://ipkg-utils-fix.patch;patch=1" RDEPENDS = "" -PR = "r7" +PR = "r8" inherit native # Avoid circular dependencies from package_ipk.bbclass PACKAGES = "" +FILESDIR = "${@os.path.dirname(bb.data.getVar('FILE',d,1))}/ipkg-utils" do_stage() { 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 000000000..bef28a9df --- /dev/null +++ b/meta/packages/ipkg-utils/ipkg-utils/index_speedup.patch @@ -0,0 +1,53 @@ +Index: ipkg-utils/ipkg-make-index +=================================================================== +--- ipkg-utils.orig/ipkg-make-index 2005-03-20 18:10:54.000000000 +0000 ++++ ipkg-utils/ipkg-make-index 2006-07-24 09:18:16.000000000 +0100 +@@ -37,6 +37,21 @@ + if os.path.exists(pkg_dir + "/" + filename + ".asc"): + os.rename(pkg_dir + "/" + filename + ".asc", locale_dir + "/" + filename + ".asc") + ++def md5sum(file): ++ import md5 ++ sum = md5.new() ++ f = open(file, "r") ++ while 1: ++ data = f.read(1024) ++ if not data: break ++ sum.update(data) ++ f.close() ++ if sys.version[:1] > '2': ++ # when using Python 2.0 or newer ++ return sum.hexdigest() ++ else: ++ return string.join(map((lambda x:"%02x" % ord(x)),sum.digest()),'') ++ + old_filename = None + packages_filename = None + filelist_filename = "Packages.filelist" +@@ -87,7 +102,7 @@ + files.sort() + for filename in files: + basename = os.path.basename(filename) +- if old_pkg_hash.has_key(basename): ++ 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]: + if (verbose): + sys.stderr.write("Found %s in Packages\n" % (filename,)) + pkg = old_pkg_hash[basename] +Index: ipkg-utils/ipkg.py +=================================================================== +--- ipkg-utils.orig/ipkg.py 2005-01-20 23:09:10.000000000 +0000 ++++ ipkg-utils/ipkg.py 2006-07-24 09:16:44.000000000 +0100 +@@ -210,8 +210,13 @@ + value = value + '\n' + line + if name == 'size': + self.size = int(value) ++ elif name == 'md5sum': ++ self.md5 = value + elif self.__dict__.has_key(name): + self.__dict__[name] = value ++ else: ++ print "Lost field %s, %s" % (name,value) ++ + if line[0] == '\n': + return # consumes one blank line at end of package descriptoin + 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 12ed042f1..48c744582 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" CONFLICTS = "ipkg-link" RDEPENDS = "python" SRCDATE = "20050404" -PR = "r11" +PR = "r12" -SRC_URI = "${HANDHELDS_CVS};module=ipkg-utils" +SRC_URI = "${HANDHELDS_CVS};module=ipkg-utils \ + file://index_speedup.patch;patch=1" S = "${WORKDIR}/ipkg-utils" -- cgit v1.2.3