| |
@@ -228,12 +228,15 @@
|
| |
self.log.debug('ERROR: %s', err)
|
| |
raise R2specError('Cannot read the file %s' % (err, ))
|
| |
|
| |
- def get_specfile(self):
|
| |
+ def get_specfile(self, destdir=None):
|
| |
""" Return the path to the spec file.
|
| |
"""
|
| |
- specdir = get_rpm_tag('_specdir')
|
| |
- specname = 'R-%s.spec' % self.package.name
|
| |
- return '%s/%s' % (specdir, specname)
|
| |
+ if destdir:
|
| |
+ return os.path.join(destdir, f'R-{self.package.name}.spec')
|
| |
+ else:
|
| |
+ specdir = get_rpm_tag('_specdir')
|
| |
+ specname = 'R-%s.spec' % self.package.name
|
| |
+ return '%s/%s' % (specdir, specname)
|
| |
|
| |
def read_specfile(self):
|
| |
""" Read the specfile present in the spec directory.
|
| |
@@ -249,10 +252,10 @@
|
| |
self.log.info('Cannot read the file %s', specfile)
|
| |
self.log.debug('ERROR: %s', err)
|
| |
|
| |
- def write_spec(self, verbose=False):
|
| |
+ def write_spec(self, verbose=False, destdir=None):
|
| |
""" Write down the spec to the spec directory as returned by rpm.
|
| |
"""
|
| |
- specfile = self.get_specfile()
|
| |
+ specfile = self.get_specfile(destdir)
|
| |
self.log.info('Writing file %s', specfile)
|
| |
try:
|
| |
stream = open(specfile, 'w')
|
| |
add argument destdir to R2spec to specify the generated path of the spec file