Skip to contentSkip to conversation

org.oe.dev ipkg-utils*: Re-add support for openwrt-style .ipk's.

oe-commits Paul Sokolovsky 2 participants 3 messages Feb 19, 2008 – Feb 20, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hello,

FYI. I've done tests to ensure there're no changes to existing behavior at all, but if you face any issues, please let me know.

Quoted 251 lines · On Tue, 19 Feb 2008 22:57:20 +0100 "pfalcon commit"…

ipkg-utils*: Re-add support for openwrt-style .ipk's.
* 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.

Author: [email protected]
Branch: org.openembedded.dev
Revision: 76d408008f1f7528f07e505cb8346d8d4b239d12 ViewMTN:
http://monotone.openembedded.org/revision/info/76d408008f1f7528f07e505cb8346d8d4b239d12
Files: 1 packages/ipkg-utils/ipkg-utils/ipkg-py-tarfile.patch packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb packages/ipkg-utils/ipkg-utils_1.6+cvs20050404.bb Diffs:

#

# mt diff -rd0de4044d1bae905c2f30dd83d3f5bab85b3f52d
-r76d408008f1f7528f07e505cb8346d8d4b239d12 #
# 
# 
# patch "packages/ipkg-utils/ipkg-utils/ipkg-py-tarfile.patch"
#  from [c624f83ac8b14092c184c051137a6dadd55508a6]
#    to [ddbc1887bea6b823a043d3ded7f4d0e559b20437]
# 
# patch "packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb"
#  from [9ec0920876981474a325a47766fa7d50bbb1cfd3]
#    to [054d2acb3ff8284167043e5554633713ebdba2cf]
# 
# patch "packages/ipkg-utils/ipkg-utils_1.6+cvs20050404.bb"
#  from [f248fbf9a457e0555c36e5377bc412ced8f568db]
#    to [53716efd0be08661e891166feef9298502f1ff73]
# 
============================================================
--- packages/ipkg-utils/ipkg-utils/ipkg-py-tarfile.patch
c624f83ac8b14092c184c051137a6dadd55508a6 +++
packages/ipkg-utils/ipkg-utils/ipkg-py-tarfile.patch
ddbc1887bea6b823a043d3ded7f4d0e559b20437 @@ -1,13 +1,6 @@ ----
- arfile.py |  124
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- ipkg.py   |  106
++++++++++++++++++++++++++---------------------------
- setup.py  |    2 -
- 3 files changed, 177 insertions(+), 55 deletions(-)
(quoted diff) +5 -11
-
-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' ],

(quoted diff) +0 -1
- 		      scripts = ['ipkg-compare-indexes',

'ipkg-make-index', 'ipkg-update-index', 'ipkg-build', 'ipkg-unbuild', 'ipkg-upload']

(quoted diff) +7 -6
-                       )
-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) +
-+            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") +
-+ try:
-+ control = tarf.extractfile("control")
-+ except KeyError:
-+ control = tarf.extractfile("./control")
+ self.read_control(control)
control.close()
- if self.isdeb:

(quoted diff) +3 -4
@@ -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()

(quoted diff) +9 -1
- 	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' ],

(quoted diff) +1 -0
+ 		      scripts = ['ipkg-compare-indexes',

'ipkg-make-index', 'ipkg-update-index', 'ipkg-build', 'ipkg-unbuild', 'ipkg-upload']
+ )
============================================================
--- packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb 9ec0920876981474a325a47766fa7d50bbb1cfd3 +++ packages/ipkg-utils/ipkg-utils-native_1.6+cvs20050404.bb 054d2acb3ff8284167043e5554633713ebdba2cf @@ -1,7 +1,7 @@ RDEPENDS = "" require ipkg-utils_${PV}.bb
RDEPENDS = ""

(quoted diff) +1 -1
-PR = "r15"
+PR = "r16"
 
 inherit native

============================================================
--- packages/ipkg-utils/ipkg-utils_1.6+cvs20050404.bb f248fbf9a457e0555c36e5377bc412ced8f568db +++ packages/ipkg-utils/ipkg-utils_1.6+cvs20050404.bb 53716efd0be08661e891166feef9298502f1ff73 @@ -5,7 +5,7 @@ SRCDATE = "20050404" CONFLICTS = "ipkg-link" RDEPENDS = "python"
SRCDATE = "20050404"

(quoted diff) +1 -1
-PR = "r17"
+PR = "r18"
 
 SRC_URI = "${HANDHELDS_CVS};module=ipkg-utils \
            file://ipkg-utils-fix.patch;patch=1 \

_______________________________________________
Openembedded-commits mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-commits

Signature · 2 lines
Best regards,
 Paul                          mailto:[email protected]
#2 lore raw
In reply to a message not in the archive
Quoted 4 lines · pfalcon commit

ipkg-utils*: Re-add support for openwrt-style .ipk's.
* 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

Quoted 8 lines

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.

OpenWRT use tar.gz type but on device it handle both types. I am using OpenWRT 'whiterussian' rc5 (last jffs2 one) and 'ar type' packages generated by OE were working for me (ipkg 0.99.149 on device).

But I do not know how situation looks in Kamikaze (OpenWRT devel tree). From what I see they indeed use old shell version of ipkg in SDK.

Signature · 4 lines
JID: hrw-jabber.org
OpenEmbedded developer/consultant

               We're bad people and we do bad things [Pink]
#3 lore raw

Hello,

Quoted 14 lines · On Wed, 20 Feb 2008 08:59:37 +0100 Marcin Juszkiewicz…
Quoted 4 lines · pfalcon commit

ipkg-utils*: Re-add support for openwrt-style .ipk's.
* 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

Quoted 8 lines

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.

Quoted 7 lines

OpenWRT use tar.gz type but on device it handle both types. I am using OpenWRT 'whiterussian' rc5 (last jffs2 one) and 'ar type' packages generated by OE were working for me (ipkg 0.99.149 on device).

But I do not know how situation looks in Kamikaze (OpenWRT devel tree).

OpenWRT Kamikaze is for quite some time the latest production branch of OpenWRT, with at least 2 releases made for that (they use ubuntu versioning now too, so latest 7.09). They did a lot of /etc cleanup there, and we even can learn from them ;-). For example, I find it very convenient to use /etc/init.d/<service> enable/disable to add/remove service to autoload on boot ;-).

Back to topic, .deb-style .ipk's didn't work for me with it.

Quoted 2 lines

From what I see they indeed use old shell version of ipkg in SDK.

root@OpenWrt:~# which ipkg
/usr/bin/ipkg
root@OpenWrt:~# ipkg -version
ipkg: version 0.99.162

So, they either hacked it, or ..., or ... In either case, ipk's they ship are tar.gz-wrapped, and openwrt-sdk is intended to follow all official conventions, to be as much drop-in replacement for their buildroot as possible.

I'd appreciate comments on ldconfig issue.

Signature · 2 lines
Best regards,
 Paul                          mailto:[email protected]