mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
some cache-busting
This commit is contained in:
parent
fcc7b5f9c2
commit
77b340fec7
@ -519,6 +519,7 @@ class Packager:
|
|||||||
self.packageBasename += '.mf'
|
self.packageBasename += '.mf'
|
||||||
packageDir += '/'
|
packageDir += '/'
|
||||||
|
|
||||||
|
self.packageDir = packageDir
|
||||||
self.packageFilename = packageDir + self.packageBasename
|
self.packageFilename = packageDir + self.packageBasename
|
||||||
self.packageDesc = packageDir + self.packageDesc
|
self.packageDesc = packageDir + self.packageDesc
|
||||||
self.packageImportDesc = packageDir + self.packageImportDesc
|
self.packageImportDesc = packageDir + self.packageImportDesc
|
||||||
@ -550,8 +551,8 @@ class Packager:
|
|||||||
# Make the application file executable.
|
# Make the application file executable.
|
||||||
os.chmod(self.packageFullpath.toOsSpecific(), 0755)
|
os.chmod(self.packageFullpath.toOsSpecific(), 0755)
|
||||||
else:
|
else:
|
||||||
self.compressMultifile()
|
|
||||||
self.readDescFile()
|
self.readDescFile()
|
||||||
|
self.compressMultifile()
|
||||||
self.writeDescFile()
|
self.writeDescFile()
|
||||||
self.writeImportDescFile()
|
self.writeImportDescFile()
|
||||||
|
|
||||||
@ -944,8 +945,15 @@ class Packager:
|
|||||||
def compressMultifile(self):
|
def compressMultifile(self):
|
||||||
""" Compresses the .mf file into an .mf.pz file. """
|
""" Compresses the .mf file into an .mf.pz file. """
|
||||||
|
|
||||||
compressedName = self.packageFilename + '.pz'
|
if self.oldCompressedBasename:
|
||||||
compressedPath = Filename(self.packager.installDir, compressedName)
|
# 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):
|
if not compressFile(self.packageFullpath, compressedPath, 6):
|
||||||
message = 'Unable to write %s' % (compressedPath)
|
message = 'Unable to write %s' % (compressedPath)
|
||||||
raise PackagerError, message
|
raise PackagerError, message
|
||||||
@ -958,6 +966,8 @@ class Packager:
|
|||||||
self.patchVersion = None
|
self.patchVersion = None
|
||||||
self.patches = []
|
self.patches = []
|
||||||
|
|
||||||
|
self.oldCompressedBasename = None
|
||||||
|
|
||||||
packageDescFullpath = Filename(self.packager.installDir, self.packageDesc)
|
packageDescFullpath = Filename(self.packager.installDir, self.packageDesc)
|
||||||
doc = TiXmlDocument(packageDescFullpath.toOsSpecific())
|
doc = TiXmlDocument(packageDescFullpath.toOsSpecific())
|
||||||
if not doc.LoadFile():
|
if not doc.LoadFile():
|
||||||
@ -967,6 +977,12 @@ class Packager:
|
|||||||
if not xpackage:
|
if not xpackage:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
xcompressed = xpackage.FirstChildElement('compressed_archive')
|
||||||
|
if xcompressed:
|
||||||
|
compressedFilename = xcompressed.Attribute('filename')
|
||||||
|
if compressedFilename:
|
||||||
|
self.oldCompressedBasename = compressedFilename
|
||||||
|
|
||||||
patchVersion = xpackage.Attribute('patch_version')
|
patchVersion = xpackage.Attribute('patch_version')
|
||||||
if not patchVersion:
|
if not patchVersion:
|
||||||
patchVersion = xpackage.Attribute('last_patch_version')
|
patchVersion = xpackage.Attribute('last_patch_version')
|
||||||
|
@ -299,6 +299,24 @@ class PatchMaker:
|
|||||||
self.baseFile = FileSpec()
|
self.baseFile = FileSpec()
|
||||||
self.baseFile.loadXml(xarchive)
|
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 = []
|
self.patches = []
|
||||||
xpatch = xpackage.FirstChildElement('patch')
|
xpatch = xpackage.FirstChildElement('patch')
|
||||||
while xpatch:
|
while xpatch:
|
||||||
|
@ -35,7 +35,15 @@ This script is actually a wrapper around Panda's PatchMaker.py.
|
|||||||
|
|
||||||
Usage:
|
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:
|
Options:
|
||||||
|
|
||||||
@ -43,11 +51,6 @@ Options:
|
|||||||
The full path to the install directory. This should be the same
|
The full path to the install directory. This should be the same
|
||||||
directory named by the -i parameter to ppackage.
|
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
|
-h
|
||||||
Display this help
|
Display this help
|
||||||
"""
|
"""
|
||||||
@ -65,18 +68,14 @@ def usage(code, msg = ''):
|
|||||||
sys.exit(code)
|
sys.exit(code)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.getopt(sys.argv[1:], 'i:p:h')
|
opts, args = getopt.getopt(sys.argv[1:], 'i:h')
|
||||||
except getopt.error, msg:
|
except getopt.error, msg:
|
||||||
usage(1, msg)
|
usage(1, msg)
|
||||||
|
|
||||||
installDir = None
|
installDir = None
|
||||||
packageNames = []
|
|
||||||
|
|
||||||
for opt, arg in opts:
|
for opt, arg in opts:
|
||||||
if opt == '-i':
|
if opt == '-i':
|
||||||
installDir = Filename.fromOsSpecific(arg)
|
installDir = Filename.fromOsSpecific(arg)
|
||||||
elif opt == '-p':
|
|
||||||
packageNames.append(arg)
|
|
||||||
|
|
||||||
elif opt == '-h':
|
elif opt == '-h':
|
||||||
usage(0)
|
usage(0)
|
||||||
@ -84,8 +83,7 @@ for opt, arg in opts:
|
|||||||
print 'illegal option: ' + flag
|
print 'illegal option: ' + flag
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if args:
|
packageNames = args
|
||||||
usage(1)
|
|
||||||
|
|
||||||
if not installDir:
|
if not installDir:
|
||||||
installDir = Filename('install')
|
installDir = Filename('install')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user