Compare commits

...

7 Commits

Author SHA1 Message Date
Louis Abel 38405b883b
importer: cleanup should be happening if there's no meta 2024-03-10 21:45:08 -07:00
Louis Abel e8b72866ae
pv2: make python 3.9 the minimum 2024-03-10 21:39:31 -07:00
Louis Abel d9e2f2b370
importer: make lack of meta message more informative 2024-03-10 21:38:37 -07:00
Louis Abel 32642b1efd
importer: fix metafile not found issue 2024-03-10 21:11:25 -07:00
Louis Abel ff35a29d08
importer: Address upstream hash ref list issue
There are cases where upstream (stream 10 for example) have repos for
packages that they plan or will ship, but there are no references
associated. Meaning, there's no branches, there's no data, nothing to
work off of.
2024-03-10 20:54:43 -07:00
Louis Abel 7f2004719a
importer: Resolve invalid escape sequence on newer python
Signed-off-by: Louis Abel <label@rockylinux.org>
2024-03-08 19:12:50 -07:00
Louis Abel c2297d6189
rpmautospec: lack of changelog file shouldn't matter
Signed-off-by: Louis Abel <label@rockylinux.org>
2024-03-08 19:10:05 -07:00
3 changed files with 20 additions and 8 deletions

View File

@ -765,6 +765,7 @@ class GitImport(Import):
# Within the confines of the source git repo, we need to find a
# "sources" file or a metadata file. One of these will determine which
# route we take.
metafile_to_use = None
if os.path.exists(metadata_file):
no_metadata_list = ['stream', 'fedora']
if any(ignore in self.upstream_lookaside for ignore in no_metadata_list):
@ -779,10 +780,16 @@ class GitImport(Import):
metafile_to_use = sources_file
else:
#raise err.GenericError('sources or metadata file NOT found')
print('WARNING: There was no sources or metadata found. Making blank file.')
# There isn't a reason to make a blank file right now.
print('WARNING: There was no sources or metadata found.')
with open(metadata_file, 'w+') as metadata_handle:
pass
if not metafile_to_use:
print('Source: There was no metadata file found. Skipping import attempt.')
self.perform_cleanup([source_git_repo_path, dest_git_repo_path])
return False
sources_dict = self.parse_metadata_file(metafile_to_use)
# We need to check if there is a SPECS directory and make a SOURCES
@ -811,7 +818,8 @@ class GitImport(Import):
source_git_repo_spec = self.find_spec_file(source_git_repo_path)
# do rpm autochangelog logic here
if HAS_RPMAUTOSPEC and os.path.exists(source_git_repo_changelog):
#if HAS_RPMAUTOSPEC and os.path.exists(source_git_repo_changelog):
if HAS_RPMAUTOSPEC:
# Check that the spec file really has %autochangelog
AUTOCHANGELOG = False
with open(source_git_repo_spec, 'r') as spec_file:
@ -1142,7 +1150,7 @@ class ModuleImport(Import):
with open(modulemd_file, 'r') as module_yaml:
content = module_yaml.read()
content_new = re.sub('ref:\s+(.*)', f'ref: {dest_branch}', content)
content_new = re.sub(r'ref:\s+(.*)', f'ref: {dest_branch}', content)
module_yaml.close()
# Write to the root

View File

@ -139,8 +139,11 @@ def tag(repo, tag_name:str, message: str):
def lsremote(url):
"""
Helps check if a repo exists, and if it does, return references. If not,
return None and assume it doesn't exist.
Helps check if a repo exists.
If repo exists: return references
If repo exists and is completely empty: return empty dict
If repo does not exist: return None
"""
remote_refs = {}
git_cmd = rawgit.cmd.Git()
@ -153,5 +156,6 @@ def lsremote(url):
for ref in git_cmd.ls_remote(url).split('\n'):
hash_ref_list = ref.split('\t')
remote_refs[hash_ref_list[1]] = hash_ref_list[0]
if len(hash_ref_list) > 1:
remote_refs[hash_ref_list[1]] = hash_ref_list[0]
return remote_refs

View File

@ -1,6 +1,6 @@
[project]
name = "pv2"
version = "0.11.0"
version = "0.12.0"
description = "PV2 backend framework module"
readme = "README.md"
authors = [
@ -11,7 +11,7 @@ maintainers = [
{ name = "Louis Abel", email = "label@rockylinux.org" }
]
requires-python = ">=3.6"
requires-python = ">=3.9"
dependencies = [
"GitPython >= 3.1.30",