From 8d26a803a5133c051dc54099eda96047749dc313 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Wed, 6 Jan 2016 08:43:55 +0200 Subject: [PATCH] Turn _SOURCES path in _metadata_ --- slpkg/__metadata__.py | 3 +++ slpkg/init.py | 5 +++-- slpkg/pkg/build.py | 3 ++- slpkg/sbo/network.py | 8 ++++---- slpkg/sbo/queue.py | 8 ++++---- slpkg/sbo/slackbuild.py | 8 ++++---- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 8ba8b565..858b1104 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -163,6 +163,9 @@ class MetaData(object): prg_bar = _conf_slpkg["PRG_BAR"] editor = _conf_slpkg["EDITOR"] + # SBo downloading sources path + _SBo_SOURCES = build_path + "_SOURCES/" + # Remove any gaps repositories = [repo.strip() for repo in repositories] diff --git a/slpkg/init.py b/slpkg/init.py index c329c183..2d1cb4cb 100644 --- a/slpkg/init.py +++ b/slpkg/init.py @@ -48,6 +48,7 @@ class Initialization(object): self.lib_path = self.meta.lib_path self.tmp_path = self.meta.tmp_path self.build_path = self.meta.build_path + self._SOURCES = self.meta._SBo_SOURCES self.slpkg_tmp_packages = self.meta.slpkg_tmp_packages self.slpkg_tmp_patches = self.meta.slpkg_tmp_patches if not os.path.exists(self.conf_path): @@ -60,8 +61,8 @@ class Initialization(object): os.mkdir(self.tmp_path) if not os.path.exists(self.build_path): os.makedirs(self.build_path) - if not os.path.exists(self.build_path + "_SOURCES/"): - os.makedirs(self.build_path + "_SOURCES/") + if not os.path.exists(self._SOURCES): + os.makedirs(self._SOURCES) if not os.path.exists(self.slpkg_tmp_packages): os.makedirs(self.slpkg_tmp_packages) if not os.path.exists(self.slpkg_tmp_patches): diff --git a/slpkg/pkg/build.py b/slpkg/pkg/build.py index 2ac4b1eb..c960ff74 100644 --- a/slpkg/pkg/build.py +++ b/slpkg/pkg/build.py @@ -48,6 +48,7 @@ class BuildPackage(object): self.auto = auto self.meta = _meta_ self.msg = Msg() + self._SOURCES = self.meta._SBo_SOURCES self.prgnam = self.script[:-7] self.log_file = "build_{0}_log".format(self.prgnam) self.sbo_logs = self.meta.log_path + "sbo/" @@ -76,7 +77,7 @@ class BuildPackage(object): self._delete_sbo_tar_gz() self._create_md5_dict() if not self.auto: - os.chdir(self.path + "_SOURCES/") + os.chdir(self._SOURCES) for src in self.sources: # fix build sources with spaces src = src.replace("%20", " ") diff --git a/slpkg/sbo/network.py b/slpkg/sbo/network.py index 67444873..1177fdf5 100644 --- a/slpkg/sbo/network.py +++ b/slpkg/sbo/network.py @@ -68,6 +68,7 @@ class SBoNetwork(object): self.grey = self.meta.color["GREY"] self.endc = self.meta.color["ENDC"] self.build_folder = self.meta.build_path + self._SOURCES = self.meta._SBo_SOURCES self.msg.reading() self.data = SBoGrep(name="").names() self.case_insensitive() @@ -367,13 +368,12 @@ class SBoNetwork(object): sources = [] if not os.path.exists(self.meta.build_path): os.makedirs(self.meta.build_path) - if not os.path.exists(self.meta.build_path + "_SOURCES/"): - os.makedirs(self.meta.build_path + "_SOURCES/") + if not os.path.exists(self._SOURCES): + os.makedirs(self._SOURCES) os.chdir(self.meta.build_path) Download(self.meta.build_path, self.sbo_dwn.split(), repo="sbo").start() - Download(self.meta.build_path + "_SOURCES/", self.source_dwn, - repo="sbo").start() + Download(self._SOURCES, self.source_dwn, repo="sbo").start() script = self.sbo_dwn.split("/")[-1] for src in self.source_dwn: sources.append(src.split("/")[-1]) diff --git a/slpkg/sbo/queue.py b/slpkg/sbo/queue.py index d489a151..75642c3f 100644 --- a/slpkg/sbo/queue.py +++ b/slpkg/sbo/queue.py @@ -53,6 +53,7 @@ class QueuePkgs(object): self.quit = False self.queue = self.meta.lib_path + "queue/" self.queue_list = self.queue + "queue_list" + self._SOURCES = self.meta._SBo_SOURCES if not os.path.exists(self.meta.lib_path): os.mkdir(self.meta.lib_path) if not os.path.exists(self.queue): @@ -133,8 +134,8 @@ class QueuePkgs(object): for pkg in packages: if not os.path.exists(self.meta.build_path): os.mkdir(self.meta.build_path) - if not os.path.exists(self.meta.build_path + "_SOURCES/"): - os.mkdir(self.meta.build_path + "_SOURCES/") + if not os.path.exists(self._SOURCES): + os.mkdir(self._SOURCES) sbo_url = sbo_search_pkg(pkg) sbo_dwn = SBoLink(sbo_url).tar_gz() source_dwn = SBoGrep(pkg).source().split() @@ -144,8 +145,7 @@ class QueuePkgs(object): Download(self.meta.build_path, sbo_dwn.split(), repo="sbo").start() for src in source_dwn: - Download(self.meta.build_path + "_SOURCES/", src.split(), - repo="sbo").start() + Download(self._SOURCES, src.split(), repo="sbo").start() sources.append(src.split("/")[-1]) BuildPackage(script, sources, self.meta.build_path, auto=False).build() diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index d45e7762..da9e7fd9 100644 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -56,6 +56,7 @@ class SBoInstall(object): self.msg = Msg() self.arch = SBoArch().get() self.build_folder = self.meta.build_path + self._SOURCES = self.meta._SBo_SOURCES for fl in self.flag: if fl.startswith("--directory-prefix="): self.build_folder = fl.split("=")[1] @@ -304,8 +305,8 @@ class SBoInstall(object): installs, upgraded, = [], [] if not os.path.exists(self.build_folder): os.makedirs(self.build_folder) - if not os.path.exists(self.build_folder + "_SOURCES/"): - os.makedirs(self.build_folder + "_SOURCES/") + if not os.path.exists(self._SOURCES): + os.makedirs(self._SOURCES) os.chdir(self.build_folder) for prgnam in slackbuilds: pkg = "-".join(prgnam.split("-")[:-1]) @@ -327,8 +328,7 @@ class SBoInstall(object): script = sbo_link.split("/")[-1] Download(self.build_folder, sbo_link.split(), repo="sbo").start() - Download(self.build_folder + "_SOURCES/", src_link, - repo="sbo").start() + Download(self._SOURCES, src_link, repo="sbo").start() if "--download-only" in self.flag: continue sources = self.filenames(src_link)