mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 16:58:40 -04:00
some cache-busting
This commit is contained in:
parent
fcc7b5f9c2
commit
77b340fec7
@ -519,6 +519,7 @@ class Packager:
|
||||
self.packageBasename += '.mf'
|
||||
packageDir += '/'
|
||||
|
||||
self.packageDir = packageDir
|
||||
self.packageFilename = packageDir + self.packageBasename
|
||||
self.packageDesc = packageDir + self.packageDesc
|
||||
self.packageImportDesc = packageDir + self.packageImportDesc
|
||||
@ -550,8 +551,8 @@ class Packager:
|
||||
# Make the application file executable.
|
||||
os.chmod(self.packageFullpath.toOsSpecific(), 0755)
|
||||
else:
|
||||
self.compressMultifile()
|
||||
self.readDescFile()
|
||||
self.compressMultifile()
|
||||
self.writeDescFile()
|
||||
self.writeImportDescFile()
|
||||
|
||||
@ -944,8 +945,15 @@ class Packager:
|
||||
def compressMultifile(self):
|
||||
""" Compresses the .mf file into an .mf.pz file. """
|
||||
|
||||
compressedName = self.packageFilename + '.pz'
|
||||
compressedPath = Filename(self.packager.installDir, compressedName)
|
||||
if self.oldCompressedBasename:
|
||||
# Remove the previous compressed file first.
|
||||
compressedPath = Filename(self.packager.installDir, Filename(self.packageDir, self.oldCompressedBasename))
|
||||
compressedPath.unlink()
|
||||
|
||||
newCompressedFilename = '%s.pz' % (self.packageFilename)
|
||||
|
||||
# Now build the new version.
|
||||
compressedPath = Filename(self.packager.installDir, newCompressedFilename)
|
||||
if not compressFile(self.packageFullpath, compressedPath, 6):
|
||||
message = 'Unable to write %s' % (compressedPath)
|
||||
raise PackagerError, message
|
||||
@ -957,6 +965,8 @@ class Packager:
|
||||
|
||||
self.patchVersion = None
|
||||
self.patches = []
|
||||
|
||||
self.oldCompressedBasename = None
|
||||
|
||||
packageDescFullpath = Filename(self.packager.installDir, self.packageDesc)
|
||||
doc = TiXmlDocument(packageDescFullpath.toOsSpecific())
|
||||
@ -967,6 +977,12 @@ class Packager:
|
||||
if not xpackage:
|
||||
return
|
||||
|
||||
xcompressed = xpackage.FirstChildElement('compressed_archive')
|
||||
if xcompressed:
|
||||
compressedFilename = xcompressed.Attribute('filename')
|
||||
if compressedFilename:
|
||||
self.oldCompressedBasename = compressedFilename
|
||||
|
||||
patchVersion = xpackage.Attribute('patch_version')
|
||||
if not patchVersion:
|
||||
patchVersion = xpackage.Attribute('last_patch_version')
|
||||
|
@ -299,6 +299,24 @@ class PatchMaker:
|
||||
self.baseFile = FileSpec()
|
||||
self.baseFile.loadXml(xarchive)
|
||||
|
||||
# Put the patchVersion in the compressed filename, for
|
||||
# cache-busting. This means when the version changes, its
|
||||
# URL will also change, guaranteeing that users will
|
||||
# download the latest version, and not some stale cache
|
||||
# file.
|
||||
xcompressed = xpackage.FirstChildElement('compressed_archive')
|
||||
if xcompressed:
|
||||
compressedFile = FileSpec()
|
||||
compressedFile.loadXml(xcompressed)
|
||||
|
||||
oldCompressedFilename = compressedFile.filename
|
||||
newCompressedFilename = '%s.%s.pz' % (self.currentFile.filename, self.patchVersion)
|
||||
oldCompressedPathname = Filename(self.packageDir, oldCompressedFilename)
|
||||
newCompressedPathname = Filename(self.packageDir, newCompressedFilename)
|
||||
if oldCompressedPathname.renameTo(newCompressedPathname):
|
||||
compressedFile.fromFile(self.packageDir, newCompressedFilename)
|
||||
compressedFile.storeXml(xcompressed)
|
||||
|
||||
self.patches = []
|
||||
xpatch = xpackage.FirstChildElement('patch')
|
||||
while xpatch:
|
||||
|
@ -35,7 +35,15 @@ This script is actually a wrapper around Panda's PatchMaker.py.
|
||||
|
||||
Usage:
|
||||
|
||||
%(prog)s [opts]
|
||||
%(prog)s [opts] [packageName1 .. packageNameN]
|
||||
|
||||
Parameters:
|
||||
|
||||
packageName1 .. packageNameN
|
||||
Specify the names of the package(s) you wish to generate patches
|
||||
for. This allows you to build patches for only a subset of the
|
||||
packages found in the tree. If you omit these parameters, patches
|
||||
are built for all packages that require them.
|
||||
|
||||
Options:
|
||||
|
||||
@ -43,11 +51,6 @@ Options:
|
||||
The full path to the install directory. This should be the same
|
||||
directory named by the -i parameter to ppackage.
|
||||
|
||||
-p packageName
|
||||
Generates patches for the named package only. This may be
|
||||
repeated to name multiple packages. If this is omitted, all
|
||||
packages in the directory are scanned.
|
||||
|
||||
-h
|
||||
Display this help
|
||||
"""
|
||||
@ -65,18 +68,14 @@ def usage(code, msg = ''):
|
||||
sys.exit(code)
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'i:p:h')
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'i:h')
|
||||
except getopt.error, msg:
|
||||
usage(1, msg)
|
||||
|
||||
installDir = None
|
||||
packageNames = []
|
||||
|
||||
for opt, arg in opts:
|
||||
if opt == '-i':
|
||||
installDir = Filename.fromOsSpecific(arg)
|
||||
elif opt == '-p':
|
||||
packageNames.append(arg)
|
||||
|
||||
elif opt == '-h':
|
||||
usage(0)
|
||||
@ -84,8 +83,7 @@ for opt, arg in opts:
|
||||
print 'illegal option: ' + flag
|
||||
sys.exit(1)
|
||||
|
||||
if args:
|
||||
usage(1)
|
||||
packageNames = args
|
||||
|
||||
if not installDir:
|
||||
installDir = Filename('install')
|
||||
|
Loading…
x
Reference in New Issue
Block a user