Added support to generate index file with multiple version per package

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.

Signed-off-by: desmond <desmond.correia@prolucid.ca>
Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
This commit is contained in:
desmond
2016-12-30 12:35:27 -05:00
committed by Alejandro del Castillo
parent c852b46bd6
commit 3a09dbde3a
2 changed files with 19 additions and 6 deletions

View File

@@ -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:

View File

@@ -501,10 +501,15 @@ 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