Mailinglist Archive: opensuse-packaging (121 mails)

< Previous Next >
Re: [opensuse-packaging] spec-cleaner and defines
On Mon, Mar 18, 2019 at 06:54:24PM +0100, Marcus Hüwe wrote:
On 2019-03-18 10:23:45 +0100, Andreas Vetter wrote:
spec-cleaner wants to move defines to the beginning of the spec file. But I
need it after Name and Version like that:

Name: hmcfgusb
Version: 0.103
%define tarball %{name}-%{version}.tar.gz
...
URL: https://git.zerfleddert.de/hmcfgusb/releases/%{tarball}
Source: %{tarball}


spec-cleaner wants to turn it around, but then it does not work:

%define tarball %{name}-%{version}.tar.gz
Name: hmcfgusb
Version: 0.103
...

This will work as long as the URL tag is specified after the Name and
Version tags (if the URL tag is specified before Name or Version, some
macros cannot be expanded).

Just some more clarification: With %define, macros in the body (in this
case %{name} and %{version}) will be expanded at the time the macro is
used. So defining %tarball before the Name and Version line works.

This is different to %global, where macros in the body will be expanded
right away.

Cheers,
Michael.

--
Michael Schroeder mls@xxxxxxx
SUSE LINUX GmbH, GF Jeff Hawn, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups