public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: Fix questionable uses of %{name} and %{version} in the spec
@ 2026-11-23  9:33 Panu Matilainen
  0 siblings, 0 replies; only message in thread
From: Panu Matilainen @ 2026-11-23  9:33 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/rpm
            Branch : pmatilai-v6
            Commit : 1b2c14f39a1c342d3e3ebde5f783bc974737e76a
            Author : Panu Matilainen <pmatilai@redhat.com>
            Date   : 2020-04-23T11:00:47+03:00
            Stats  : +14/-11 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/rpm/c/1b2c14f39a1c342d3e3ebde5f783bc974737e76a?branch=pmatilai-v6

            Log:
            Fix questionable uses of %{name} and %{version} in the spec

%{name} and %{version} refer to the name and version strings of the
package that will be built and shouldn't be used for things that
do not honor those macros. Such as pre-existing or predetermined
filenames.

De-facto packaging practises over multiple decade liberally (ab)use
these and various other macros in places they don't belong - if rpm itself
doesn't follow its own rules then how can we expect anybody else to do so...

This doesn't change anything as is, but enables both Name: and Version:
to be changed arbitrarily without breaking the package build, which is
how it should optimally be. If this was strictly followed then scl-utils
would've been a walk in the park. Relatively speaking.

---
diff --git a/rpm.spec b/rpm.spec
index 1a20816..079ee54 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -25,10 +25,10 @@
 
 %global rpmver 4.15.90
 %global snapver git14971
-%global rel 8
+%global rel 9
 
-%global srcver %{version}%{?snapver:-%{snapver}}
-%global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}
+%global srcver %{rpmver}%{?snapver:-%{snapver}}
+%global srcdir %{?snapver:testing}%{!?snapver:rpm-%(echo %{rpmver} | cut -d'.' -f1-2).x}
 
 %if %{with bdb}
 %define bdbver 5.3.15
@@ -42,7 +42,7 @@ Name: rpm
 Version: %{rpmver}
 Release: %{?snapver:0.%{snapver}.}%{rel}%{?dist}
 Url: http://www.rpm.org/
-Source0: http://ftp.rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2
+Source0: http://ftp.rpm.org/releases/%{srcdir}/rpm-%{srcver}.tar.bz2
 %if %{with bdb} && %{with int_bdb}
 Source1: db-%{bdbver}.tar.gz
 %endif
@@ -301,7 +301,7 @@ Requires: rpm-libs%{_isa} = %{version}-%{release}
 %endif
 
 %prep
-%autosetup -n %{name}-%{srcver} %{?with_int_bdb:-a 1} -p1
+%autosetup -n rpm-%{srcver} %{?with_int_bdb:-a 1} -p1
 
 %if %{with bdb} && %{with int_bdb}
 ln -s db-%{bdbver} db
@@ -383,7 +383,7 @@ for be in %{?with_ndb:ndb} %{?with_sqlite:sqlite} %{?with_bdb:bdb}; do
     cp -va ${be}/. $RPM_BUILD_ROOT/var/lib/rpm/
 done
 
-%find_lang %{name}
+%find_lang rpm
 
 find $RPM_BUILD_ROOT -name "*.la"|xargs rm -f
 
@@ -396,7 +396,7 @@ rm -f $RPM_BUILD_ROOT/%{_fileattrsdir}/{perl*,python*}
 make check || (cat tests/rpmtests.log; exit 1)
 %endif
 
-%files -f %{name}.lang
+%files -f rpm.lang
 %license COPYING
 %doc CREDITS doc/manual/[a-z]*
 
@@ -515,15 +515,15 @@ make check || (cat tests/rpmtests.log; exit 1)
 %{_mandir}/man8/rpmsign.8*
 
 %files -n python3-%{name}
-%{python3_sitearch}/%{name}/
-%{python3_sitearch}/%{name}-%{version}*.egg-info
+%{python3_sitearch}/rpm/
+%{python3_sitearch}/rpm-%{rpmver}*.egg-info
 
 %files devel
 %{_mandir}/man8/rpmgraph.8*
 %{_bindir}/rpmgraph
 %{_libdir}/librp*[a-z].so
-%{_libdir}/pkgconfig/%{name}.pc
-%{_includedir}/%{name}/
+%{_libdir}/pkgconfig/rpm.pc
+%{_includedir}/rpm/
 
 %files cron
 %{_sysconfdir}/cron.daily/rpm
@@ -534,6 +534,9 @@ make check || (cat tests/rpmtests.log; exit 1)
 %doc doc/librpm/html/*
 
 %changelog
+* Thu Apr 23 2020 Panu Matilainen <pmatilai@redhat.com> - 4.15.90-0.git14971.9
+- Fix questionable uses of %%{name} and %%{version} in the spec
+
 * Wed Apr 22 2020 Panu Matilainen <pmatilai@redhat.com> - 4.15.90-0.git14971.8
 - Fix regression(s) on build dependency resolution
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23  9:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23  9:33 [rpms/rpm] pmatilai-v6: Fix questionable uses of %{name} and %{version} in the spec Panu Matilainen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox