I’d like to build a pre-release version of a package I maintain but it has hyphen, e.g. 19.2-rc3. How can I tweak the spec file to be able to build this hyphened version?
As a pre-release, the version should be 19.2~rc3
.
So, seems to work half way, because the extracted source directory is not found – because it still has hyphen instead of tilde.
This spec I pushed to koji and this is the result:
+ /usr/lib/rpm/rpmuncompress -x /builddir/build/SOURCES/ddnet-19.2~rc3.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd ddnet-19.2~rc3
/var/tmp/rpm-tmp.L7TdGQ: line 42: cd: ddnet-19.2~rc3: No such file or directory
You need to change the name of the directory in %prep
so that it doesn’t use the tilde:
%prep
%autosetup -p1 -n %{name}-%{version}
which is re-using %{version}
which has a tilde, but should be the version with the dash.
Thanks. So about that, I know there is %global
, but I don’t know how to set a alternative %{version}
replacing ~ from version with -. Any hint?
Here’s a way that better works with forges:
--- a/ddnet.spec
+++ b/ddnet.spec
@@ -0,0 +1,5 @@
+%global forgeurl https://github.com/ddnet/ddnet
+%global tag 19.2-rc3
+%global version %(tag=%{tag}; echo ${tag//-/.})
+%forgemeta
+
@@ -5,2 +10,2 @@ Name: ddnet
-Version: 19.1
-Release: 2%{?dist}
+Version: %{forgeversion}
+Release: %{autorelease}
@@ -34 +39 @@ URL: https://ddnet.org/
-Source0: https://github.com/ddnet/ddnet/archive/%{version}/%{name}-%{version}.tar.gz
+Source0: %{forgesource}
@@ -120 +125,2 @@ Standalone server for %{name}.
-%autosetup -p1 -n %{name}-%{version}
+%forgesetup
+%autopatch -p 1
See also: Referencing Source :: Fedora Docs
1 Like
Thanks everyone for the help!
1 Like