Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-tools.git;a=commitdiff;h=e5b43e76a96c35265f1f278e144f7cb116d2d470

commit e5b43e76a96c35265f1f278e144f7cb116d2d470
Author: VMiklos <[EMAIL PROTECTED]>
Date:   Sun Sep 30 23:22:34 2007 +0200

move mirrors.py to its own dir, it'll be never installed

diff --git a/mirrors.py b/mirrors.py
deleted file mode 100644
index 2576761..0000000
--- a/mirrors.py
+++ /dev/null
@@ -1,77 +0,0 @@
-from xml.dom import minidom
-import sys
-
-class Mirror (object):
-       def __init__(self):
-               self.types = []
-       def dumpattr(self, what, dest):
-               dest.write("# ")
-               for i in range(len(what)+4):
-                       dest.write("-")
-               dest.write("\n")
-               dest.write("# - %s -\n" % what.upper())
-               dest.write("# ")
-               for i in range(len(self.country)+4):
-                       dest.write("-")
-               dest.write("\n")
-
-mirrors = {}
-try:
-       ver = sys.argv[1]
-       repo = sys.argv[2]
-       input = sys.argv[3]
-       out = sys.argv[4]
-except IndexError:
-       raise Exception("usage example: python %s frugalware-stable frugalware 
input.xml output" % sys.argv[0])
-
-xmldoc = minidom.parse(input)
-for i in xmldoc.getElementsByTagName('mirror'):
-       if not i.getElementsByTagName('id'):
-               continue
-       m = Mirror()
-       for j in i.getElementsByTagName('type'):
-               m.types.append(j.firstChild.toxml())
-       for j in ['id', 'path', 'rsync_path', 'country', 'supplier', 
'bandwidth']:
-               if i.getElementsByTagName(j) and 
i.getElementsByTagName(j)[0].firstChild:
-                       m.__setattr__(j, 
i.getElementsByTagName(j)[0].firstChild.toxml())
-       try:
-               mirrors[m.country]
-       except KeyError:
-               mirrors[m.country] = []
-       mirrors[m.country].append(m)
-countries = mirrors.keys()
-countries.sort()
-sock = open(out, "w")
-sock.write("""#
-# %s repository
-#
-
-repos=([EMAIL PROTECTED] '%s')
-
-%s_servers=(
-""" % (ver, out, out))
-for i in countries:
-       dumped = False
-       for j in mirrors[i]:
-               if "rsync" in j.types:
-                       try:
-                               j.path = j.rsync_path
-                       except AttributeError:
-                               pass
-               else:
-                       continue
-               if not dumped:
-                       mirrors[i][0].dumpattr(mirrors[i][0].country, sock)
-                       dumped = True
-               sock.write("# %s (%s)\n" % (j.supplier, j.bandwidth))
-               sock.write('"rsync://rsync%s.frugalware.org/%s/%s"\n' %
-                               (j.id, j.path, ver))
-sock.write(""")
-
-# the rest is only for developers who upload packages
-# if the server requires sudo usage, the name of the user to execute the 
commands as
-%s_sudo="vmiklos"
-# name of the package database
-%s_fdb="%s.fdb"
-""" % (out, out, repo))
-sock.close()
diff --git a/repoman.d/Makefile b/repoman.d/Makefile
index 386c12c..650f9a3 100644
--- a/repoman.d/Makefile
+++ b/repoman.d/Makefile
@@ -1,7 +1,7 @@
all: current stable

current:
-       python ../mirrors.py frugalware-current frugalware-current 
~/darcs/homepage-ng/frugalware/xml/mirrors2.xml current
+       python ../tools/mirrors.py frugalware-current frugalware-current 
~/git/homepage-ng/frugalware/xml/mirrors2.xml current

stable:
-       python ../mirrors.py frugalware-stable frugalware 
~/darcs/homepage-ng/frugalware/xml/mirrors2.xml stable
+       python ../tools/mirrors.py frugalware-stable frugalware 
~/git/homepage-ng/frugalware/xml/mirrors2.xml stable
diff --git a/tools/mirrors.py b/tools/mirrors.py
new file mode 100644
index 0000000..2576761
--- /dev/null
+++ b/tools/mirrors.py
@@ -0,0 +1,77 @@
+from xml.dom import minidom
+import sys
+
+class Mirror (object):
+       def __init__(self):
+               self.types = []
+       def dumpattr(self, what, dest):
+               dest.write("# ")
+               for i in range(len(what)+4):
+                       dest.write("-")
+               dest.write("\n")
+               dest.write("# - %s -\n" % what.upper())
+               dest.write("# ")
+               for i in range(len(self.country)+4):
+                       dest.write("-")
+               dest.write("\n")
+
+mirrors = {}
+try:
+       ver = sys.argv[1]
+       repo = sys.argv[2]
+       input = sys.argv[3]
+       out = sys.argv[4]
+except IndexError:
+       raise Exception("usage example: python %s frugalware-stable frugalware 
input.xml output" % sys.argv[0])
+
+xmldoc = minidom.parse(input)
+for i in xmldoc.getElementsByTagName('mirror'):
+       if not i.getElementsByTagName('id'):
+               continue
+       m = Mirror()
+       for j in i.getElementsByTagName('type'):
+               m.types.append(j.firstChild.toxml())
+       for j in ['id', 'path', 'rsync_path', 'country', 'supplier', 
'bandwidth']:
+               if i.getElementsByTagName(j) and 
i.getElementsByTagName(j)[0].firstChild:
+                       m.__setattr__(j, 
i.getElementsByTagName(j)[0].firstChild.toxml())
+       try:
+               mirrors[m.country]
+       except KeyError:
+               mirrors[m.country] = []
+       mirrors[m.country].append(m)
+countries = mirrors.keys()
+countries.sort()
+sock = open(out, "w")
+sock.write("""#
+# %s repository
+#
+
+repos=([EMAIL PROTECTED] '%s')
+
+%s_servers=(
+""" % (ver, out, out))
+for i in countries:
+       dumped = False
+       for j in mirrors[i]:
+               if "rsync" in j.types:
+                       try:
+                               j.path = j.rsync_path
+                       except AttributeError:
+                               pass
+               else:
+                       continue
+               if not dumped:
+                       mirrors[i][0].dumpattr(mirrors[i][0].country, sock)
+                       dumped = True
+               sock.write("# %s (%s)\n" % (j.supplier, j.bandwidth))
+               sock.write('"rsync://rsync%s.frugalware.org/%s/%s"\n' %
+                               (j.id, j.path, ver))
+sock.write(""")
+
+# the rest is only for developers who upload packages
+# if the server requires sudo usage, the name of the user to execute the 
commands as
+%s_sudo="vmiklos"
+# name of the package database
+%s_fdb="%s.fdb"
+""" % (out, out, repo))
+sock.close()
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to