From 58580a79b186c7d8eedcb061fc904c0d54d45f0a Mon Sep 17 00:00:00 2001 From: Robert-André Mauchin Date: Apr 11 2019 11:54:04 +0000 Subject: Include possible distprefix in --define dist for Forge-based packages 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 --- diff --git a/fedpkg/__init__.py b/fedpkg/__init__.py index 8308279..270cae0 100644 --- a/fedpkg/__init__.py +++ b/fedpkg/__init__.py @@ -160,7 +160,7 @@ class Commands(pyrpkg.Commands): "--define '_builddir %s'" % self.path, "--define '_srcrpmdir %s'" % self.path, "--define '_rpmdir %s'" % self.path, - "--define 'dist .%s'" % self._disttag, + "--define 'dist %%{?distprefix}.%s'" % self._disttag, "--define '%s %s'" % (self._distvar, self._distval), "--eval '%%undefine %s'" % self._distunset, 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,