[Swan-dev] comment on version.mk - make rpm

Antony Antony antony at phenome.org
Fri Dec 20 11:43:06 UTC 2019


Let me try to show the minor inconsistencies in "rpm version" and "pluto --version" with an example bellow.

It seems it was not easy to understand in previous messages and there is
some interest to make rpm version string better. A correct version number 
would help when working on several versions.
The solution appears to be simple as far as I see it, yet very hard to 
explain.

In short, I think a new version.mk should not be created when running "make 
rpm" instead use IPSECVERSION=%{IPSECVERSION} in specfile, or something A 
similar. see git show b68c5a33261ea0


On Mon, Oct 07, 2019 at 09:56:39AM -0400, Paul Wouters wrote:
> On Fri, 4 Oct 2019, Antony Antony wrote:
> 
> > a minor comment. I noticed a commit to fix version number in "make rpm"
> > 
> > https://github.com/libreswan/libreswan/commit/b68c5a33261ea07defa119edee97e4a495588d6c
> > 
> > It is good improvement to "make rpm".
> > 
> > However, there is another way to set pluto --version,
> > IPSECVERSION=%{IPSECVERSION}
> > https://github.com/libreswan/libreswan/blob/master/packaging/fedora/libreswan-testing.spec#L18
> > 
> > setting IPSECVERSION is also used in Debian and OpenWRT packaging. May be it
> > is better to use this method instead of b68c5a.
> 
> People often re-use spec files by grabbing their existing one and only
> changing the Version: and Release: fields. When you install a SRPM and the
> spec file goes into ~/rpmbuild/SPECS, you do not remember the origin of
> that spec file. So you might not be aware that you would need to change
> Version:, Release: _and_ IPSECVERSION.

There is no hardcoded IPSECVERSION in the libreswan-testing.spec !
That was fixed a while ago. Now only have to change the "Version" by
"make kvm-rpm" target.

> Having two independent version-like options in the spec file that can
> contradict each other seems dangerous, and I wanted to avoid people
> creating a "3.31" tarball that still has IPSECVERSION=3.30 hardcoded in
> the spec file, which will misidentify as 3.30 instead of 3.31. And if
> ipsec version and rpm -q libreswan contradict each other, which one do
> you believe?

The tarball has no file with hardcoded IPSECVERSION=3.30. 3.30 would be in 
the spec file as Version.

It is important that rpm version as well as version pluto report to be the 
sam.  Not something that look alike.
The solution I proposed and used in kvm-rpm has rpm-version and pluto 
version the same.

make rpm
Wrote: /home/build/rpmbuild/RPMS/x86_64/libreswan-3.28-0.rc1275_gf42dab7174_master.x86_64.rpm
Wrote: /home/build/rpmbuild/RPMS/x86_64/libreswan-debugsource-3.28-0.rc1275_gf42dab7174_master.x86_64.rpm
Wrote: 
/home/build/rpmbuild/RPMS/x86_64/libreswan-debuginfo-3.28-0.rc1275_gf42dab7174_master.x86_64.rpm

/usr/libexec/ipsec/pluto --versionLibreswan v3.28-1275-gf42dab7174-master

3.28-0.rc1275_gf42dab7174_master != v3.28-1275-gf42dab7174-master

Note extra "rc" and "- != _"

now try
make kvm-rpm

Wrote: /root/rpmbuild/RPMS/x86_64/libreswan-3.28_1275_gf42dab7174_master-1.fc30.x86_64.rpm
Wrote: /root/rpmbuild/RPMS/x86_64/libreswan-debugsource-3.28_1275_gf42dab7174_master-1.fc30.x86_64.rpm
Wrote: 
/root/rpmbuild/RPMS/x86_64/libreswan-debuginfo-3.28_1275_gf42dab7174_master-1.fc30.x86_64.rpm

/usr/local/libexec/ipsec/pluto --version
Libreswan 3.28_1275_gf42dab7174_master-1

3.28_1275_gf42dab7174_master-1 = 3.28_1275_gf42dab7174_master-1

this is coming from  "make showrpmversion"

Tuomo would probably argue this not a good version string, it is not  
joining or Release and Version.  There is room for improvement.
My idea is what we see on rpm file name should be the same in output of 
pluto --version.
To get that you need something like "IPSECVERSION=%{IPSECVERSION}" in the 
spec file, creating version.mk will not work.

I gues Tuomo is suggesting fix "make showrpmversion" "make showrpmrelease" 
and use this.

make showrpmversion
3.28_1275_gf42dab7174_master

make showrpmrelease
1275-gf42dab7174-master

Also ignore /usr/local vs /usr argument for now.

Now when re-building rpm, with one change in libreswan-testing.spec pluto 
--version should also change.

I am not sure how a typical user re-build with increased version. Would you 
change Release or Version? or change something else in the spec file.
I know if you change Version then "Source" file will not be found. Whatever 
changed when re-buiding rpm should also reflect in pluto --version. As far 
as I see using version.mk won't work this way. And 
"IPSECVERSION=%{IPSECVERSION}" appear to  work with one change.

-antony


More information about the Swan-dev mailing list