[Yum] reposync always creating repo specific directories

Danny Smith danny at keyop.co.uk
Fri Mar 27 15:43:44 UTC 2009


I've had to set up reposync recently here to synchronise some of the 
Fedora update repositories, using reposync from yum-utils-1.1.17-1.fc8 
(Fedora 8).
One problem I encountered was wanting the synced repository to be in 
*exactly* the directory I specified. When using the --download-path 
option, reposync unconditionally adds the repository name to the path 
I've specified. With the repository layout we're using internally this 
isn't what I want.

I've created a simple crude patch internally to change this behaviour as 
required. Am I missing something, or alternatively is this useful to 
anyone else? (I don't think the option name is optimal, but I failed to 
think of anything better).

Danny



--- /usr/bin/reposync   2008-09-18 08:35:52.000000000 +0100
+++ /usr/bin/reposync.modified  2009-03-26 16:52:32.000000000 +0000
@@ -28,6 +28,10 @@
# if a package is not the same and larger, delete it and get it again
# always replace metadata files if they're not the same.

+# Modified by Danny Smith, 24th March 2009
+# - Added option to NOT add the repository name to the download path
+#   (--norepopath, -P)
+


import os
@@ -105,6 +109,8 @@
        help="delete local packages no longer present in repository")
    parser.add_option("-p", "--download_path", dest='destdir',
        default=os.getcwd(), help="Path to download packages to: 
defaults to current dir")
+    parser.add_option("-P", "--norepopath", dest='norepopath', 
default=False, action="store_true",
+            help="Don't add the reponame to the download path: defaults 
to adding the reponame")
    parser.add_option("-g", "--gpgcheck", default=False, 
action="store_true",
        help="Remove packages that fail GPG signature checking after 
downloading")
    parser.add_option("-u", "--urls", default=False, action="store_true",
@@ -185,8 +191,12 @@
            download_list = reposack.returnNewestByNameArch()
        else:
            download_list = list(reposack)
+       +        if opts.norepopath == True:
+           local_repo_path = opts.destdir
+        else:
+           local_repo_path = opts.destdir + '/' + repo.id

-        local_repo_path = opts.destdir + '/' + repo.id
        if opts.delete and os.path.exists(local_repo_path):
            current_pkgs = localpkgs(local_repo_path)


More information about the Yum mailing list