]> git.openpandora.org Git - openembedded.git/commitdiff
ipkg-utils*: Re-add support for openwrt-style .ipk's.
authorPaul Sokolovsky <pmiscml@gmail.com>
Tue, 19 Feb 2008 21:15:37 +0000 (21:15 +0000)
committerPaul Sokolovsky <pmiscml@gmail.com>
Tue, 19 Feb 2008 21:15:37 +0000 (21:15 +0000)
* There're two .ipk formats: one with ar top-level wrapping (essentially, .deb
format, native OE format) and with tar.gz top-level wrap, used by OpenWRT and some
tiny distros. When I did performance optimization work on ipkg-make-index, I just
blocked support of tar.gz-style ipk's, as it was unclear if those are used in OE
at all. Now support is readded, with the old code to handle them (i.e. not as optimal
as ar-style ones).
* This makes DISTRO=openwrt-sdk usable for producing compatible packages and
deploy-feed for them. But there're still some issues to resolve before OE can be
said to provide seamless support for building packages for OpenWRT.

packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb
packages/ipkg-utils/ipkg-utils/ipkg-py-tarfile.patch
packages/ipkg-utils/ipkg-utils_1.6+cvs20050404.bb

index 3101ecb3bef57ff95c4fa0e4e19ce77b0d661c60..ba3c8ecd0ca03a572ee629261cf43f11b07b5854 100644 (file)
@@ -1,7 +1,7 @@
 require ipkg-utils_${PV}.bb
 
 RDEPENDS = ""
-PR = "r15"
+PR = "r16"
 
 inherit native
 
index 25eb2cce6f339e449d87b28c3ec5b244579b2474..389a86018b4d7dff4120b9d5a5adec1cb3a35ee1 100644 (file)
@@ -1,13 +1,6 @@
----
- arfile.py |  124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- ipkg.py   |  106 ++++++++++++++++++++++++++---------------------------
- setup.py  |    2 -
- 3 files changed, 177 insertions(+), 55 deletions(-)
-
-Index: ipkg-utils/arfile.py
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ ipkg-utils/arfile.py       2007-05-26 23:46:59.000000000 +0100
+diff -r 720080c24d2f arfile.py
+--- /dev/null  Thu Jan 01 00:00:00 1970 +0000
++++ b/arfile.py        Sun Jan 27 23:26:35 2008 +0200
 @@ -0,0 +1,124 @@
 +"""
 +arfile - A module to parse GNU ar archives.
@@ -133,23 +126,10 @@ Index: ipkg-utils/arfile.py
 +
 +        f2 = tarf.extractfile("control")
 +        print f2.read()
-Index: ipkg-utils/setup.py
-===================================================================
---- ipkg-utils.orig/setup.py   2007-05-26 23:45:55.000000000 +0100
-+++ ipkg-utils/setup.py        2007-05-26 23:46:59.000000000 +0100
-@@ -16,6 +16,6 @@ distutils.core.setup( name = 'ipkg-utils
-                     platforms = 'POSIX',
-                     keywords = 'ipkg familiar',
-                       url = 'http://www.handhelds.org/sources.html/',
--                      py_modules = [ 'ipkg' ],
-+                      py_modules = [ 'ipkg', 'arfile' ],
-                     scripts = ['ipkg-compare-indexes', 'ipkg-make-index', 'ipkg-update-index', 'ipkg-build', 'ipkg-unbuild', 'ipkg-upload']
-                       )
-Index: ipkg-utils/ipkg.py
-===================================================================
---- ipkg-utils.orig/ipkg.py    2007-05-26 23:46:55.000000000 +0100
-+++ ipkg-utils/ipkg.py 2007-05-26 23:45:20.000000000 +0100
-@@ -41,6 +41,8 @@ import re
+diff -r 720080c24d2f ipkg.py
+--- a/ipkg.py  Sun Jan 27 23:13:26 2008 +0200
++++ b/ipkg.py  Sun Jan 27 23:26:35 2008 +0200
+@@ -41,6 +41,8 @@ import string
  import string
  import commands
  from stat import ST_SIZE
@@ -158,7 +138,7 @@ Index: ipkg-utils/ipkg.py
  
  class Version:
      """A class for holding parsed package version information."""
-@@ -131,78 +133,61 @@ class Package:
+@@ -131,77 +133,61 @@ class Package:
        self.section = None
          self.filename_header = None
        self.file_list = []
@@ -198,8 +178,6 @@ Index: ipkg-utils/ipkg.py
 -            self.size = stat[ST_SIZE]
 +
              self.filename = os.path.basename(fn)
-+            assert self.isdeb == 1, "Old ipk format (non-deb) is unsupported"
-+
            ## sys.stderr.write("  extracting control.tar.gz from %s\n"% (fn,)) 
 -            if self.isdeb:
 -                control = os.popen("ar p "+fn+" control.tar.gz | tar xfzO - './control'","r")
@@ -227,15 +205,18 @@ Index: ipkg-utils/ipkg.py
 -                            self.__dict__[name] = value
 -                else:
 -                    line = control.readline()
++          if self.isdeb:
++              ar = arfile.ArFile(f)
++              tarStream = ar.open("control.tar.gz")
++              tarf = tarfile.open("control.tar.gz", "r", tarStream)
++
++              try:
++                  control = tarf.extractfile("control")
++              except KeyError:
++                  control = tarf.extractfile("./control")
++          else:
++              control = os.popen("tar --wildcards -xzO -f " + fn + " '*control.tar.gz' | tar xfzO - './control'", "r")
 +
-+            ar = arfile.ArFile(f)
-+            tarStream = ar.open("control.tar.gz")
-+            tarf = tarfile.open("control.tar.gz", "r", tarStream)
-+
-+            try:
-+              control = tarf.extractfile("control")
-+            except KeyError:
-+              control = tarf.extractfile("./control")
 +            self.read_control(control)
              control.close()
 -            if self.isdeb:
@@ -251,7 +232,7 @@ Index: ipkg-utils/ipkg.py
        self.scratch_dir = None
        self.file_dir = None
        self.meta_dir = None
- 
++
 +    def __getattr__(self, name):
 +        if name == "md5":
 +            self._computeFileMD5()
@@ -269,11 +250,10 @@ Index: ipkg-utils/ipkg.py
 +            sum.update(data)
 +        f.close()
 +        self.md5 = sum.hexdigest()
-+
+ 
      def read_control(self, control):
          import os
- 
-@@ -221,9 +203,15 @@ class Package:
+@@ -221,9 +207,15 @@ class Package:
                      value = value + '\n' + line
                  if name == 'size':
                      self.size = int(value)
@@ -290,20 +270,43 @@ Index: ipkg-utils/ipkg.py
                      return # consumes one blank line at end of package descriptoin
              else:
                  line = control.readline()
-@@ -314,6 +302,16 @@ class Package:
+@@ -314,7 +306,27 @@ class Package:
        return self.section
  
      def get_file_list(self):
+-      return self.file_list
 +        if not self.fn:
 +            return []
-+        f = open(self.fn, "rb")
-+        ar = arfile.ArFile(f)
-+        tarStream = ar.open("data.tar.gz")
-+        tarf = tarfile.open("data.tar.gz", "r", tarStream)
-+        self.file_list = tarf.getnames()
++      
++      if self.isdeb:
++          f = open(self.fn, "rb")
++          ar = arfile.ArFile(f)
++          tarStream = ar.open("data.tar.gz")
++          tarf = tarfile.open("data.tar.gz", "r", tarStream)
++          self.file_list = tarf.getnames()
++          f.close()
++      else:
++            f = os.popen("tar xfzO " + self.fn + " '*data.tar.gz' | tar tfz -","r") 
++            while 1: 
++                line = f.readline() 
++                if not line: break 
++                self.file_list.append(string.rstrip(line)) 
++            f.close() 
++
++        # Make sure that filelist has consistent format regardless of tar version
 +        self.file_list = map(lambda a: ["./", ""][a.startswith("./")] + a, self.file_list)
-+
-+        f.close()
-       return self.file_list
++        return self.file_list
  
      def write_package(self, dirname):
+         buf = self.render_control()
+diff -r 720080c24d2f setup.py
+--- a/setup.py Sun Jan 27 23:13:26 2008 +0200
++++ b/setup.py Sun Jan 27 23:26:35 2008 +0200
+@@ -16,6 +16,6 @@ distutils.core.setup( name = 'ipkg-utils
+                     platforms = 'POSIX',
+                     keywords = 'ipkg familiar',
+                       url = 'http://www.handhelds.org/sources.html/',
+-                      py_modules = [ 'ipkg' ],
++                      py_modules = [ 'ipkg', 'arfile' ],
+                     scripts = ['ipkg-compare-indexes', 'ipkg-make-index', 'ipkg-update-index', 'ipkg-build', 'ipkg-unbuild', 'ipkg-upload']
+                       )
index c089796ccb2c9d0336ca4ac7843f94d81339854f..febecb00851ddf1081ecdbb89834fb8234d6c0ff 100644 (file)
@@ -5,7 +5,7 @@ LICENSE = "GPL"
 CONFLICTS = "ipkg-link"
 RDEPENDS = "python"
 SRCDATE = "20050404"
-PR = "r17"
+PR = "r18"
 
 SRC_URI = "${HANDHELDS_CVS};module=ipkg-utils \
            file://ipkg-utils-fix.patch;patch=1 \