diff --git a/pym/cl_builder.py b/pym/cl_builder.py index d6477c7..793e8fd 100644 --- a/pym/cl_builder.py +++ b/pym/cl_builder.py @@ -244,24 +244,18 @@ class cl_builder(color_print): distrPath) self.printByResult(True); - def prepareSourceDistributive(self,distr): - """Unmount all bind,proc mount points from source distribute""" - mp = self.clVars.Get('cl_builder_path') - mps = filter(lambda x:x!=mp,map(lambda x:x[1],childMounts(mp))) - for target in sorted(mps, reverse=True): - self.printMessageForTest(_("Unmounting %s")%(target[len(mp):])) - umountProcess = process("umount",target) - if umountProcess.failed(): - raise BuilderError(_("Failed to unmount %s")%target) - self.printByResult(True) - distrPath = distr.convertToDirectory().getDirectory() - self.clVars.Set('cl_builder_squash_path', - os.path.basename(os.path.normpath(distrPath))) - self.cleanNeedlessKernelData(distrPath) - self.dispatchConf(distrPath) - - builderPath = self.clVars.Get('cl_builder_path') + def updatePortage(self,builderPath): + """Change branch to master and update portage""" if self.assembleIso: + # restore resolv conf if needed + resolvFile = "etc/resolv.conf" + if not path.exists(path.join(builderPath,resolvFile)): + if path.exists('/%s'%resolvFile): + try: + shutil.copyfile('/%s'%resolvFile, + path.join(builderPath,resolvFile)) + except: + pass for gitName,gitDir in (('portage','/usr/portage'), ('overlay','/var/lib/layman/calculate')): gitHead = pathJoin(builderPath,gitDir,".git/HEAD") @@ -271,17 +265,36 @@ class cl_builder(color_print): _("Changing {repname} repository branch to '{branch}'"). format(repname=gitName, branch='master')) - changeBranch = self.runChroot(distrPath, + changeBranch = self.runChroot(builderPath, "cd %s;git pull;git checkout master;git pull"%gitDir) self.printByResult(changeBranch.success()) self.printMessageForTest(_("Updating portage")) - updateMeta = self.runChroot(distrPath,"emerge --sync") + updateMeta = self.runChroot(builderPath,"emerge --sync") self.printByResult(updateMeta.success()) + def prepareSourceDistributive(self,distr): + """Unmount all bind,proc mount points from source distribute""" + mp = self.clVars.Get('cl_builder_path') + self.dispatchConf(mp) + self.updatePortage(mp) + + # unmount all from source distribute + mps = filter(lambda x:x!=mp,map(lambda x:x[1],childMounts(mp))) + for target in sorted(mps, reverse=True): + self.printMessageForTest(_("Unmounting %s")%(target[len(mp):])) + umountProcess = process("umount",target) + if umountProcess.failed(): + raise BuilderError(_("Failed to unmount %s")%target) + self.printByResult(True) + distrPath = distr.convertToDirectory().getDirectory() + self.clVars.Set('cl_builder_squash_path', + os.path.basename(os.path.normpath(distrPath))) + self.cleanNeedlessKernelData(distrPath) + self.applyTemplatesForSquash(distrPath) # change make.profile - curProfileFile = pathJoin(builderPath,"etc/make.profile") + curProfileFile = pathJoin(mp,"etc/make.profile") self.curProfile = os.readlink(curProfileFile) profile = self.clVars.Get('os_builder_profile') newProfile = None