[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r17037: {projects} Enhanced package handling (Separated package syncing, buildi (projects/gettor)
Author: ioerror
Date: 2008-10-02 11:51:09 -0400 (Thu, 02 Oct 2008)
New Revision: 17037
Modified:
projects/gettor/gettor_packages.py
Log:
Enhanced package handling (Separated package syncing, building and out-handing) by kaner. Yay.
Modified: projects/gettor/gettor_packages.py
===================================================================
--- projects/gettor/gettor_packages.py 2008-10-02 15:44:29 UTC (rev 17036)
+++ projects/gettor/gettor_packages.py 2008-10-02 15:51:09 UTC (rev 17037)
@@ -8,7 +8,7 @@
This is Free Software. See LICENSE for license information.
-
+ This module handles all package related functionality
'''
import os
@@ -20,9 +20,9 @@
class gettorPackages:
- packageRegex = { "vidalia-windows-bundle": "vidalia-bundle-.*.exe$",
- "vidalia-panther-bundle": "vidalia-bundle-.*-panther.dmg$",
- "vidalia-tiger-bundle": "vidalia-bundle-.*-tiger.dmg$",
+ packageRegex = { "windows-bundle": "vidalia-bundle-.*.exe$",
+ "panther-bundle": "vidalia-bundle-.*-panther.dmg$",
+ "tiger-bundle": "vidalia-bundle-.*-tiger.dmg$",
"source-bundle": "tor-.*.tar.gz",
}
@@ -35,24 +35,20 @@
self.rsync.append("-a")
# Don't download dotdirs
self.rsync.append("--exclude='.*'")
- for (pack, reg) in self.packageRegex.items():
- self.rsync.append("--include='"+reg+"'")
if not silent:
self.rsync.append("--progress")
self.rsync.append("rsync://%s/tor/dist/current/" % self.mirror)
self.rsync.append(self.distDir)
def getPackageList(self):
+ for filename in os.listdir(self.packDir):
+ self.packageList[filename[:-2]] = self.packDir + "/" + filename
return self.packageList
- def buildPackageList(self):
- process = subprocess.Popen(self.rsync)
- process.wait()
- # Packagelist building, part I: Set up basic bundle/file mapping
+ def buildPackages(self):
for filename in os.listdir(self.distDir):
for (pack, regex) in self.packageRegex.items():
if re.compile(regex).match(filename):
- print "Match: ", filename
file = self.distDir + "/" + filename
ascfile = file + ".asc"
zipFileName = self.packDir + "/" + pack + ".z"
@@ -64,17 +60,26 @@
zip.close()
self.packageList[pack] = zipFileName
break
- #else:
- # XXX: Maybe tell rsync to only sync needed files instead of
- # deleting them hereafter
- #print "Removing unneeded file: ", filename
- #os.unlink(self.distDir + "/" + filename)
+ if len(self.packageList) > 0:
+ return True
+ else:
+ return False
+ def syncWithMirror(self):
+ process = subprocess.Popen(self.rsync)
+ process.wait()
+ return process.returncode
+
if __name__ == "__main__" :
c = gettor_config.gettorConf()
p = gettorPackages("rsync.torproject.org", c)
print "Building packagelist.."
- p.buildPackageList()
+ if p.syncwithMirror() != 0:
+ print "Failed."
+ exit(1)
+ if not p.buildPackageList():
+ print "Failed."
+ exit(1)
print "Done."
for (pack, file) in p.getPackageList().items():
print "Bundle is mapped to file: ", pack, file