From c19096b0afbf8037c9edce9d436c2b8a993d2b09 Mon Sep 17 00:00:00 2001 From: James Turner Date: Thu, 24 Sep 2015 19:45:42 -0500 Subject: [PATCH] Fixes to package generation tooling --- maintain_catalog.py | 33 +++++++++++++++++++-------------- package.py | 2 +- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/maintain_catalog.py b/maintain_catalog.py index 7aeaed0..87695bf 100755 --- a/maintain_catalog.py +++ b/maintain_catalog.py @@ -24,6 +24,7 @@ parser.add_argument("dir", help="Catalog directory") args = parser.parse_args() includePaths = [] +packages = {} def scanPackages(scmRepo): result = [] @@ -56,6 +57,20 @@ def initScmRepository(node): else: raise RuntimeError("Unspported SCM type:" + scmType) +def initRepositories(): + repositories = [] + + for scm in config.getChildren("scm"): + scmRepo = initScmRepository(scm) + if args.update or (not args.noupdate and scm.getValue("update")): + scmRepo.update() + # presumably include repos in parse path + # TODO: make this configurable + includePaths.append(scmRepo.path) + repositories.append(scmRepo) + + return repositories + def processUpload(node, outputPath): if not node.getValue("enabled", True): print "Upload disabled" @@ -101,9 +116,6 @@ def parseExistingCatalog(): except urllib2.URLError as e: print "Downloading current catalog failed", e, "from", url -# dictionary -packages = {} - rootDir = args.dir if not os.path.isabs(rootDir): rootDir = os.path.abspath(rootDir) @@ -143,16 +155,11 @@ for i in config.getChildren("include-dir"): includePaths.append(i.value) parseExistingCatalog() +repositories = initRepositories() -for scm in config.getChildren("scm"): - scmRepo = initScmRepository(scm) - if args.update or (not args.noupdate and scm.getValue("update")): - scmRepo.update() - # presumably include repos in parse path - # TODO: make this configurable - includePaths.append(scmRepo.path) - - for p in scanPackages(scmRepo): +for scm in repositories: + for p in scanPackages(scm): + p.scanSetXmlFiles(includePaths) packages[p.id] = p if os.path.exists(existingCatalogPath): @@ -183,8 +190,6 @@ mirrorUrls = list(m.value for m in config.getChildren("mirror")) packagesToGenerate = [] for p in packages.values(): - p.scanSetXmlFiles(includePaths) - if p.isSourceModified: packagesToGenerate.append(p) else: diff --git a/package.py b/package.py index 6cf9e8e..b73917c 100644 --- a/package.py +++ b/package.py @@ -181,7 +181,7 @@ class PackageData: print self.id, "has zip exclude list" zipArgs += ["-x@" + excludePath] - zipArgs += [zipFilePath, self.id] + zipArgs += [zipFilePath, self.path] subprocess.call(zipArgs) zipFile = open(zipFilePath, 'r')