#320 Include possible distprefix in --define dist for Forge-based packages
Merged by onosek. Opened by eclipseo.
Unknown source master

Download 320.patch

In forge based packages, and most notably all Golang packages, dist tag are
computed by a lua script in order to generate a snapshot date and shortcommit.
See
(https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/forge.lua#_196).
By specifying dist in rpmbuild command line, computed dist tag is overridden and
as such produce an erroneous package name. For example, instead of
golang-github-anacrolix-dms-0-0.1.20190304git8af4925.fc31 we get
golang-github-anacrolix-dms-0-0.1.fc31.

This patch proposes to pass the computed %{?distprefix} in dist to take into
account the specificity of Forge based packages.

Signed-off-by: Robert-André Mauchin zebob.m@gmail.com

This change should make the unittests work properly. Could you, please, update this PR? Thanks

diff --git a/test/test_commands.py b/test/test_commands.py
index 6d85988..7824f9f 100644
--- a/test/test_commands.py
+++ b/test/test_commands.py
@@ -186,7 +186,7 @@ class TestLoadRpmDefines(CommandTestCase):
             "--define '_builddir %s'" % self.cmd.path,
             "--define '_srcrpmdir %s'" % self.cmd.path,
             "--define '_rpmdir %s'" % self.cmd.path,
-            "--define 'dist .%s'" % self.cmd._disttag,
+            "--define 'dist %%{?distprefix}.%s'" % self.cmd._disttag,
             "--define '%s %s'" % (self.cmd._distvar, self.cmd._distval),
             "--eval '%%undefine %s'" % self.cmd._distunset,
             "--define '%s 1'" % self.cmd._disttag,

rebased onto 58580a79b186c7d8eedcb061fc904c0d54d45f0a

Added. Thanks!

Commit c58d0e2a fixes this pull-request

Pull-Request has been merged by onosek

Metadata