Re: yum-proxy?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi All,
I know there are very good reason not to use yet another "non standard" package, and configuring squid to do the work or making a local mirror. My feeling is that none of the "standard" solution is optimal for me, so I'm triyn another way. Http-replicator is small, and easy to setup. The patched version permits, through regular expressions to choose what kind of files to keep in a "flat" cache (where all the files with the same name are considered equal regardless of the source site or mirror). So I can select "RPM$" and/or "DEB$" and so on, and just tell yum/apt to use a proxy. I did some tests unpacking the attached version and it looks working without problems. I'll attach the patch as well as the full patched package, because my friend used a version which is no longer available on rpmforge.

Regards

Lorenzo

Attachment: http-replicator-20080201.tgz
Description: application/compressed-tar

Index: Cache.py
===================================================================
--- Cache.py	(revision 49)
+++ Cache.py	(working copy)
@@ -1,4 +1,5 @@
 import Params, os
+import re
 
 
 def makedirs( path ):
@@ -23,7 +24,12 @@
     sep = path.find( '?' )
     if sep != -1:
       path = path[ :sep ] + path[ sep: ].replace( '/', '%2F' )
-    if Params.FLAT:
+    if len(Params.FLATPATTERN):
+      for regexp in Params.FLATPATTERN:
+          if re.search(regexp, path):
+              path = os.path.basename( path )
+              break
+    elif Params.FLAT:
       path = os.path.basename( path )
     if Params.VERBOSE:
       print 'Cache position:', path
Index: Params.py
===================================================================
--- Params.py	(revision 49)
+++ Params.py	(working copy)
@@ -17,6 +17,7 @@
 MAXCHUNK = 1448 # maximum lan packet?
 TIMEFMT = '%a, %d %b %Y %H:%M:%S GMT'
 SUFFIX = '.incomplete'
+FLATPATTERN = []
 USAGE = '''usage: %(PROG)s [options]
 
 options:
@@ -26,7 +27,10 @@
   -v --verbose       show http headers and other info
   -t --timeout SEC   break connection after so many seconds of inactivity, default %(TIMEOUT)i
   -6 --ipv6          try ipv6 addresses if available
-     --flat          flat mode; cache all files in root directory (dangerous!)
+     --flat          flat mode; cache all files on the basis of the name only (dangerous!)
+     --flat-pattern PATTERN
+                     cache the file in 'flat mode' only if the name matches PATTERN.
+                     This option can be repeated.
      --static        static mode; assume files never change
      --offline       offline mode; never connect to server
      --limit RATE    limit download rate at a fixed K/s
@@ -68,6 +72,11 @@
   elif _arg == '--offline':
     ONLINE = False
     STATIC = True
+  elif _arg == '--flat-pattern':
+    try:
+      FLATPATTERN.append(_args.next())
+    except:
+      sys.exit( 'Error: %s requires an argument' % _arg )
   elif _arg == '--limit':
     try:
       LIMIT = float( _args.next() ) * 1024
Index: README.user
===================================================================
--- README.user	(revision 49)
+++ README.user	(working copy)
@@ -52,6 +52,13 @@
  --flat
   Flat mode; cache all files in root directory (dangerous!)
 
+ --flat
+  Flat mode; cache all files on the basis of the name only (dangerous!)
+
+ --flat-pattern PATTERN
+  Cache the file in 'flat mode' only if the name matches PATTERN.
+  This option can be repeated.
+
  --static
   Static mode; assume files never change
 
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux