Re: [PATCH 2 of 4] explicit metadata cache dirs

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

 



This patch adds a new --cachedir command line argument allowing the user
to specify an explicit directory where metadata will be cached. The current
code forces unprivileged users to use a cache in /var/tmp/yum-XXXXX which
is preserved across runs. Unfortunately this fails if running reposync
with many different yum configs with same repository names, but different
architectures. eg, if syncing Fedora 'development' repo on i386, and then
rerun with --arch x86_64 to sync the x86_64 'development' repo it will
mistakenly use the cache of the i386 metadata. Defining an explicit
cache directory with --cachedir avoids this problem

Regards,
Dan.
-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
diff -r 37a7c0075328 reposync.py
--- a/reposync.py	Wed May 30 12:10:45 2007 -0400
+++ b/reposync.py	Wed May 30 13:34:54 2007 -0400
@@ -79,6 +79,8 @@ def parseArgs():
         help='act as if running the specified arch (default: current arch, note: does not override $releasever)')
     parser.add_option("-r", "--repoid", default=[], action='append',
         help="specify repo ids to query, can be specified multiple times (default is all enabled)")
+    parser.add_option("-e", "--cachedir",
+        help="directory in which to store metadata")
     parser.add_option("-t", "--tempcache", default=False, action="store_true", 
         help="Use a temp dir for storing/accessing yum-cache")
     parser.add_option("-p", "--download_path", dest='destdir', 
@@ -112,15 +114,21 @@ def main():
         
     my = RepoSync(opts=opts)
     my.doConfigSetup(fn=opts.config, init_plugins=False)
-    
-    # do the happy tmpdir thing if we're not root
-    if os.geteuid() != 0 or opts.tempcache:
+
+    # Force unprivileged users to have a private temporary cachedir
+    # if they've not given an explicit cachedir
+    if os.getuid() != 0 and not opts.cachedir:
+        opts.tempcache = True
+
+    if opts.tempcache:
         cachedir = getCacheDir()
         if cachedir is None:
             print >> sys.stderr, "Error: Could not make cachedir, exiting"
             sys.exit(50)
             
         my.repos.setCacheDir(cachedir)
+    elif opts.cachedir:
+        my.repos.setCacheDir(opts.cachedir)
 
     if len(opts.repoid) > 0:
         myrepos = []
_______________________________________________
Yum mailing list
Yum@xxxxxxxxxxxxxxxxxxxx
https://lists.dulug.duke.edu/mailman/listinfo/yum

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux