/[gli]/branches/qs/src/GLIPortage.py
Gentoo

Diff of /branches/qs/src/GLIPortage.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

branches/overhaul/src/GLIPortage.py Revision 1757 trunk/src/GLIPortage.py Revision 1832
77 counter = int(counter_f.readline().strip()) 77 counter = int(counter_f.readline().strip())
78 counter_f.close() 78 counter_f.close()
79 except: 79 except:
80 counter = 0 80 counter = 0
81 counter += 1 81 counter += 1
82 if not os.path.isdir(self._chroot_dir + "/var"):
83 os.mkdir(self._chroot_dir + "/var", 0755)
84 if not os.path.isdir(self._chroot_dir + "/var/cache"):
85 os.mkdir(self._chroot_dir + "/var/cache", 0755)
86 if not os.path.isdir(self._chroot_dir + "/var/cache/edb"):
87 os.mkdir(self._chroot_dir + "/var/cache/edb", 0775)
88 # chown to root:portage
89 try:
82 counter_f = open(self._chroot_dir + "/var/cache/edb/counter", "w") 90 counter_f = open(self._chroot_dir + "/var/cache/edb/counter", "w")
83 counter_f.write(str(counter)) 91 counter_f.write(str(counter))
84 counter_f.close() 92 counter_f.close()
93 except:
94 raise GLIException("UpdateCounterError", 'fatal', 'update_counter', "could not write new counter value")
85 return counter 95 return counter
86 96
87 def copy_pkg_to_chroot(self, package, use_root=False, ignore_missing=False): 97 def copy_pkg_to_chroot(self, package, use_root=False, ignore_missing=False):
88 symlinks = { '/bin': '/mnt/livecd/bin/', '/boot': '/mnt/livecd/boot/', '/lib': '/mnt/livecd/lib/', 98 symlinks = { '/bin': '/mnt/livecd/bin/', '/boot': '/mnt/livecd/boot/', '/lib': '/mnt/livecd/lib/',
89 '/opt': '/mnt/livecd/opt/', '/sbin': '/mnt/livecd/sbin/', '/usr': '/mnt/livecd/usr/', 99 '/opt': '/mnt/livecd/opt/', '/sbin': '/mnt/livecd/sbin/', '/usr': '/mnt/livecd/usr/',
90 '/etc/gconf': '/usr/livecd/gconf/' } 100 '/etc/gconf': '/usr/livecd/gconf/' }
91 101
92 tmpdir = "/var/tmp" 102 tmpdir = "/var/tmp"
93 image_dir = tmpdir + "/portage/" + package.split("/")[1] + "/image" 103 image_dir = tmpdir + "/portage/" + package + "/image"
94 root_cmd = "" 104 root_cmd = ""
95 tmp_chroot_dir = self._chroot_dir 105 tmp_chroot_dir = self._chroot_dir
96 portage_tmpdir = "/var/tmp" 106 portage_tmpdir = "/var/tmp"
97 vdb_dir = "/var/db/pkg/" 107 vdb_dir = "/var/db/pkg/"
98 if use_root: 108 if use_root:
144 if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): copying vdb entry for " + package) 154 if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): copying vdb entry for " + package)
145 if not GLIUtility.exitsuccess(GLIUtility.spawn("mkdir -p " + self._chroot_dir + "/var/db/pkg/" + package + " && cp -a /var/db/pkg/" + package + "/* " + self._chroot_dir + "/var/db/pkg/" + package, logfile=self._compile_logfile, append_log=True)): 155 if not GLIUtility.exitsuccess(GLIUtility.spawn("mkdir -p " + self._chroot_dir + "/var/db/pkg/" + package + " && cp -a /var/db/pkg/" + package + "/* " + self._chroot_dir + "/var/db/pkg/" + package, logfile=self._compile_logfile, append_log=True)):
146 raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not copy vdb entry for " + package) 156 raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not copy vdb entry for " + package)
147 157
148 # Update COUNTER 158 # Update COUNTER
159 if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): calling update_counter() to get updated COUNTER value for " + package)
160 counter = self.update_counter()
149 try: 161 try:
150 if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): calling update_counter() to get updated COUNTER value for " + package)
151 counter = self.update_counter()
152 if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): updating COUNTER value in vdb entry for " + package) 162 if self._debug: self._logger.log("DEBUG: copy_pkg_to_chroot(): updating COUNTER value (%s) in vdb entry for %s" % (self._chroot_dir + "/var/db/pkg/" + package + "/COUNTER", package))
153 counter_f = open(self._chroot_dir + "/var/db/pkg/" + package + "/COUNTER", "w") 163 counter_f = open(self._chroot_dir + "/var/db/pkg/" + package + "/COUNTER", "w")
154 counter_f.write(str(counter)) 164 counter_f.write(str(counter))
155 counter_f.close() 165 counter_f.close()
156 except: 166 except:
157 raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not update COUNTER for " + package) 167 raise GLIException("CopyPackageToChrootError", 'fatal', 'copy_pkg_to_chroot', "Could not update COUNTER for " + package)
246 package = self.get_best_version_vdb_chroot(package) 256 package = self.get_best_version_vdb_chroot(package)
247 if not package: return False 257 if not package: return False
248 expr = re.compile('^=?(.+?/.+?)(-\d.+)?$') 258 expr = re.compile('^=?(.+?/.+?)(-\d.+)?$')
249 res = expr.match(package) 259 res = expr.match(package)
250 if res: 260 if res:
251 GLIUtility.spawn("echo " + res.group(1) + " >> " + self._chroot_dir + "/var/lib/portage/world") 261 world_f = open(self._chroot_dir + "/var/lib/portage/world", "a")
262 world_f.write(res.group(1) + "\n")
263 world_f.close()
252 264
253 def get_best_version_vdb(self, package): 265 def get_best_version_vdb(self, package):
254 if package.startswith('='): 266 if package.startswith('='):
255 package = package[1:] 267 package = package[1:]
256 if GLIUtility.is_file("/var/db/pkg/" + package): 268 if GLIUtility.is_file("/var/db/pkg/" + package):

Legend:
Removed from v.1757  
changed lines
  Added in v.1832

  ViewVC Help
Powered by ViewVC 1.1.20