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

New config option buildconfig.test_version_suffix #502

Merged
Merged
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
4 changes: 4 additions & 0 deletions src/tito/builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ def __init__(self, name=None, build_dir=None,
config_fetch_default = self.config.get(BUILDCONFIG_SECTION, "fetch_sources")
self.fetch_sources = self._get_optional_arg(kwargs, 'fetch_sources', config_fetch_default)

self.test_version_suffix = self.config.get(
BUILDCONFIG_SECTION, "test_version_suffix", fallback="")

rpmbuildopts = self._get_optional_arg(args, 'rpmbuild_options', None)
if rpmbuildopts:
self.rpmbuild_options = ' '.join(rpmbuildopts)
Expand Down Expand Up @@ -642,6 +645,7 @@ def _setup_test_specfile(self):
self.commit_count,
fullname,
self.tgz_filename,
self.test_version_suffix,
)

self.build_version += ".git." + str(self.commit_count) + "." + str(sha)
Expand Down
9 changes: 8 additions & 1 deletion src/tito/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,8 @@ def replace_spec_release(file_name, release):
print(line.rstrip('\n'))


def munge_specfile(spec_file, commit_id, commit_count, fullname=None, tgz_filename=None):
def munge_specfile(spec_file, commit_id, commit_count, fullname=None,
tgz_filename=None, version_suffix=None):
# If making a test rpm we need to get a little crazy with the spec
# file we're building off. (Note we are modifying a temp copy of the
# spec) Swap out the actual release for one that includes the git
Expand All @@ -604,6 +605,12 @@ def munge_specfile(spec_file, commit_id, commit_count, fullname=None, tgz_filena
))
continue

if version_suffix:
m = re.match(r'^(\s*Version:\s*)(.+?)\s*$', line)
if m:
print(m.group(1) + m.group(2) + version_suffix)
continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, do we still care about EPEL7? Anyway, it's easy not to break the backward compatibility here.

Compiling /builddir/build/BUILDROOT/tito-0.6.26-1.20240927180525922719.pr502.2.g9069fc1.el7_9.x86_64/usr/lib/python2.7/site-packages/tito/common.py ...
  File "/usr/lib/python2.7/site-packages/tito/common.py", line 611
    print(f"{m.group(1)}{m.group(2)}{version_suffix}")
                                                    ^
SyntaxError: invalid syntax

Can you please use the .format syntax?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, do we still care about EPEL7?

EPEL 7 is EOL, so we can't update in Koji -> only chance is to ship in Copr now. IMVHO good time to forget about Python 2 support...

Can you please use the .format syntax?

Can do, if you prefer it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't even need .format() in this case, used plain +.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMVHO good time to forget about Python 2 support...

I have no problem if we make that decision, drop EPEL7 from tests and so on. I just didn't want to break it by adding one unnecessary f-string :-)


m = re.match(r'^(\s*Source0?):\s*(.+?)$', line)
if tgz_filename and m:
print('%s: %s' % (m.group(1), tgz_filename))
Expand Down
7 changes: 7 additions & 0 deletions tito.props.5.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ fetch_sources::
If true, download sources from predefined Source<N> addresses to the
SOURCE folder.

test_version_suffix::
Append a given suffix (string, e.g., `.post`) to the `Version:` tag in the
generated spec file when building with `--test`. This ensures that any `--test`
NEVRA is higher than the NEVRA of the previous release. Simply modifying the
`Release:` tag doesn't guarantee this, as downstream `Release:` numbers are
often incremented, which would take precedence (e.g., `foo-1.0-1.git.3.60fe05a`
< `foo-1.0-2`).

KOJI and COPR
-------------
Expand Down
Loading