mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -04:00
calculate installed size on arch+debian
This commit is contained in:
parent
96452aa4f4
commit
93510327be
@ -229,6 +229,7 @@ class Installer:
|
|||||||
self.http = self.standalone.http
|
self.http = self.standalone.http
|
||||||
self.tempDir = Filename.temporary("", self.shortname, "") + "/"
|
self.tempDir = Filename.temporary("", self.shortname, "") + "/"
|
||||||
self.tempDir.makeDir()
|
self.tempDir.makeDir()
|
||||||
|
self.__linuxRoot = None
|
||||||
|
|
||||||
# Load the p3d file to read out the required packages
|
# Load the p3d file to read out the required packages
|
||||||
mf = Multifile()
|
mf = Multifile()
|
||||||
@ -456,11 +457,12 @@ class Installer:
|
|||||||
""" Builds a filesystem for Linux. Used so that buildDEB,
|
""" Builds a filesystem for Linux. Used so that buildDEB,
|
||||||
buildRPM and buildArch can share the same temp directory. """
|
buildRPM and buildArch can share the same temp directory. """
|
||||||
|
|
||||||
tempdir = Filename(self.tempDir, platform)
|
if self.__linuxRoot is not None:
|
||||||
if tempdir.exists():
|
return self.__linuxRoot
|
||||||
return tempdir
|
|
||||||
|
|
||||||
|
tempdir = Filename(self.tempDir, platform)
|
||||||
tempdir.makeDir()
|
tempdir.makeDir()
|
||||||
|
|
||||||
Filename(tempdir, "usr/bin/").makeDir()
|
Filename(tempdir, "usr/bin/").makeDir()
|
||||||
if self.includeRequires:
|
if self.includeRequires:
|
||||||
extraTokens = {"host_dir" : "/usr/lib/" + self.shortname.lower()}
|
extraTokens = {"host_dir" : "/usr/lib/" + self.shortname.lower()}
|
||||||
@ -477,7 +479,13 @@ class Installer:
|
|||||||
hostDir.makeDir()
|
hostDir.makeDir()
|
||||||
self.installPackagesInto(hostDir, platform)
|
self.installPackagesInto(hostDir, platform)
|
||||||
|
|
||||||
return tempdir
|
totsize = 0
|
||||||
|
for root, dirs, files in self.os_walk(tempdir.toOsSpecific()):
|
||||||
|
for name in files:
|
||||||
|
totsize += os.path.getsize(os.path.join(root, name))
|
||||||
|
|
||||||
|
self.__linuxRoot = (tempdir, totsize)
|
||||||
|
return self.__linuxRoot
|
||||||
|
|
||||||
def buildDEB(self, output, platform):
|
def buildDEB(self, output, platform):
|
||||||
""" Builds a .deb archive and stores it in the path indicated
|
""" Builds a .deb archive and stores it in the path indicated
|
||||||
@ -492,6 +500,9 @@ class Installer:
|
|||||||
Installer.notify.info("Creating %s..." % output)
|
Installer.notify.info("Creating %s..." % output)
|
||||||
modtime = int(time.time())
|
modtime = int(time.time())
|
||||||
|
|
||||||
|
# Create a temporary directory and write the launcher and dependencies to it.
|
||||||
|
tempdir, totsize = self.__buildTempLinux(platform)
|
||||||
|
|
||||||
# Create a control file in memory.
|
# Create a control file in memory.
|
||||||
controlfile = StringIO()
|
controlfile = StringIO()
|
||||||
print >>controlfile, "Package: %s" % self.shortname.lower()
|
print >>controlfile, "Package: %s" % self.shortname.lower()
|
||||||
@ -500,6 +511,7 @@ class Installer:
|
|||||||
print >>controlfile, "Section: games"
|
print >>controlfile, "Section: games"
|
||||||
print >>controlfile, "Priority: optional"
|
print >>controlfile, "Priority: optional"
|
||||||
print >>controlfile, "Architecture: %s" % arch
|
print >>controlfile, "Architecture: %s" % arch
|
||||||
|
print >>controlfile, "Installed-Size: %d" % -(-totsize / 1024)
|
||||||
print >>controlfile, "Description: %s" % self.fullname
|
print >>controlfile, "Description: %s" % self.fullname
|
||||||
print >>controlfile, "Depends: libc6, libgcc1, libstdc++6, libx11-6"
|
print >>controlfile, "Depends: libc6, libgcc1, libstdc++6, libx11-6"
|
||||||
controlinfo = TarInfoRoot("control")
|
controlinfo = TarInfoRoot("control")
|
||||||
@ -507,9 +519,6 @@ class Installer:
|
|||||||
controlinfo.size = controlfile.tell()
|
controlinfo.size = controlfile.tell()
|
||||||
controlfile.seek(0)
|
controlfile.seek(0)
|
||||||
|
|
||||||
# Create a temporary directory and write the launcher and dependencies to it.
|
|
||||||
tempdir = self.__buildTempLinux(platform)
|
|
||||||
|
|
||||||
# Open the deb file and write to it. It's actually
|
# Open the deb file and write to it. It's actually
|
||||||
# just an AR file, which is very easy to make.
|
# just an AR file, which is very easy to make.
|
||||||
if output.exists():
|
if output.exists():
|
||||||
@ -564,6 +573,9 @@ class Installer:
|
|||||||
Installer.notify.info("Creating %s..." % output)
|
Installer.notify.info("Creating %s..." % output)
|
||||||
modtime = int(time.time())
|
modtime = int(time.time())
|
||||||
|
|
||||||
|
# Create a temporary directory and write the launcher and dependencies to it.
|
||||||
|
tempdir, totsize = self.__buildTempLinux(platform)
|
||||||
|
|
||||||
# Create a pkginfo file in memory.
|
# Create a pkginfo file in memory.
|
||||||
pkginfo = StringIO()
|
pkginfo = StringIO()
|
||||||
print >>pkginfo, "# Generated using pdeploy"
|
print >>pkginfo, "# Generated using pdeploy"
|
||||||
@ -573,6 +585,7 @@ class Installer:
|
|||||||
print >>pkginfo, "pkgdesc = %s" % self.fullname
|
print >>pkginfo, "pkgdesc = %s" % self.fullname
|
||||||
print >>pkginfo, "builddate = %s" % modtime
|
print >>pkginfo, "builddate = %s" % modtime
|
||||||
print >>pkginfo, "packager = %s <%s>" % (self.authorname, self.authoremail)
|
print >>pkginfo, "packager = %s <%s>" % (self.authorname, self.authoremail)
|
||||||
|
print >>pkginfo, "size = %d" % totsize
|
||||||
print >>pkginfo, "arch = %s" % arch
|
print >>pkginfo, "arch = %s" % arch
|
||||||
if self.licensename != "":
|
if self.licensename != "":
|
||||||
print >>pkginfo, "license = %s" % self.licensename
|
print >>pkginfo, "license = %s" % self.licensename
|
||||||
@ -581,9 +594,6 @@ class Installer:
|
|||||||
pkginfoinfo.size = pkginfo.tell()
|
pkginfoinfo.size = pkginfo.tell()
|
||||||
pkginfo.seek(0)
|
pkginfo.seek(0)
|
||||||
|
|
||||||
# Create a temporary directory and write the launcher and dependencies to it.
|
|
||||||
tempdir = self.__buildTempLinux(platform)
|
|
||||||
|
|
||||||
# Create the actual package now.
|
# Create the actual package now.
|
||||||
pkgfile = tarfile.open(output.toOsSpecific(), "w:gz", tarinfo = TarInfoRoot)
|
pkgfile = tarfile.open(output.toOsSpecific(), "w:gz", tarinfo = TarInfoRoot)
|
||||||
pkgfile.addfile(pkginfoinfo, pkginfo)
|
pkgfile.addfile(pkginfoinfo, pkginfo)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user