From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QrUqr-0004WY-42 for garchives@archives.gentoo.org; Thu, 11 Aug 2011 12:59:09 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C00AC21C081; Thu, 11 Aug 2011 12:58:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 71F3821C081 for ; Thu, 11 Aug 2011 12:58:59 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D078F1B4068 for ; Thu, 11 Aug 2011 12:58:58 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 34C6580044 for ; Thu, 11 Aug 2011 12:58:58 +0000 (UTC) From: "Wiktor W Brodlo" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Wiktor W Brodlo" Message-ID: <17fe1477e919c91e45476f712680ef107a57e0ec.wiktor@gentoo> Subject: [gentoo-commits] proj/anaconda:master commit in: gentoo/ X-VCS-Repository: proj/anaconda X-VCS-Files: gentoo/utils.py X-VCS-Directories: gentoo/ X-VCS-Committer: wiktor X-VCS-Committer-Name: Wiktor W Brodlo X-VCS-Revision: 17fe1477e919c91e45476f712680ef107a57e0ec Date: Thu, 11 Aug 2011 12:58:58 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 7bc0994691a28387c1e6329dcbd9db08 commit: 17fe1477e919c91e45476f712680ef107a57e0ec Author: wiktor w brodlo brodlo net> AuthorDate: Thu Aug 11 12:58:20 2011 +0000 Commit: Wiktor W Brodlo brodlo net> CommitDate: Thu Aug 11 12:58:20 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/anaconda.git;= a=3Dcommit;h=3D17fe1477 Sync Portage and install from a stage3 tarball --- gentoo/utils.py | 133 +++++++------------------------------------------= ----- 1 files changed, 18 insertions(+), 115 deletions(-) diff --git a/gentoo/utils.py b/gentoo/utils.py index 45a3888..017c8d4 100644 --- a/gentoo/utils.py +++ b/gentoo/utils.py @@ -760,113 +760,7 @@ class GentooInstall: =20 =20 action =3D _("System Installation") - copy_update_interval =3D 10 - copy_update_counter =3D 9 - # get file counters - total_files =3D 0 - image_dir =3D self._prod_root - for z,z,files in os.walk(image_dir): - for file in files: - total_files +=3D 1 - - self._progress.set_fraction(0.0) - self._progress.set_text(action) - - def copy_other(fromfile, tofile): - proc =3D subprocess.Popen(("/bin/cp", "-a", fromfile, tofile= ), - stdout =3D subprocess.PIPE, stderr =3D subprocess.PIPE) - proc.wait() - del proc - - def copy_reg(fromfile, tofile): - try: - shutil.copy2(fromfile, tofile) - user =3D os.stat(fromfile)[4] - group =3D os.stat(fromfile)[5] - os.chown(tofile, user, group) - shutil.copystat(fromfile, tofile) - except IOError, e: - if (e[0] =3D=3D 40) or (e[0] =3D=3D 2): - # workaround for Too many levels of symbolic links - copy_other(fromfile, tofile) - else: - raise - - def copy_lnk(fromfile, tofile): - source_link =3D os.readlink(fromfile) - if os.path.lexists(tofile): - os.remove(tofile) - os.symlink(source_link, tofile) - - current_counter =3D 0 - currentfile =3D "/" - image_dir_len =3D len(image_dir) - # Create the directory structure - # self.InstallFilesToIgnore - for currentdir, subdirs, files in os.walk(image_dir): - - copy_update_counter +=3D 1 - - for xdir in subdirs: - - image_path_dir =3D currentdir + "/" + xdir - mydir =3D image_path_dir[image_dir_len:] - rootdir =3D self._root + mydir - - # handle broken symlinks - if os.path.islink(rootdir) and not os.path.exists(rootdi= r): - # broken symlink - os.remove(rootdir) - - # if our directory is a file on the live system - elif os.path.isfile(rootdir): # really weird...! - os.remove(rootdir) - - # if our directory is a symlink instead, then copy the s= ymlink - if os.path.islink(image_path_dir) and not os.path.isdir(= rootdir): - # for security we skip live items that are dirs - tolink =3D os.readlink(image_path_dir) - if os.path.islink(rootdir): - os.remove(rootdir) - os.symlink(tolink,rootdir) - elif (not os.path.isdir(rootdir)) and \ - (not os.access(rootdir,os.R_OK)): - os.makedirs(rootdir) - - if not os.path.islink(rootdir): - # symlink don't need permissions, also until os.walk - # ends they might be broken - user =3D os.stat(image_path_dir)[4] - group =3D os.stat(image_path_dir)[5] - os.chown(rootdir,user,group) - shutil.copystat(image_path_dir,rootdir) - - for path_file in sorted(files): - - current_counter +=3D 1 - fromfile =3D currentdir + "/" + path_file - currentfile =3D fromfile[image_dir_len:] - - if currentfile.startswith("/dev/"): - continue - - - tofile =3D self._root + currentfile - st_info =3D os.lstat(fromfile) - if stat.S_ISREG(st_info[stat.ST_MODE]): - copy_reg(fromfile, tofile) - elif stat.S_ISLNK(st_info[stat.ST_MODE]): - copy_lnk(fromfile, tofile) - else: - copy_other(fromfile, tofile) - - - if (copy_update_counter =3D=3D copy_update_interval) or \ - ((total_files - 1000) < current_counter): - # do that every 1000 iterations - copy_update_counter =3D 0 - frac =3D float(current_counter)/total_files - self._progress.set_fraction(frac) + anaconda._intf.instProgress.terminal.run_command("tar xvjpf /tmp= /stage3.tar.bz2 -C "+self._root) =20 self._progress.set_fraction(1) =20 @@ -882,8 +776,8 @@ class GentooInstall: =20 def copy_portage(self): self._progress.set_fraction(0.0) - self._progress.set_text(_("Copying the Portage tree (can take a = long time)")) - subprocess.call(["cp", "--recursive", "/usr/portage", self._root= +"/usr/"]) + self._progress.set_text(_("Syncing the Portage tree (can take a = long time)")) + self.portage.sync() # We need some packages from anaconda-overlay but ideally they s= hould be added to portage self._progress.set_fraction(0.1) subprocess.call(["cp", "--recursive", "/anaconda-overlay/app-adm= in", self._root+"/usr/portage/"]) @@ -969,12 +863,21 @@ class GentooInstall: =20 def install_kernel(self): self._progress.set_text(_("Installing the kernel")) - # TODO: Proper genkernel build - subprocess.call(["mount", "/dev/sr0", "/mnt/cdrom"]) - shutil.copy2("/mnt/cdrom/boot/gentoo", self._root+"/boot/kernel-= gentoo") - shutil.copy2("/mnt/cdrom/boot/gentoo.igz", self._root+"/boot/ini= trd-gentoo") - self._progress.set_fraction(0.9) - subprocess.call(["cp", "-PR", "/lib/modules", self._root+"/lib"]= ) + if self.anaconda.genkernel: + subprocess.call(["mount", "/dev/sr0", "/mnt/cdrom"]) + shutil.copy2("/mnt/cdrom/boot/gentoo", self._root+"/boot/ker= nel-gentoo") + shutil.copy2("/mnt/cdrom/boot/gentoo.igz", self._root+"/boot= /initrd-gentoo") + self._progress.set_fraction(0.9) + subprocess.call(["cp", "-PR", "/lib/modules", self._root+"/l= ib"]) + else: + shutil.copy2("/usr/src/linux-"+self.anaconda.kernel, self._r= oot+"/usr/src/") + self._progress.set_fraction(0.5) + self._progress.set_text(_("Compiling your custom kernel")) + anaconda._intf.instProgress.terminal.run_command("chroot "+s= elf._root+" eselect kernel set 1") + anaconda._intf.instProgress.terminal.run_command("cd "+self.= _root+"/usr/src/linux") + anaconda._intf.instProgress.terminal.run_command("make && ma= ke modules && make modules_install") + shutil.copy2(self+.root+"/usr/src/linux/arch/x86/boot/bzImag= e", self._root+"/boot/kernel-gentoo") + =20 self._progress.set_fraction(1.0) =20 def _get_langpacks(self):