r394 - /debtorrent/trunk/uniquely_projectb.py
camrdale-guest at users.alioth.debian.org
camrdale-guest at users.alioth.debian.org
Wed Jun 25 20:59:22 UTC 2008
Author: camrdale-guest
Date: Wed Jun 25 20:59:22 2008
New Revision: 394
URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=394
Log:
uniquely_projectb also creates a link to the suite-named file
Modified:
debtorrent/trunk/uniquely_projectb.py
Modified: debtorrent/trunk/uniquely_projectb.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/uniquely_projectb.py?rev=394&op=diff
==============================================================================
--- debtorrent/trunk/uniquely_projectb.py (original)
+++ debtorrent/trunk/uniquely_projectb.py Wed Jun 25 20:59:22 2008
@@ -8,7 +8,7 @@
import pgdb
from bz2 import BZ2File
from math import ceil
-from os import remove, rename, system
+from os import remove, rename, system, symlink
from os.path import exists
from time import strftime, gmtime
from debian_bundle import deb822
@@ -304,7 +304,8 @@
f.close()
rename(filename + '.new', filename)
-def process_file(db, torrent_file, release_headers, packages, suite, codename, component, arch):
+def process_file(db, torrent_file, release_headers, packages,
+ suite, codename, component, arch, link_file = None):
"""
@type db: C{DB-APIv2 connection}
@@ -323,6 +324,8 @@
@param component: the component name (e.g. main, contrib, non-free)
@type arch: C{string}
@param arch: the architecture name (e.g. i386, amd64, all)
+ @type link_file: C{string}
+ @param link_file: the symlink to create to the torrent_file
"""
@@ -338,6 +341,8 @@
print "WARNING: no matching Packages file for component %s, arch %s" % (component, arch)
if exists(torrent_file):
remove(torrent_file)
+ if link_file and exists(link_file):
+ remove(link_file)
return
packages.pop(packages.index(filename))
@@ -370,10 +375,16 @@
print "writing ...",
sys.stdout.flush()
write_file(torrent_file, pieces, headers)
+ if link_file:
+ if exists(link_file):
+ remove(link_file)
+ symlink(torrent_file, link_file)
else:
print "empty ...",
if exists(torrent_file):
remove(torrent_file)
+ if link_file and exists(link_file):
+ remove(link_file)
print "done."
@@ -399,13 +410,18 @@
archs.append('all')
archs.sort()
torrent_prefix = "dists_" + codename + "_"
+ link_prefix = "dists_" + suite + "_"
torrent_suffix = "_Packages-torrent.gz"
# Process each components' architecture
for component in components:
for arch in archs:
torrent_file = torrent_prefix + component + "_binary-" + arch + torrent_suffix
- process_file(db, torrent_file, release_headers, packages, suite, codename, component, arch)
+ link_file = None
+ if suite != codename:
+ link_file = link_prefix + component + "_binary-" + arch + torrent_suffix
+ process_file(db, torrent_file, release_headers, packages,
+ suite, codename, component, arch, link_file)
if packages:
print "The following packages files were not used:"
More information about the Debtorrent-commits
mailing list