X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fmirror_split.py;h=3f79020fc5f02d7def52faafdf9d2432ded2e60d;hb=df1bf169c5b89fa9764a326bbd7a6883a8789f6b;hp=63096877f3ecda9e335494d3f2a89b39d7360d36;hpb=06ce98c8111a8b09e5603dbbd34324a216412d69;p=dak.git diff --git a/dak/mirror_split.py b/dak/mirror_split.py old mode 100755 new mode 100644 index 63096877..3f79020f --- a/dak/mirror_split.py +++ b/dak/mirror_split.py @@ -24,13 +24,14 @@ ############################################################################### import sys -import dak.lib.utils import apt_pkg from stat import S_ISDIR, S_ISLNK, S_ISREG import os import cPickle +import daklib.utils + ## Master path is the main repository #MASTER_PATH = "/org/ftp.debian.org/scratch/dsilvers/master" @@ -96,7 +97,7 @@ class MirrorSplitTarget: if path.find("/installer-") != -1: return 0 return 1 - + ############################################################################## # The applicable function is basically a predicate. Given a path and a # target object its job is to decide if the path conforms for the @@ -166,7 +167,7 @@ class MirrorSplitDB: elif S_ISREG(lnl[0]): bdir.files[ln] = lnl[1] else: - dak.lib.utils.fubar( "Confused by %s/%s -- not a dir, link or file" % + daklib.utils.fubar( "Confused by %s/%s -- not a dir, link or file" % ( path, ln ) ) for d in dirs: bdir.dirs[d] = self._internal_recurse( "%s/%s" % (path,d) ) @@ -189,7 +190,7 @@ class MirrorSplitDB: cPickle.dump( self.root, f, 1 ) f.close() - + ############################################################################## # Helper functions for the tree syncing... ################## @@ -237,7 +238,7 @@ def _internal_reconcile( path, srcdir, targdir, targ ): #print "-L-", _pth(path,k) do_unlink(targ, _pth(path,k)) del targdir.links[k] - + # Remove any files in targdir which aren't in srcdir # Or which aren't applicable rm = [] @@ -280,7 +281,7 @@ def _internal_reconcile( path, srcdir, targdir, targ ): for k in srcdir.links.keys(): if applicable( _pth(path,k), targ ): if not targdir.links.has_key(k): - targdir.links[k] = srcdir.links[k]; + targdir.links[k] = srcdir.links[k]; #print "+L+",_pth(path,k), "->", srcdir.links[k] do_symlink( targ, _pth(path,k), targdir.links[k] ) else: @@ -313,7 +314,7 @@ def load_config(): MASTER_PATH = Cnf["Mirror-Split::FTPPath"] TREE_ROOT = Cnf["Mirror-Split::TreeRootPath"] TREE_DB_ROOT = Cnf["Mirror-Split::TreeDatabasePath"] - + for a in Cnf.ValueList("Mirror-Split::BasicTrees"): trees.append( MirrorSplitTarget( a, "%s,all" % a, 1 ) ) @@ -337,7 +338,7 @@ def do_list (): print " [source]" else: print "" - + def do_help (): print """Usage: dak mirror-split [OPTIONS] Generate hardlink trees of certain architectures @@ -350,7 +351,7 @@ Generate hardlink trees of certain architectures def main (): global Cnf - Cnf = dak.lib.utils.get_conf() + Cnf = daklib.utils.get_conf() Arguments = [('h',"help","Mirror-Split::Options::Help"), ('l',"list","Mirror-Split::Options::List"), @@ -370,7 +371,7 @@ def main (): if Options.has_key("List"): do_list() return - + src = MirrorSplitDB() print "Scanning", MASTER_PATH @@ -383,7 +384,7 @@ def main (): print "Saving updated DB...", tree.save_db() print "Done" - + ############################################################################## if __name__ == '__main__':