| |
@@ -69,7 +69,8 @@
|
| |
# This shouldn't change... often
|
| |
UPLOADEXTS = ['tar', 'gz', 'bz2', 'lzma', 'xz', 'Z', 'zip', 'tff',
|
| |
'bin', 'tbz', 'tbz2', 'tgz', 'tlz', 'txz', 'pdf', 'rpm',
|
| |
- 'jar', 'war', 'db', 'cpio', 'jisp', 'egg', 'gem', 'spkg']
|
| |
+ 'jar', 'war', 'db', 'cpio', 'jisp', 'egg', 'gem', 'spkg',
|
| |
+ 'oxt', 'xpi']
|
| |
|
| |
def __init__(self, path, lookaside, lookasidehash, lookaside_cgi,
|
| |
gitbaseurl, anongiturl, branchre, kojiconfig,
|
| |
@@ -2194,6 +2195,40 @@
|
| |
config_dir)
|
| |
self._cleanup_tmp_dir(config_dir)
|
| |
|
| |
+ def choose_uploads(self):
|
| |
+ """
|
| |
+ Choose files from the project folder that should be uploaded
|
| |
+ to lookaside cache - parse Source fields from the spec file
|
| |
+ and choose existing binary files from that set
|
| |
+ """
|
| |
+ ts = rpm.TransactionSet()
|
| |
+ try:
|
| |
+ sources_all = ts.parseSpec(os.path.join(self.path, self.spec)).sources
|
| |
+ except:
|
| |
+ raise rpkgError("Error parsing spec file %s" % self.spec)
|
| |
+
|
| |
+ upload_files = []
|
| |
+
|
| |
+ # A flag distinguishing "Source" from "Patch"
|
| |
+ src_flag = 1
|
| |
+
|
| |
+ for src in sources_all:
|
| |
+ name = os.path.basename(src[0])
|
| |
+ # Process only source file that exist in the project folder
|
| |
+ if not os.path.isfile(os.path.join(self.path, name)):
|
| |
+ continue
|
| |
+ if not src[2] & src_flag:
|
| |
+ continue
|
| |
+ # Upload file if its extension is in UPLOADEXTS
|
| |
+ if not name.rsplit('.')[-1] in self.UPLOADEXTS:
|
| |
+ continue
|
| |
+ upload_files.append(name)
|
| |
+
|
| |
+ if not upload_files:
|
| |
+ raise rpkgError("Didn't find any files to be uploaded!")
|
| |
+
|
| |
+ return upload_files
|
| |
+
|
| |
def upload(self, files, replace=False):
|
| |
"""Upload source file(s) in the lookaside cache
|
| |
|
| |
@@ -2466,3 +2501,4 @@
|
| |
' %s file', self.osbs_config_filename)
|
| |
else:
|
| |
self.log.info('Nothing to be done')
|
| |
+
|
| |