Created a download folder to speed up rebuilds.
This commit is contained in:
parent
a059e27a20
commit
39ad25ab2f
16
build.py
16
build.py
@ -7,11 +7,12 @@ import tempfile, os, sys, glob, subprocess, shutil
|
|||||||
class Build(object):
|
class Build(object):
|
||||||
LANGSTD = [ 'ar', 'de', 'en-GB', 'es', 'fr', 'it', 'ja', 'ko', 'pt', 'pt-BR', 'ru', 'zh-CN', 'zh-TW' ]
|
LANGSTD = [ 'ar', 'de', 'en-GB', 'es', 'fr', 'it', 'ja', 'ko', 'pt', 'pt-BR', 'ru', 'zh-CN', 'zh-TW' ]
|
||||||
|
|
||||||
def __init__(self, query, arch, url):
|
def __init__(self, query, arch, url, downloaddir = '/var/tmp/downloads'):
|
||||||
"""Build all versions that can be found in the indicated repo."""
|
"""Build all versions that can be found in the indicated repo."""
|
||||||
self.__query__ = query
|
self.__query__ = query
|
||||||
self.__arch__ = arch
|
self.__arch__ = arch
|
||||||
self.__url__ = url
|
self.__url__ = url
|
||||||
|
self.__downloaddir__ = downloaddir
|
||||||
|
|
||||||
# Creating a tempfile
|
# Creating a tempfile
|
||||||
self.__builddir__ = tempfile.mkdtemp()
|
self.__builddir__ = tempfile.mkdtemp()
|
||||||
@ -36,8 +37,14 @@ class Build(object):
|
|||||||
self.__appname__ = main_arr[0]
|
self.__appname__ = main_arr[0]
|
||||||
self.__version__ = main_arr[1]
|
self.__version__ = main_arr[1]
|
||||||
|
|
||||||
os.chdir(self.__builddir__)
|
os.makedirs(self.__downloaddir__, exist_ok = True)
|
||||||
|
os.chdir(self.__downloaddir__)
|
||||||
for archive in self.__tarballs__:
|
for archive in self.__tarballs__:
|
||||||
|
# If the archive is already there, do not do anything.
|
||||||
|
if os.path.exists(os.path.join(self.__downloaddir__, archive)):
|
||||||
|
print("Archive %s is already there! Sweet")
|
||||||
|
continue
|
||||||
|
|
||||||
# Download the archive
|
# Download the archive
|
||||||
try:
|
try:
|
||||||
urllib.request.urlretrieve(self.__url__ + archive, archive)
|
urllib.request.urlretrieve(self.__url__ + archive, archive)
|
||||||
@ -100,13 +107,14 @@ class Build(object):
|
|||||||
|
|
||||||
# Unpacking the tarballs
|
# Unpacking the tarballs
|
||||||
for archive in buildtarballs:
|
for archive in buildtarballs:
|
||||||
subprocess.run("tar xzf ../%s" % archive, shell=True)
|
subprocess.run("tar xzf {folder}/{archive}".format(folder = self.__downloaddir__, archive = archive), shell=True)
|
||||||
|
|
||||||
os.chdir(self.appimagedir)
|
os.chdir(self.appimagedir)
|
||||||
# At this point, let's decompress the deb packages
|
# At this point, let's decompress the deb packages
|
||||||
subprocess.run("find .. -iname '*.deb' -exec dpkg -x {} . \;", shell=True)
|
subprocess.run("find .. -iname '*.deb' -exec dpkg -x {} . \;", shell=True)
|
||||||
# Changing desktop file
|
# Changing desktop file
|
||||||
subprocess.run("find . -iname startcenter.desktop -exec cp {} . \;", shell=True)
|
subprocess.run("find . -iname startcenter.desktop -exec cp {} . \;", shell=True)
|
||||||
|
subprocess.run("sed -i -e ", shell=True)
|
||||||
|
|
||||||
subprocess.run("find . -name '*startcenter.png' -path '*hicolor*48x48*' -exec cp {} . \;", shell=True)
|
subprocess.run("find . -name '*startcenter.png' -path '*hicolor*48x48*' -exec cp {} . \;", shell=True)
|
||||||
|
|
||||||
@ -139,7 +147,7 @@ class Build(object):
|
|||||||
os.chdir(self.appnamedir)
|
os.chdir(self.appnamedir)
|
||||||
for deb in glob.glob(self.appnamedir + '/*.deb'):
|
for deb in glob.glob(self.appnamedir + '/*.deb'):
|
||||||
os.remove(deb)
|
os.remove(deb)
|
||||||
shutil.rmtree(self.appimagedir)
|
subprocess.run("find . -type d -maxdepth 1 -exec rm -rf {} \+", shell=True)
|
||||||
os.makedirs(self.appimagedir)
|
os.makedirs(self.appimagedir)
|
||||||
|
|
||||||
def checksums(self):
|
def checksums(self):
|
||||||
|
Reference in New Issue
Block a user