From: solar Date: Mon, 5 Feb 2007 19:43:26 +0000 (-0000) Subject: - fix up some whitespaces and use portage_const.CACHE_PATH+/xpak/ vs $PORTAGE_TMPDIR... X-Git-Tag: gentoolkit-0.2.4.3~168 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=44bb6fc41c1b1f3146ae29f443d038ae71fa0e18;p=gentoolkit.git - fix up some whitespaces and use portage_const.CACHE_PATH+/xpak/ vs $PORTAGE_TMPDIR/.xpak svn path=/; revision=345 --- diff --git a/trunk/src/genpkgindex/genpkgindex b/trunk/src/genpkgindex/genpkgindex index dc0b439..1777301 100644 --- a/trunk/src/genpkgindex/genpkgindex +++ b/trunk/src/genpkgindex/genpkgindex @@ -9,7 +9,7 @@ if getattr(__builtins__, "set", None) is None: for x in ['CFLAGS','CXXFLAGS', 'LDFLAGS','USE']: os.environ[x]='' -import xpak, portage, portage_checksum, portage_dep, portage_util +import xpak, portage, portage_checksum, portage_dep, portage_util, portage_const argc=len(sys.argv) @@ -40,7 +40,7 @@ control_file = ".Packages" try: import re profilever = os.path.normpath("///"+os.readlink("/etc/make.profile")) - basepath = os.path.normpath("///"+portage.settings["PORTDIR"]+"/profiles") + basepath = os.path.normpath("///"+portage.settings["PORTDIR"]+"/profiles") if re.match(basepath,profilever): profilever = profilever[len(basepath)+1:] else: @@ -55,15 +55,15 @@ except: packages = [] for pkg in os.listdir('.'): - if not os.path.basename(pkg).endswith("tbz2"): - continue + if not os.path.basename(pkg).endswith("tbz2"): + continue st = os.stat(pkg) - if not os.path.exists(portage.settings["PORTAGE_TMPDIR"]+"/portage/.xpak/"): - os.mkdir(portage.settings["PORTAGE_TMPDIR"]+"/portage/.xpak/") + if not os.path.exists(portage_const.CACHE_PATH+"/xpak/"): + os.mkdir(portage_const.CACHE_PATH+"/xpak/") - fname = portage.settings["PORTAGE_TMPDIR"]+"/portage/.xpak/"+os.path.basename(pkg)[:-5]+".xpak" + fname = portage_const.CACHE_PATH+"/xpak/"+os.path.basename(pkg)[:-5]+".xpak" if os.path.exists(fname): if st.st_mtime != os.stat(fname).st_mtime: @@ -71,8 +71,7 @@ for pkg in os.listdir('.'): os.unlink(fname) if not os.path.exists(fname): - - tbz2 = xpak.tbz2(pkg) + tbz2 = xpak.tbz2(pkg) xpdata = xpak.xpak_mem(tbz2.get_data()) fp = open(fname, "w") fp.write(xpdata+xpak.encodeint(len(xpdata))+"STOP") @@ -206,7 +205,8 @@ fp.flush() fp.close() os.rename(".Packages", "Packages") -os.chdir(portage.settings["PORTAGE_TMPDIR"]+"/portage/.xpak") +# Clean up stale cache files +os.chdir(portage_const.CACHE_PATH+"/xpak") for pkg in os.listdir('.'): p = os.path.basename(pkg) if not p.endswith(".xpak"):