# Distributed under the terms of the GNU General Public License v2
import os, string, stat, sys, time
+
+for x in ['CFLAGS','LDFLAGS','USE']:
+ os.environ[x]=''
+
import xpak, portage, portage_checksum, portage_dep, portage_util
argc=len(sys.argv)
else:
All=portage.settings["PKGDIR"]+"/All"
+All=os.path.normpath(All)
+
+if os.path.exists("/usr/bin/eclean") and "cleanpkgdir" in portage.settings["FEATURES"]:
+ os.system("/usr/bin/eclean -d packages")
+
os.chdir(All)
-portage.writemsg(portage.green(' * ')+'update binary package index %s\n' % All);
+portage.writemsg(portage.green(' * ')+'Update binary package index %s\n' % All);
start = time.time()
# generic name of our package index.
-control_file = "Packages"
+control_file = ".Packages"
try:
import re
packages.sort()
+timestamp=str(start).split(".")[0]
# trunc the file and begin write operations.
fp = open(control_file, "w")
if argc <= 1:
fp.write("PROFILE: "+profilever+"\n")
fp.write("PACKAGES: "+str(len(packages)) +"\n")
+ fp.write("TIMESTAMP: "+timestamp+"\n")
vmask = [ "AUTOCLEAN", "DISTDIR", "PKGDIR", "PORTDIR" , "PORTAGE_TMPDIR" ]
vars = portage_util.grabfile(portage.settings["PORTDIR"]+"/profiles/info_vars")
if portage.settings.has_key(x):
if (len(portage.settings[x])):
fp.write(x+": "+portage.settings[x]+"\n")
- fp.write("\n")
+else:
+ fp.write("PACKAGES: "+str(len(packages)) +"\n")
+ fp.write("TIMESTAMP: "+timestamp+"\n")
+
+fp.write("\n")
for cat, pkg, tbz2, stuff in packages:
use = xpak.getitem(stuff, "USE")
fp.write("\n")
fp.flush()
fp.close()
+os.rename(".Packages", "Packages")
finish = time.time()