Fixes to package generation tooling
This commit is contained in:
parent
d943076183
commit
c19096b0af
2 changed files with 20 additions and 15 deletions
|
@ -24,6 +24,7 @@ parser.add_argument("dir", help="Catalog directory")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
includePaths = []
|
includePaths = []
|
||||||
|
packages = {}
|
||||||
|
|
||||||
def scanPackages(scmRepo):
|
def scanPackages(scmRepo):
|
||||||
result = []
|
result = []
|
||||||
|
@ -56,6 +57,20 @@ def initScmRepository(node):
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Unspported SCM type:" + scmType)
|
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):
|
def processUpload(node, outputPath):
|
||||||
if not node.getValue("enabled", True):
|
if not node.getValue("enabled", True):
|
||||||
print "Upload disabled"
|
print "Upload disabled"
|
||||||
|
@ -101,9 +116,6 @@ def parseExistingCatalog():
|
||||||
except urllib2.URLError as e:
|
except urllib2.URLError as e:
|
||||||
print "Downloading current catalog failed", e, "from", url
|
print "Downloading current catalog failed", e, "from", url
|
||||||
|
|
||||||
# dictionary
|
|
||||||
packages = {}
|
|
||||||
|
|
||||||
rootDir = args.dir
|
rootDir = args.dir
|
||||||
if not os.path.isabs(rootDir):
|
if not os.path.isabs(rootDir):
|
||||||
rootDir = os.path.abspath(rootDir)
|
rootDir = os.path.abspath(rootDir)
|
||||||
|
@ -143,16 +155,11 @@ for i in config.getChildren("include-dir"):
|
||||||
includePaths.append(i.value)
|
includePaths.append(i.value)
|
||||||
|
|
||||||
parseExistingCatalog()
|
parseExistingCatalog()
|
||||||
|
repositories = initRepositories()
|
||||||
|
|
||||||
for scm in config.getChildren("scm"):
|
for scm in repositories:
|
||||||
scmRepo = initScmRepository(scm)
|
for p in scanPackages(scm):
|
||||||
if args.update or (not args.noupdate and scm.getValue("update")):
|
p.scanSetXmlFiles(includePaths)
|
||||||
scmRepo.update()
|
|
||||||
# presumably include repos in parse path
|
|
||||||
# TODO: make this configurable
|
|
||||||
includePaths.append(scmRepo.path)
|
|
||||||
|
|
||||||
for p in scanPackages(scmRepo):
|
|
||||||
packages[p.id] = p
|
packages[p.id] = p
|
||||||
|
|
||||||
if os.path.exists(existingCatalogPath):
|
if os.path.exists(existingCatalogPath):
|
||||||
|
@ -183,8 +190,6 @@ mirrorUrls = list(m.value for m in config.getChildren("mirror"))
|
||||||
|
|
||||||
packagesToGenerate = []
|
packagesToGenerate = []
|
||||||
for p in packages.values():
|
for p in packages.values():
|
||||||
p.scanSetXmlFiles(includePaths)
|
|
||||||
|
|
||||||
if p.isSourceModified:
|
if p.isSourceModified:
|
||||||
packagesToGenerate.append(p)
|
packagesToGenerate.append(p)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -181,7 +181,7 @@ class PackageData:
|
||||||
print self.id, "has zip exclude list"
|
print self.id, "has zip exclude list"
|
||||||
zipArgs += ["-x@" + excludePath]
|
zipArgs += ["-x@" + excludePath]
|
||||||
|
|
||||||
zipArgs += [zipFilePath, self.id]
|
zipArgs += [zipFilePath, self.path]
|
||||||
subprocess.call(zipArgs)
|
subprocess.call(zipArgs)
|
||||||
|
|
||||||
zipFile = open(zipFilePath, 'r')
|
zipFile = open(zipFilePath, 'r')
|
||||||
|
|
Loading…
Add table
Reference in a new issue