Fix existing catalog
This commit is contained in:
parent
bd453e4a3e
commit
d2cb130135
1 changed files with 24 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
import os, sys, re, glob
|
import os, sys, re, glob, shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sgprops
|
import sgprops
|
||||||
import argparse
|
import argparse
|
||||||
|
@ -79,6 +79,28 @@ def processUpload(node, outputPath):
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Unsupported upload type:" + uploadType)
|
raise RuntimeError("Unsupported upload type:" + uploadType)
|
||||||
|
|
||||||
|
def parseExistingCatalog():
|
||||||
|
global existingCatalogPath
|
||||||
|
global previousCatalog
|
||||||
|
|
||||||
|
# contains existing catalog
|
||||||
|
existingCatalogPath = os.path.join(outPath, 'catalog.xml')
|
||||||
|
|
||||||
|
if not os.path.exists(existingCatalogPath):
|
||||||
|
url = config.getValue("template/url")
|
||||||
|
print "Attempting downloading from", url
|
||||||
|
try:
|
||||||
|
# can happen on new or from clean, try to pull current
|
||||||
|
# catalog from the upload location
|
||||||
|
response = urllib2.urlopen(url, timeout = 5)
|
||||||
|
content = response.read()
|
||||||
|
f = open(existingCatalogPath, 'w' )
|
||||||
|
f.write( content )
|
||||||
|
f.close()
|
||||||
|
print "...worked"
|
||||||
|
except urllib2.URLError as e:
|
||||||
|
print "Downloading current catalog failed", e, "from", url
|
||||||
|
|
||||||
# dictionary
|
# dictionary
|
||||||
packages = {}
|
packages = {}
|
||||||
|
|
||||||
|
@ -120,8 +142,7 @@ for i in config.getChildren("include-dir"):
|
||||||
continue
|
continue
|
||||||
includePaths.append(i.value)
|
includePaths.append(i.value)
|
||||||
|
|
||||||
# contains existing catalog
|
parseExistingCatalog()
|
||||||
existingCatalogPath = os.path.join(outPath, 'catalog.xml')
|
|
||||||
|
|
||||||
for scm in config.getChildren("scm"):
|
for scm in config.getChildren("scm"):
|
||||||
scmRepo = initScmRepository(scm)
|
scmRepo = initScmRepository(scm)
|
||||||
|
@ -134,19 +155,6 @@ for scm in config.getChildren("scm"):
|
||||||
for p in scanPackages(scmRepo):
|
for p in scanPackages(scmRepo):
|
||||||
packages[p.id] = p
|
packages[p.id] = p
|
||||||
|
|
||||||
if not os.path.exists(existingCatalogPath):
|
|
||||||
try:
|
|
||||||
# can happen on new or from clean, try to pull current
|
|
||||||
# catalog from the upload location
|
|
||||||
response = urllib2.urlopen(config.getValue("template/url"), timeout = 5)
|
|
||||||
content = response.read()
|
|
||||||
f = open(existingCatalogPath, 'w' )
|
|
||||||
f.write( content )
|
|
||||||
f.close()
|
|
||||||
except urllib2.URLError as e:
|
|
||||||
print "Downloading current catalog failed", e
|
|
||||||
|
|
||||||
|
|
||||||
if os.path.exists(existingCatalogPath):
|
if os.path.exists(existingCatalogPath):
|
||||||
try:
|
try:
|
||||||
previousCatalog = sgprops.readProps(existingCatalogPath)
|
previousCatalog = sgprops.readProps(existingCatalogPath)
|
||||||
|
|
Loading…
Add table
Reference in a new issue