blob: 72755981a91e0e032e6b9ce8e7e989d1b6c9d8c2 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001createrepo: Implement --dbpath command line option
2
3--dbpath option allows to specify path to the directory
4with rpm database. By default createrepo uses or creates
5rpm database in /var/lib/rpm/
6
7Upstream-Status: Pending
8
9Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
10
11--- createrepo-0.4.11.orig/genpkgmetadata.py 2015-03-30 22:18:19.904000000 +0300
12+++ createrepo-0.4.11/genpkgmetadata.py 2015-03-30 22:28:49.208000000 +0300
13@@ -65,6 +65,7 @@
14 -p, --pretty = output xml files in pretty format.
15 --update = update existing metadata (if present)
16 -d, --database = generate the sqlite databases.
17+ --dbpath <dir> = specify path to rpm db directory.
18 """)
19
20 sys.exit(retval)
21@@ -72,10 +73,13 @@
22 class MetaDataGenerator:
23 def __init__(self, cmds):
24 self.cmds = cmds
25- self.ts = rpm.TransactionSet()
26 self.pkgcount = 0
27 self.files = []
28
29+ if self.cmds['dbpath']:
30+ rpm.addMacro("_dbpath", self.cmds['dbpath'])
31+ self.ts = rpm.TransactionSet()
32+
33 def _os_path_walk(self, top, func, arg):
34 """Directory tree walk with callback function.
35 copy of os.path.walk, fixes the link/stating problem
36@@ -435,6 +439,7 @@
37 cmds['dir-pattern-match'] = ['.*bin\/.*', '^\/etc\/.*']
38 cmds['skip-symlinks'] = False
39 cmds['pkglist'] = []
40+ cmds['dbpath'] = None
41
42 try:
43 gopts, argsleft = getopt.getopt(args, 'phqVvndg:s:x:u:c:o:CSi:', ['help', 'exclude=',
44@@ -442,7 +447,7 @@
45 'baseurl=', 'groupfile=', 'checksum=',
46 'version', 'pretty', 'split', 'outputdir=',
47 'noepoch', 'checkts', 'database', 'update',
48- 'skip-symlinks', 'pkglist='])
49+ 'skip-symlinks', 'pkglist=', 'dbpath='])
50 except getopt.error, e:
51 errorprint(_('Options Error: %s.') % e)
52 usage()
53@@ -516,6 +521,8 @@
54 cmds['skip-symlinks'] = True
55 elif arg in ['-i', '--pkglist']:
56 cmds['pkglist'] = a
57+ elif arg == '--dbpath':
58+ cmds['dbpath'] = os.path.realpath(a)
59
60 except ValueError, e:
61 errorprint(_('Options Error: %s') % e)