Update auto build packages

This commit is contained in:
Dimitris Zlatanidis 2015-09-24 07:57:34 +03:00
parent 3d81797818
commit 8c95535fe2
5 changed files with 22 additions and 8 deletions

View file

@ -41,10 +41,11 @@ from slpkg.sbo.greps import SBoGrep
class BuildPackage(object): class BuildPackage(object):
"""Build SBo packages from source """Build SBo packages from source
""" """
def __init__(self, script, sources, path): def __init__(self, script, sources, path, auto):
self.script = script self.script = script
self.sources = sources self.sources = sources
self.path = path self.path = path
self.auto = auto
self.meta = _meta_ self.meta = _meta_
self.msg = Msg() self.msg = Msg()
self.prgnam = self.script[:-7] self.prgnam = self.script[:-7]
@ -135,14 +136,14 @@ class BuildPackage(object):
def _delete_sbo_tar_gz(self): def _delete_sbo_tar_gz(self):
"""Delete slackbuild tar.gz file after untar """Delete slackbuild tar.gz file after untar
""" """
if os.path.isfile(self.meta.build_path + self.script): if not self.auto and os.path.isfile(self.meta.build_path + self.script):
os.remove(self.meta.build_path + self.script) os.remove(self.meta.build_path + self.script)
def _delete_dir(self): def _delete_dir(self):
"""Delete old folder if exists before start build """Delete old folder if exists before start build
""" """
if os.path.isdir(self.path + self.prgnam): if not self.auto and os.path.isdir(self.meta.build_path + self.prgnam):
shutil.rmtree(self.path + self.prgnam) shutil.rmtree(self.meta.build_path + self.prgnam)
def log_head(path, log_file, log_time): def log_head(path, log_file, log_time):

View file

@ -43,6 +43,7 @@ class AutoBuild(object):
def run(self): def run(self):
"""Build package and fix ordelist per checksum """Build package and fix ordelist per checksum
""" """
self.if_sources_exist()
if os.path.isfile(self.script): if os.path.isfile(self.script):
self.info_file() self.info_file()
sources = self.sources sources = self.sources
@ -50,7 +51,7 @@ class AutoBuild(object):
sources = self.sbo_sources sources = self.sbo_sources
# If the list does not have the same order use from .info # If the list does not have the same order use from .info
# order. # order.
BuildPackage(self.script, sources, self.path).build() BuildPackage(self.script, sources, self.path, auto=True).build()
raise SystemExit() raise SystemExit()
else: else:
print("\nslpkg: Error: SlackBuild archive.tar.gz not found\n") print("\nslpkg: Error: SlackBuild archive.tar.gz not found\n")
@ -61,3 +62,12 @@ class AutoBuild(object):
sources = SBoGrep(self.prgnam).source().split() sources = SBoGrep(self.prgnam).source().split()
for source in sources: for source in sources:
self.sbo_sources.append(source.split("/")[-1]) self.sbo_sources.append(source.split("/")[-1])
def if_sources_exist(self):
"""Check if sources exist
"""
for src in self.sources:
if not os.path.isfile(self.path + src):
print("\nslpkg: Error: Source file '{0}' not found\n".format(
src))
raise SystemExit()

View file

@ -373,7 +373,8 @@ class SBoNetwork(object):
script = self.sbo_dwn.split("/")[-1] script = self.sbo_dwn.split("/")[-1]
for src in self.source_dwn: for src in self.source_dwn:
sources.append(src.split("/")[-1]) sources.append(src.split("/")[-1])
BuildPackage(script, sources, self.meta.build_path).build() BuildPackage(script, sources, self.meta.build_path,
auto=False).build()
slack_package(self.prgnam) # check if build slack_package(self.prgnam) # check if build
def install(self): def install(self):

View file

@ -145,7 +145,8 @@ class QueuePkgs(object):
Download(self.meta.build_path, src.split(), Download(self.meta.build_path, src.split(),
repo="sbo").start() repo="sbo").start()
sources.append(src.split("/")[-1]) sources.append(src.split("/")[-1])
BuildPackage(script, sources, self.meta.build_path).build() BuildPackage(script, sources, self.meta.build_path,
auto=False).build()
else: else:
print("\nPackages not found in the queue for building\n") print("\nPackages not found in the queue for building\n")

View file

@ -318,7 +318,8 @@ class SBoInstall(object):
dwn_srcs = sbo_link.split() + src_link dwn_srcs = sbo_link.split() + src_link
Download(self.build_folder, dwn_srcs, repo="sbo").start() Download(self.build_folder, dwn_srcs, repo="sbo").start()
sources = self.filenames(src_link) sources = self.filenames(src_link)
BuildPackage(script, sources, self.build_folder).build() BuildPackage(script, sources, self.build_folder,
auto=False).build()
binary = slack_package(prgnam) binary = slack_package(prgnam)
if GetFromInstalled(pkg).name() == pkg: if GetFromInstalled(pkg).name() == pkg:
print("[ {0}Upgrading{1} ] --> {2}".format( print("[ {0}Upgrading{1} ] --> {2}".format(