Remove a no longer needed workaround for RPM <= 4.16 warning

This removes an ugly hack that was used to get rid of:

    warning: Macro %1 defined but not used within scope

I've noticed the %_pythonname_obsoletes generator does not expand %1
on non-RHELs and yet the warning is not shown.
When debugging the missing warning,
I've noticed it is never shown at all.

According to RPM upstream, the warning was an undesired artifact:
https://github.com/rpm-software-management/rpm/discussions/2501

It was purposefully removed starting with RPM 4.17.
This commit is contained in:
Miro Hrončok 2023-10-06 11:59:15 +02:00
parent 52372a464c
commit 592400f58b

View File

@ -1,9 +1,6 @@
%__pythonname_provides() %{lua: %__pythonname_provides() %{lua:
local python = require 'fedora.srpm.python' local python = require 'fedora.srpm.python'
-- this macro is called for each file in a package, the path being in %1 local name = rpm.expand('%{name}')
-- but we don't need to know the path, so we would get for each file: Macro %1 defined but not used within scope
-- in here, we expand %name conditionally on %1 to suppress the warning
local name = rpm.expand('%{?1:%{name}}')
local evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}') local evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}')
local provides = python.python_altprovides_once(name, evr) local provides = python.python_altprovides_once(name, evr)
-- provides is either an array/table or nil -- provides is either an array/table or nil
@ -23,10 +20,7 @@
-- In Fedora this is not needed as we don't ship ecosystem packages -- In Fedora this is not needed as we don't ship ecosystem packages
-- for alternative Python interpreters. -- for alternative Python interpreters.
local python = require 'fedora.srpm.python' local python = require 'fedora.srpm.python'
-- this macro is called for each file in a package, the path being in %1 local name = rpm.expand('%{name}')
-- but we don't need to know the path, so we would get for each file: Macro %1 defined but not used within scope
-- in here, we expand %name conditionally on %1 to suppress the warning
local name = rpm.expand('%{?1:%{name}}')
local evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}') local evr = rpm.expand('%{?epoch:%{epoch}:}%{version}-%{release}')
local obsoletes = python.python_altobsoletes_once(name, evr) local obsoletes = python.python_altobsoletes_once(name, evr)
-- obsoletes is either an array/table or nil -- obsoletes is either an array/table or nil