|
|
085af2 |
commit c01c1bab3b3530e04d9cb13bcf03d6f1a95a7f33
|
|
|
085af2 |
Author: Michal Domonkos <mdomonko@redhat.com>
|
|
|
085af2 |
Date: Fri Jun 22 22:39:30 2018 +0200
|
|
|
085af2 |
|
|
|
085af2 |
repotrack: add --repofrompath option. BZ 1506205
|
|
|
085af2 |
|
|
|
085af2 |
Code taken from repoquery.
|
|
|
085af2 |
|
|
|
085af2 |
diff --git a/docs/repotrack.1 b/docs/repotrack.1
|
|
|
085af2 |
index 6b46ed0..597b7a5 100644
|
|
|
085af2 |
--- a/docs/repotrack.1
|
|
|
085af2 |
+++ b/docs/repotrack.1
|
|
|
085af2 |
@@ -19,6 +19,10 @@ Act as if running the specified arch (default: current arch).
|
|
|
085af2 |
.IP "\fB\-r REPOID, \-\-repoid=REPOID\fP"
|
|
|
085af2 |
Specify repo ids to query, can be specified multiple times (default is
|
|
|
085af2 |
all enabled).
|
|
|
085af2 |
+.IP "\fB\-\-repofrompath=<repoid>,<path/url>\fP"
|
|
|
085af2 |
+Specify repoid & paths of additional repositories - unique repoid and complete
|
|
|
085af2 |
+path required, can be specified multiple times.
|
|
|
085af2 |
+Example: --repofrompath=myrepo,/path/to/repo
|
|
|
085af2 |
.IP "\fB\-t, \-\-tempcache\fP"
|
|
|
085af2 |
Use a temp dir for storing/accessing yum-cache.
|
|
|
085af2 |
.IP "\fB\-p DESTDIR, \-\-download_path=DESTDIR\fP"
|
|
|
085af2 |
diff --git a/repotrack.py b/repotrack.py
|
|
|
085af2 |
index 8dd8b9c..79b761f 100755
|
|
|
085af2 |
--- a/repotrack.py
|
|
|
085af2 |
+++ b/repotrack.py
|
|
|
085af2 |
@@ -87,6 +87,10 @@ def parseArgs():
|
|
|
085af2 |
help='check as if running the specified arch (default: current arch)')
|
|
|
085af2 |
parser.add_option("-r", "--repoid", default=[], action='append',
|
|
|
085af2 |
help="specify repo ids to query, can be specified multiple times (default is all enabled)")
|
|
|
085af2 |
+ parser.add_option("--repofrompath", action="append",
|
|
|
085af2 |
+ help="specify repoid & paths of additional repositories - unique repoid "
|
|
|
085af2 |
+ "and complete path required, can be specified multiple times. "
|
|
|
085af2 |
+ "Example: --repofrompath=myrepo,/path/to/repo")
|
|
|
085af2 |
parser.add_option("-t", "--tempcache", default=False, action="store_true",
|
|
|
085af2 |
help="Use a temp dir for storing/accessing yum-cache")
|
|
|
085af2 |
parser.add_option("-p", "--download_path", dest='destdir',
|
|
|
085af2 |
@@ -157,8 +161,33 @@ def main():
|
|
|
085af2 |
repo.enable()
|
|
|
085af2 |
my._getSacks(archlist=archlist, thisrepo=repo.id)
|
|
|
085af2 |
|
|
|
085af2 |
- my.doRepoSetup()
|
|
|
085af2 |
- my._getSacks(archlist=archlist)
|
|
|
085af2 |
+ if opts.repofrompath:
|
|
|
085af2 |
+ for repo in opts.repofrompath:
|
|
|
085af2 |
+ tmp = tuple(repo.split(','))
|
|
|
085af2 |
+ if len(tmp) != 2:
|
|
|
085af2 |
+ my.logger.error("Error: Bad repofrompath argument: %s" %repo)
|
|
|
085af2 |
+ continue
|
|
|
085af2 |
+ repoid, repopath = tmp
|
|
|
085af2 |
+ if repopath and repopath[0] == '/':
|
|
|
085af2 |
+ baseurl = 'file://' + repopath
|
|
|
085af2 |
+ else:
|
|
|
085af2 |
+ baseurl = repopath
|
|
|
085af2 |
+ try:
|
|
|
085af2 |
+ my.add_enable_repo(repoid, baseurls=[baseurl],
|
|
|
085af2 |
+ basecachedir=my.conf.cachedir,
|
|
|
085af2 |
+ timestamp_check=False)
|
|
|
085af2 |
+ except yum.Errors.DuplicateRepoError, e:
|
|
|
085af2 |
+ my.logger.error(e)
|
|
|
085af2 |
+ sys.exit(1)
|
|
|
085af2 |
+ if not opts.quiet:
|
|
|
085af2 |
+ my.logger.info("Added %s repo from %s" % (repoid, repopath))
|
|
|
085af2 |
+
|
|
|
085af2 |
+ try:
|
|
|
085af2 |
+ my.doRepoSetup()
|
|
|
085af2 |
+ my._getSacks(archlist=archlist)
|
|
|
085af2 |
+ except yum.Errors.RepoError, e:
|
|
|
085af2 |
+ my.logger.error(e)
|
|
|
085af2 |
+ sys.exit(1)
|
|
|
085af2 |
|
|
|
085af2 |
unprocessed_pkgs = {}
|
|
|
085af2 |
final_pkgs = {}
|