>From aefa378d6a167124bdfb0b8d6c92aadb4c36fa46 Mon Sep 17 00:00:00 2001 From: Desmond <desmond.corr...@prolucid.ca> Date: Wed, 28 Dec 2016 13:16:48 -0500 Subject: [opkg-utils PATCH] Added support to generate index file with multiple version per package To: opkg-de...@googlegroups.com, yocto@yoctoproject.org
Using the -a option with opkg-make-index, you can now generate an index file which will list multiple version of the same package. Added since opkg now supports specifying version of package. --- opkg-make-index | 16 ++++++++++++---- opkg.py | 8 +++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/opkg-make-index b/opkg-make-index index 7897918..3f757f6 100755 --- a/opkg-make-index +++ b/opkg-make-index @@ -11,7 +11,7 @@ import re verbose = 0 def usage(): - sys.stderr.write("%s [-h] [-s] [-m] [-l Packages.filelist] [-p Packages] [-r Packages.old] [-L localesdir] [-v] packagesdir\n" % (sys.argv[0],)) + sys.stderr.write("%s [-h] [-s] [-m] [-a] [-l Packages.filelist] [-p Packages] [-r Packages.old] [-L localesdir] [-v] packagesdir\n" % (sys.argv[0],)) sys.exit(-1) def to_morgue(filename): @@ -42,7 +42,8 @@ filelist_filename = None stamplist_filename = "Packages.stamps" opt_s = 0 opt_m = 0 -(opts, remaining_args) = getopt.getopt(sys.argv[1:], "hl:p:vsmr:L:") +opt_a = 0 +(opts, remaining_args) = getopt.getopt(sys.argv[1:], "hl:p:vsmr:L:a") for (optkey, optval) in opts: if optkey == '-h': usage() @@ -61,6 +62,8 @@ for (optkey, optval) in opts: old_filename = optval if optkey == '-L': locales_dir = optval + if optkey == '-a': + opt_a = 1 if ( not remaining_args ): usage() @@ -120,12 +123,17 @@ for abspath in files: if (verbose): sys.stderr.write("Reading info for package %s\n" % (filename,)) pkg = opkg.Package(abspath, relpath=pkg_dir) - pkg_key = ("%s:%s" % (pkg.package, pkg.architecture)) + + if opt_a: + pkg_key = ("%s:%s:%s" % (pkg.package, pkg.architecture, pkg.version)) + else: + pkg_key = ("%s:%s" % (pkg.package, pkg.architecture)) + if (pkg_key in packages.packages): old_filename = packages.packages[pkg_key].filename else: old_filename = "" - s = packages.add_package(pkg) + s = packages.add_package(pkg, opt_a) pkgsStamps[filename] = fnameStat.st_mtime if s == 0: if old_filename: diff --git a/opkg.py b/opkg.py index b0d79a6..47473da 100644 --- a/opkg.py +++ b/opkg.py @@ -501,10 +501,16 @@ class Packages(object): self.packages = {} return - def add_package(self, pkg): + def add_package(self, pkg, opt_a=0): package = pkg.package arch = pkg.architecture name = ("%s:%s" % (package, arch)) + ver = pkg.version + if opt_a: + name = ("%s:%s:%s" % (package, arch, ver)) + else: + name = ("%s:%s" % (package, arch)) + if (name not in self.packages): self.packages[name] = pkg -- 2.7.4
From aefa378d6a167124bdfb0b8d6c92aadb4c36fa46 Mon Sep 17 00:00:00 2001 From: Desmond <desmond.corr...@prolucid.ca> Date: Wed, 28 Dec 2016 13:16:48 -0500 Subject: [opkg-utils PATCH] Added support to generate index file with multiple version per package To: opkg-de...@googlegroups.com, yocto@yoctoproject.org Using the -a option with opkg-make-index, you can now generate an index file which will list multiple version of the same package. Added since opkg now supports specifying version of package. --- opkg-make-index | 16 ++++++++++++---- opkg.py | 8 +++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/opkg-make-index b/opkg-make-index index 7897918..3f757f6 100755 --- a/opkg-make-index +++ b/opkg-make-index @@ -11,7 +11,7 @@ import re verbose = 0 def usage(): - sys.stderr.write("%s [-h] [-s] [-m] [-l Packages.filelist] [-p Packages] [-r Packages.old] [-L localesdir] [-v] packagesdir\n" % (sys.argv[0],)) + sys.stderr.write("%s [-h] [-s] [-m] [-a] [-l Packages.filelist] [-p Packages] [-r Packages.old] [-L localesdir] [-v] packagesdir\n" % (sys.argv[0],)) sys.exit(-1) def to_morgue(filename): @@ -42,7 +42,8 @@ filelist_filename = None stamplist_filename = "Packages.stamps" opt_s = 0 opt_m = 0 -(opts, remaining_args) = getopt.getopt(sys.argv[1:], "hl:p:vsmr:L:") +opt_a = 0 +(opts, remaining_args) = getopt.getopt(sys.argv[1:], "hl:p:vsmr:L:a") for (optkey, optval) in opts: if optkey == '-h': usage() @@ -61,6 +62,8 @@ for (optkey, optval) in opts: old_filename = optval if optkey == '-L': locales_dir = optval + if optkey == '-a': + opt_a = 1 if ( not remaining_args ): usage() @@ -120,12 +123,17 @@ for abspath in files: if (verbose): sys.stderr.write("Reading info for package %s\n" % (filename,)) pkg = opkg.Package(abspath, relpath=pkg_dir) - pkg_key = ("%s:%s" % (pkg.package, pkg.architecture)) + + if opt_a: + pkg_key = ("%s:%s:%s" % (pkg.package, pkg.architecture, pkg.version)) + else: + pkg_key = ("%s:%s" % (pkg.package, pkg.architecture)) + if (pkg_key in packages.packages): old_filename = packages.packages[pkg_key].filename else: old_filename = "" - s = packages.add_package(pkg) + s = packages.add_package(pkg, opt_a) pkgsStamps[filename] = fnameStat.st_mtime if s == 0: if old_filename: diff --git a/opkg.py b/opkg.py index b0d79a6..47473da 100644 --- a/opkg.py +++ b/opkg.py @@ -501,10 +501,16 @@ class Packages(object): self.packages = {} return - def add_package(self, pkg): + def add_package(self, pkg, opt_a=0): package = pkg.package arch = pkg.architecture name = ("%s:%s" % (package, arch)) + ver = pkg.version + if opt_a: + name = ("%s:%s:%s" % (package, arch, ver)) + else: + name = ("%s:%s" % (package, arch)) + if (name not in self.packages): self.packages[name] = pkg -- 2.7.4
-- _______________________________________________ yocto mailing list yocto@yoctoproject.org https://lists.yoctoproject.org/listinfo/yocto