|
|
myfile = mypkg + ".tbz2" | myfile = mypkg + ".tbz2" |
mypath = os.path.join("All", myfile) | mypath = os.path.join("All", myfile) |
dest_path = os.path.join(self.pkgdir, mypath) | dest_path = os.path.join(self.pkgdir, mypath) |
if os.path.exists(dest_path): |
|
|
try: |
|
st = os.lstat(dest_path) |
|
except OSError: |
|
st = None |
|
else: |
|
if stat.S_ISLNK(st.st_mode): |
|
st = None |
|
try: |
|
os.unlink(dest_path) |
|
except OSError: |
|
if os.path.exists(dest_path): |
|
raise |
|
|
|
if st is not None: |
# For invalid packages, other_cat could be None. | # For invalid packages, other_cat could be None. |
other_cat = portage.xpak.tbz2(dest_path).getfile("CATEGORY") | other_cat = portage.xpak.tbz2(dest_path).getfile("CATEGORY") |
if other_cat: | if other_cat: |
|
|
other_cpv = other_cat + "/" + mypkg | other_cpv = other_cat + "/" + mypkg |
self._move_from_all(other_cpv) | self._move_from_all(other_cpv) |
self.inject(other_cpv) | self.inject(other_cpv) |
"""The file may or may not exist. Move it if necessary and update |
|
internal state for future calls to getname().""" |
|
self._move_to_all(cpv) | self._move_to_all(cpv) |
if os.path.exists(full_path): |
|
self.inject(cpv) |
|
| |
def _ensure_dir(self, path): | def _ensure_dir(self, path): |
""" | """ |
|
|
for future getname() calls.""" | for future getname() calls.""" |
mycat, mypkg = catsplit(cpv) | mycat, mypkg = catsplit(cpv) |
myfile = mypkg + ".tbz2" | myfile = mypkg + ".tbz2" |
|
self._pkg_paths[cpv] = os.path.join("All", myfile) |
src_path = os.path.join(self.pkgdir, mycat, myfile) | src_path = os.path.join(self.pkgdir, mycat, myfile) |
try: | try: |
mystat = os.lstat(src_path) | mystat = os.lstat(src_path) |
|
|
dest_path = os.path.join(self.pkgdir, "All", myfile) | dest_path = os.path.join(self.pkgdir, "All", myfile) |
_movefile(src_path, dest_path, mysettings=self.settings) | _movefile(src_path, dest_path, mysettings=self.settings) |
self._create_symlink(cpv) | self._create_symlink(cpv) |
self._pkg_paths[cpv] = os.path.join("All", myfile) |
self.inject(cpv) |
| |
def _move_from_all(self, cpv): | def _move_from_all(self, cpv): |
"""Move a package from ${PKGDIR}/All/${PF}.tbz2 to | """Move a package from ${PKGDIR}/All/${PF}.tbz2 to |