| |
@@ -46,8 +46,8 @@
|
| |
|
| |
from pyrpkg import layout
|
| |
from pyrpkg.errors import (AlreadyUploadedError, HashtypeMixingError,
|
| |
- NoSourcesError, UnknownTargetError, rpkgAuthError,
|
| |
- rpkgError)
|
| |
+ NoSourcesError, SpecfileDoesntMatchRepoNameError,
|
| |
+ UnknownTargetError, rpkgAuthError, rpkgError)
|
| |
from pyrpkg.lookaside import CGILookasideCache
|
| |
from pyrpkg.sources import SourcesFile
|
| |
from pyrpkg.spec import SpecFile
|
| |
@@ -2001,13 +2001,15 @@
|
| |
raise rpkgError('Could not find hash of build %s' % build)
|
| |
return (hash)
|
| |
|
| |
- def import_srpm(self, srpm):
|
| |
+ def import_srpm(self, srpm, check_specfile_matches_repo_name=True):
|
| |
"""Import the contents of an srpm into a repo.
|
| |
|
| |
This function will add/remove content to match the srpm,
|
| |
upload new files to the lookaside, and stage the changes.
|
| |
|
| |
:param str srpm: file to import contents from.
|
| |
+ :param bool check_specfile_matches_repo_name: check specfile
|
| |
+ in SRPM matches the repository name
|
| |
:return: a list of files to upload.
|
| |
:rtype: list
|
| |
"""
|
| |
@@ -2059,6 +2061,18 @@
|
| |
self.repo.index.remove([file])
|
| |
os.remove(file)
|
| |
|
| |
+ specfile_matches_repo_name = False
|
| |
+ for file in files:
|
| |
+ if self.repo_name + '.spec' == file:
|
| |
+ specfile_matches_repo_name = True
|
| |
+ if check_specfile_matches_repo_name and not specfile_matches_repo_name:
|
| |
+ raise SpecfileDoesntMatchRepoNameError(
|
| |
+ "Error: Specfile '{0}' doesn't match repo name '{1}'. This check "
|
| |
+ "can be omitted by adding argument '--do-not-check-specfile-name'".format(
|
| |
+ ", ".join(file for file in files if file.endswith('.spec')),
|
| |
+ self.repo_name)
|
| |
+ )
|
| |
+
|
| |
try:
|
| |
self.log.debug("Extracting srpm '{0}'".format(srpm))
|
| |
output, err = extract_srpm(srpm)
|
| |
The check looks reasonable to me but you forgot to strip the namespace from
self.repo_name
and therefore this check fails when trying to import packages to Copr DistGit.Please see https://github.com/fedora-copr/copr/issues/3365
Temporarily I am disabling the check in our code but I think it would be nice to eventually have it.
https://github.com/fedora-copr/copr/issues/3365
Can you please add support for namespaced repositories here? :-)