Adjust package IDs, use primary -set.xml
- previously directory name was used, but this caused problems for aircraft with certain combinations of dir/-set.xml name
This commit is contained in:
parent
955fa86000
commit
d943076183
2 changed files with 12 additions and 6 deletions
|
@ -175,6 +175,10 @@ else:
|
||||||
catalogNode = sgprops.Node("catalog")
|
catalogNode = sgprops.Node("catalog")
|
||||||
sgprops.copy(config.getChild("template"), catalogNode)
|
sgprops.copy(config.getChild("template"), catalogNode)
|
||||||
|
|
||||||
|
# version 3 catalog
|
||||||
|
catalogNode.getChild("catalog-version", create = True).value = 3
|
||||||
|
|
||||||
|
|
||||||
mirrorUrls = list(m.value for m in config.getChildren("mirror"))
|
mirrorUrls = list(m.value for m in config.getChildren("mirror"))
|
||||||
|
|
||||||
packagesToGenerate = []
|
packagesToGenerate = []
|
||||||
|
|
14
package.py
14
package.py
|
@ -23,7 +23,7 @@ class VariantData:
|
||||||
@property
|
@property
|
||||||
def catalogNode(self):
|
def catalogNode(self):
|
||||||
n = sgprops.Node("variant")
|
n = sgprops.Node("variant")
|
||||||
n.addChild("id").value = self._path
|
n.addChild("id").value = self._path[:-8] # "remove -set.xml" (8 chars)
|
||||||
n.addChild("name").value = self._name
|
n.addChild("name").value = self._name
|
||||||
|
|
||||||
class PackageData:
|
class PackageData:
|
||||||
|
@ -37,9 +37,8 @@ class PackageData:
|
||||||
self._revision = 0
|
self._revision = 0
|
||||||
self._md5 = None
|
self._md5 = None
|
||||||
self._fileSize = 0
|
self._fileSize = 0
|
||||||
|
self._primarySetXmlPath = None
|
||||||
self._node = sgprops.Node("package")
|
self._node = sgprops.Node("package")
|
||||||
self._node.addChild("id").value = self.id
|
|
||||||
|
|
||||||
def setPreviousData(self, node):
|
def setPreviousData(self, node):
|
||||||
self._previousRevision = node.getValue("revision")
|
self._previousRevision = node.getValue("revision")
|
||||||
|
@ -49,7 +48,7 @@ class PackageData:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def id(self):
|
def id(self):
|
||||||
return os.path.basename(self._path)
|
return self._primarySetXmlPath
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def thumbnails(self):
|
def thumbnails(self):
|
||||||
|
@ -102,7 +101,7 @@ class PackageData:
|
||||||
if primary:
|
if primary:
|
||||||
if not primary in self.variants:
|
if not primary in self.variants:
|
||||||
self._variants[primary] = []
|
self._variants[primary] = []
|
||||||
self._variants[primary].append(VariantData(self, node))
|
self._variants[primary].append(VariantData(f, node))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if foundPrimary:
|
if foundPrimary:
|
||||||
|
@ -112,6 +111,7 @@ class PackageData:
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
foundPrimary = True;
|
foundPrimary = True;
|
||||||
|
self._primarySetXmlPath = f[:-8] # trim -set.xml
|
||||||
|
|
||||||
self.parsePrimarySetNode(simNode)
|
self.parsePrimarySetNode(simNode)
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class PackageData:
|
||||||
def generateZip(self, outDir, globalExcludePath):
|
def generateZip(self, outDir, globalExcludePath):
|
||||||
self._revision = self._previousRevision + 1
|
self._revision = self._previousRevision + 1
|
||||||
|
|
||||||
zipName = self.id + ".zip"
|
zipName = os.path.basename(self.path) + ".zip"
|
||||||
zipFilePath = os.path.join(outDir, zipName)
|
zipFilePath = os.path.join(outDir, zipName)
|
||||||
|
|
||||||
os.chdir(os.path.dirname(self.path))
|
os.chdir(os.path.dirname(self.path))
|
||||||
|
@ -192,6 +192,7 @@ class PackageData:
|
||||||
self._md5 = self._previousMD5
|
self._md5 = self._previousMD5
|
||||||
|
|
||||||
def packageNode(self, mirrorUrls, thumbnailUrl):
|
def packageNode(self, mirrorUrls, thumbnailUrl):
|
||||||
|
self._node.addChild("id").value = self.id
|
||||||
self._node.getChild("md5", create = True).value = self._md5
|
self._node.getChild("md5", create = True).value = self._md5
|
||||||
self._node.getChild("file-size-bytes", create = True).value = self._fileSize
|
self._node.getChild("file-size-bytes", create = True).value = self._fileSize
|
||||||
self._node.getChild("revision", create = True).value = int(self._revision)
|
self._node.getChild("revision", create = True).value = int(self._revision)
|
||||||
|
@ -201,6 +202,7 @@ class PackageData:
|
||||||
self._node.addChild("url").value = m + "/" + self.id + ".zip"
|
self._node.addChild("url").value = m + "/" + self.id + ".zip"
|
||||||
|
|
||||||
for t in self._thumbnails:
|
for t in self._thumbnails:
|
||||||
|
self._node.addChild("thumbnail-path").value = t
|
||||||
self._node.addChild("thumbnail").value = thumbnailUrl + "/" + self.id + "_" + t
|
self._node.addChild("thumbnail").value = thumbnailUrl + "/" + self.id + "_" + t
|
||||||
|
|
||||||
for pr in self._variants:
|
for pr in self._variants:
|
||||||
|
|
Loading…
Reference in a new issue