tools: Add support for local go package replacement
Local packages do not have a version number. Fake it with 'HEAD' to indicate it's using whatever the working directory is pointing at. The Provides line will then look like: Provides: bundled(golang(../osbuild-images)) = HEAD which rpmbuild is happy to process into an rpm. This is ONLY for test builds on local systems and should never be seen in the wild.
This commit is contained in:
parent
f7dcc79bd8
commit
08e5c53d31
1 changed files with 8 additions and 1 deletions
|
|
@ -30,7 +30,14 @@ def process(path: str):
|
|||
# Handle => style replace directives
|
||||
replace_regex = re.compile("^.+( v[0-9-\.]+)? => ")
|
||||
for dep in dependencies:
|
||||
ipath, version = replace_regex.sub("", dep[2:]).split(" ")[:2]
|
||||
fields = replace_regex.sub("", dep[2:]).split(" ")
|
||||
if len(fields) == 2:
|
||||
ipath, version = fields
|
||||
elif len(fields) == 1:
|
||||
ipath = fields[0]
|
||||
version = "HEAD"
|
||||
else:
|
||||
raise RuntimeError(f"Failed to parse dependency: {dep}")
|
||||
|
||||
# check for git snapshots
|
||||
if len(version) > 27:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue