| |
@@ -49,6 +49,7 @@
|
| |
from pyrpkg.utils import (cached_property, extract_srpm, find_me,
|
| |
is_file_tracked, is_lookaside_eligible_file,
|
| |
log_result)
|
| |
+ from pyrpkg import layout
|
| |
|
| |
from .gitignore import GitIgnore
|
| |
|
| |
@@ -212,6 +213,8 @@
|
| |
self.block_retire_ns = ['rpms']
|
| |
# Git excludes patterns
|
| |
self.git_excludes = git_excludes or []
|
| |
+ # Layout setup
|
| |
+ self.layout = layout.build(self.path)
|
| |
|
| |
# Define properties here
|
| |
# Properties allow us to "lazy load" various attributes, which also means
|
| |
@@ -759,14 +762,16 @@
|
| |
raise rpkgError('Could not find the base OS ver from branch name'
|
| |
' %s. Consider using --release option' %
|
| |
self.branch_merge)
|
| |
+ if self.layout is None:
|
| |
+ raise rpkgError('Unexpected error while loading the package.')
|
| |
self._distvar, self._distval = osver.split('-')
|
| |
self._distval = self._distval.replace('.', '_')
|
| |
self._disttag = 'el%s' % self._distval
|
| |
- self._rpmdefines = ["--define '_sourcedir %s'" % self.path,
|
| |
- "--define '_specdir %s'" % self.path,
|
| |
- "--define '_builddir %s'" % self.path,
|
| |
- "--define '_srcrpmdir %s'" % self.path,
|
| |
- "--define '_rpmdir %s'" % self.path,
|
| |
+ self._rpmdefines = ["--define '_sourcedir %s'" % self.layout.sourcedir,
|
| |
+ "--define '_specdir %s'" % self.layout.specdir,
|
| |
+ "--define '_builddir %s'" % self.layout.builddir,
|
| |
+ "--define '_srcrpmdir %s'" % self.layout.srcrpmdir,
|
| |
+ "--define '_rpmdir %s'" % self.layout.rpmdir,
|
| |
"--define 'dist .%s'" % self._disttag,
|
| |
"--define '%s %s'" % (self._distvar,
|
| |
self._distval.split('_')[0]),
|
| |
@@ -784,11 +789,14 @@
|
| |
def load_spec(self):
|
| |
"""This sets the spec attribute"""
|
| |
|
| |
+ if self.layout is None:
|
| |
+ raise rpkgError('Spec file is not available')
|
| |
+
|
| |
if self.is_retired():
|
| |
raise rpkgError('This package or module is retired. The action has stopped.')
|
| |
|
| |
# Get a list of files in the path we're looking at
|
| |
- files = os.listdir(self.path)
|
| |
+ files = os.listdir(self.layout.specdir)
|
| |
# Search the files for the first one that ends with ".spec"
|
| |
for f in files:
|
| |
if f.endswith('.spec') and not f.startswith('.'):
|
| |
@@ -1015,7 +1023,9 @@
|
| |
|
| |
@property
|
| |
def sources_filename(self):
|
| |
- return os.path.join(self.path, 'sources')
|
| |
+ if self.layout is None:
|
| |
+ return os.path.join(self.path, 'sources')
|
| |
+ return os.path.join(self.path, self.layout.sources_file_template)
|
| |
|
| |
@property
|
| |
def osbs_config_filename(self):
|
| |
@@ -3188,12 +3198,7 @@
|
| |
The state is indicated by present of files 'dead.package'
|
| |
or 'dead.module'.
|
| |
"""
|
| |
- marker = 'dead.package'
|
| |
- if os.path.isfile(os.path.join(self.path, marker)):
|
| |
- return marker
|
| |
- marker = 'dead.module'
|
| |
- if os.path.isfile(os.path.join(self.path, marker)):
|
| |
- return marker
|
| |
+ return self.layout.is_retired()
|
| |
|
| |
def retire(self, message):
|
| |
"""Delete all tracked files and commit a new dead.package file for rpms
|
| |
super method raises its exception (from "abstract" method) earlier than comparation in a specific method is reached. In the current situation, input of the test can not be not existing dir.