[yocto] [opkg-devel] [opkg-utils PATCH] Added support to generate index file with multiple version per package
Alejandro del Castillo
alejandro.delcastillo at ni.com
Fri Dec 30 09:21:01 PST 2016
Hi Desmond, thanks for sending the patch, works as expected.
The only thing missing is your Signed-off-by line, do you mind resending
with it?
I also have a very minor comment below
On 12/28/2016 01:15 PM, Desmond Correia wrote:
> From aefa378d6a167124bdfb0b8d6c92aadb4c36fa46 Mon Sep 17 00:00:00 2001
> From: Desmond <desmond.correia at prolucid.ca
> <mailto:desmond.correia at 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-devel at googlegroups.com <mailto:opkg-devel at googlegroups.com>,
> yocto at yoctoproject.org <mailto:yocto at 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))
since you are defining name on the else case, you can delete the line above
> + 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
>
> --
> You received this message because you are subscribed to the Google
> Groups "opkg-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to opkg-devel+unsubscribe at googlegroups.com
> <mailto:opkg-devel+unsubscribe at googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
--
Cheers,
Alejandro
More information about the yocto
mailing list