install

installer
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/install

commit cec38a5804102e6c207bafd348cfc40283fb2a0e
parent 0d705d97a28b667d78cd3581b44879c6a978bc7c
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Fri,  2 Dec 2016 00:22:36 +0100

Fix(Un-tar): And fix linux-headers install

Diffstat:
Mpkgs/gcc_p1/gcc_p1.py | 2+-
Mpkgs/glibc_p1/glibc_p1.py | 5++---
Mpkgs/linux_headers_p1/linux_headers_p1.py | 7+++----
Mscreens/install/install.py | 59++++++++++++++++++++++++++++++++++++++++-------------------
4 files changed, 46 insertions(+), 27 deletions(-)

diff --git a/pkgs/gcc_p1/gcc_p1.py b/pkgs/gcc_p1/gcc_p1.py @@ -39,7 +39,7 @@ class Gcc_P1: "archive": "gcc-6.2.0.tar.bz2", # Archive name "SBU": 8.3, # SBU (Compilation time) "tmp_install": True, # Is this package part of the temporary install - "next": False, # Next package to install + "next": "linux", # Next package to install "after": False, "urls": [ # Url to download the package. The first one must be morphux servers "https://install.morphux.org/packages/gcc-6.2.0.tar.bz2" diff --git a/pkgs/glibc_p1/glibc_p1.py b/pkgs/glibc_p1/glibc_p1.py @@ -53,7 +53,6 @@ class Glibc_P1: return res def configure(self): - # DO NOT WORK return self.e(["../configure", "--prefix=/tools", "--host=" + self.conf_lst["target"], @@ -62,10 +61,10 @@ class Glibc_P1: "--with-headers=/tools/include", "libc_cv_forced_unwind=yes", "libcv_cv_c_cleanup=yes" - ]) + ], shell=True) def make(self): - return self.e(["make"]) + return self.e(["make", "-j", self.conf_lst["cpus"]]) def install(self): return self.e(["make", "install"]) diff --git a/pkgs/linux_headers_p1/linux_headers_p1.py b/pkgs/linux_headers_p1/linux_headers_p1.py @@ -33,7 +33,7 @@ class Linux_Headers_P1: self.e = ex self.root_dir = root_dir self.config = { - "name": "linux-headers", # Name of the package + "name": "linux", # Name of the package "version": "4.7.2", # Version of the package "size": 666, # Size of the installed package (MB) "archive": "linux-4.7.2.tar.xz", # Archive name @@ -52,8 +52,7 @@ class Linux_Headers_P1: return self.e(["make", "mrproper"]) def install(self): - return self.e(["make", "INSTALL_HDR_PATH=dest", "headers_install"]) + return self.e(["make", "INSTALL_HDR_PATH=dest", "headers_install", "-j", self.conf_lst["cpus"]]) def after(self): - # DO NOT WORK - return self.e(["cp", "-v", "dest/include/*", "/tools/include"]) + return self.e(["cp", "-rvf", "dest/include/*", "/tools/include"], shell=True) diff --git a/screens/install/install.py b/screens/install/install.py @@ -85,6 +85,8 @@ class Install: # Load packages files self.load_pkgs() + #self.phase_1_install() + #sys.exit(1) # If a pre-existing install is present, clean it if os.path.isdir(self.mnt_point): @@ -228,8 +230,11 @@ class Install: # args is the list of bin + arguments (['ls', '-la']) # Note that this function automatically hide the output of the command. # Return the output of the command, bytes format - def exec(self, args, input=False): - p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=STDOUT) + def exec(self, args, input=False, shell=False): + if shell == True: + p = Popen(' '.join(args), stdin=PIPE, stdout=PIPE, stderr=STDOUT, shell=True) + else: + p = Popen(args, stdin=PIPE, stdout=PIPE, stderr=STDOUT) if input != False: out = p.communicate(input=input)[0] else: @@ -311,6 +316,30 @@ class Install: if len(to_dl): self.archive_dowload(to_dl) self.check_archive(pkg_list) + self.untar_all(pkg_list) + + # Function that untar all the archives + # lst is an object of the packages to decompress + def untar_all(self, lst): + to_unpack = len(lst) # Number of package to untar + unpacked = 1 # Current archives decompressed + + # Start the progress bar + self.dlg.gauge_start("Unpacking "+ str(to_unpack) +" packages ...", width=50) + + # Iterating over the packages + for name, p in lst.items(): + + # Update the progress bar + self.dlg.gauge_update(int((unpacked * 100) / to_unpack), + "Unpacking "+ p[1]["archive"] + "...", True) + + # Un-tar the archive + self.untar(p[1]) + unpacked += 1 + + # Stopping the progress bar + self.dlg.gauge_stop() # This function handle the downloading of archive # The lst is a list of package to download @@ -406,22 +435,22 @@ class Install: installed = 1 while pkg != False: - # Init the global progress bar + # Return to the archive dir + os.chdir(self.arch_dir) + + # Init the global progress bar self.global_progress_bar(text="Installing "+ pkg[1]["name"] +"-"+ pkg[1]["version"]+ "...", percent=int((installed * 100) / to_install), - decomp="In Progress", conf="N/A", comp="N/A", - inst="N/A", post_comp="N/A", pre_comp="N/A") + conf="N/A", comp="N/A", + inst="N/A", post_comp="N/A", pre_comp="In Progress") # If the package is the first, we measure the time if self.sbu_time == 0 and first == pkg[1]["name"]: start = time.time() self.async_progress_bar() - - # Decompress the archive - self.untar(pkg[1]) - - self.global_progress_bar(decomp="Done", pre_comp="In Progress") + # Chdir into the decompressed directory (Must be in the format name-version) + os.chdir(pkg[1]["name"] + "-" + pkg[1]["version"]) # Before instructions if "before" not in pkg[1]: @@ -495,11 +524,8 @@ class Install: # Un-taring the archive self.exec(["tar", "xf", conf["archive"]]) - # Chdir into the decompressed directory (Must be in the format name-version) - os.chdir(conf["name"] + "-" + conf["version"]) - # Function that display the global progress bar for an install - def global_progress_bar(self, text="", percent=-1, decomp="", + def global_progress_bar(self, text="", percent=-1, pre_comp="", conf="", comp="", inst="", post_comp="", reset=False): # Setting the text @@ -510,10 +536,6 @@ class Install: if percent != -1: self.m_gauge["percent"] = percent - # Setting the decompression status - if decomp != "": - self.m_gauge["decomp"] = decomp - # Setting the pre compilation status if pre_comp != "": self.m_gauge["pre_comp"] = pre_comp @@ -554,7 +576,6 @@ class Install: self.dlg.mixedgauge(self.m_gauge["text"] + s_time, percent=self.m_gauge["percent"], elements = [ - ("Decompressing", self.m_gauge["decomp"]), ("Pre-Compilation", self.m_gauge["pre_comp"]), ("Configuration", self.m_gauge["conf"]), ("Compilation", self.m_gauge["comp"]),