Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spec: Update %global commit #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions rdgo/specfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ def set_tag(self, tag, value):
if n == 0:
self._txt = tag + ':' + value + '\n' + self._txt

def set_global(self, k, value):
self._txt, n = re.subn(r'^(%%global\s+%s\s*) ([a-f0-9]+)' % (k,),
r'\1 %s' % value, self.txt, flags=re.M)
print("{} -> {} subs: {}".format(k, value, n))

def get_patches_base(self, expand_macros=False):
"""Return a tuple (version, number_of_commits) that are parsed
from the patches_base in the specfile.
Expand Down
1 change: 1 addition & 0 deletions rdgo/task_resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def _generate_srcsnap_impl(self, component, upstream_tag, upstream_rev, upstream
if has_zero:
source_tag += '0'
spec.set_tag(source_tag, tarname)
spec.set_global('commit', upstream_rev)
spec.set_tag('Version', rpm_version)
spec.set_setup_dirname(tar_dirname)
spec.set_tag('Release', rpm_release + '%{?dist}')
Expand Down