Re: reposync always creating repo specific directories
Danny Smith <[email protected]>
| Newsgroups | gmane.linux.rpm.yum |
|---|---|
| Message-ID | <[email protected]> |
Seth Vidal wrote: > > > On Fri, 27 Mar 2009, Danny Smith wrote: > >> 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). > > Doesn't that option need to conflict if there is more than one > repository available/being synced? > > If you could modify it to that end I think I'd accept it. > > -sv Good point. I've added a check for this, patch attached. Danny _______________________________________________ Yum mailing list [email protected] http://lists.baseurl.org/mailman/listinfo/yum
reposync.norepopath.patch
(text/x-patch, 2.1 KB)
--- /usr/bin/reposync 2008-09-18 08:35:52.000000000 +0100
+++ /usr/bin/reposync.modified 2009-03-30 12:23:02.000000000 +0100
@@ -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. Can only be used when syncing a single repository (default is to add 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",
@@ -168,6 +174,11 @@
# enable the ones we like
for repo in myrepos:
repo.enable()
+
+ # --norepopath can only be sensibly used with a single repository:
+ if len(my.repos.listEnabled()) > 1 and opts.norepopath == True:
+ print >> sys.stderr, "Error: Can't use --norepopath with multiple repositories"
+ sys.exit(1);
# Use progress bar display when downloading repo metadata
# and package files
@@ -185,8 +196,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)