[packagers] Smokeping RPM
Tom G. Christensen
tgc at statsbiblioteket.dk
Wed Dec 6 09:03:00 CET 2006
Dag Wieers wrote:
> On Tue, 5 Dec 2006, Wil Cooley wrote:
>
>> On Fri, 2006-12-01 at 12:36 -0800, mchandler at solutions.canon.com wrote:
>>> I was trying to update the RPM I found for Smokeping from 2.0.4 to 2.0.9
>>> and I've run into some problems. I built the RPM with "rpmbuild -ba
>>> /usr/src/redhat/SPECS/smokeping.spec" and it named it internally and
>>> externally with smokeping.noarch.2.0.9-0.0.%{dist_tag}.%{vendor_tag}.rpm I
>>> renamed the file and then I noticed that yum kept referencing the old name
>>> internally as variables. I guess it has an internal spec file inside the
>>> RPM. I went ahead and used it to upgrade a test server and it looks like
>>> it's working, but I'm not sure what to check exactly. The binaries are the
>>> same, but I suppose they got updated. The version # in the webpage for
>>> smokeping changed and it's still working, but I have an uneasy feeling. I
>>> looked through the spec file and I see where it names those variables, but
>>> I don't see how or where it defines them. I've search online, but I'm so
>>> new to this that I have no idea where to look or how to search for it. I
>>> checked out rpm.org and some other linux resources, but to no avail. Any
>>> ideas?
>> FYI, he was looking at my spec file, which I've since updated (to use
>> '%{?dist}' instead, like FE) and I've responded to him privately.
>
> I think we're ready to move to the FE standard now where they include the
> disttag in the Release tag.
>
> Should we also include a repo-macro in the release (I am in favor of
> that). Something like:
>
> Version: 4.5
> Release: 1%{?dist}%{?repo}
>
> Where dist = .el3 and repo = .rf
>
> I dislike it for the fact that the release is harder to identify (having
> the % attached to it closely) and I generally feel this should be left to
> the buildsystem (which knows best).
>
> Dries, Matthias, what do you think ?
>
> Anyone else having an opinion on this ?
>
Forget about a seperate repo-macro. Keep everything in %{?dist} and rpms
will be properly disttagged regardless of buildsystem.
For reference I've attached my own rpm macros that I use to generate
%{?dist} in my mock based buildsystem.
I'd *really* like to see a unified macro package from RPMForge that
could be dropped into a local buildsystem to allow easy rebuild and
tweaking of RPMForge rpms for local use.
-tgc
-------------- next part --------------
### RPMForge/Fedora style disttagging (with integrated repotag)
# Automatically determines the disttag from /etc/redhat-release
# of the current build environment
#
# These tags will be available for use in specfile conditionals
# rh7, rh8, rh9, el2, el3, el4, el5, fc3, fc4, fc5, fc6, fc7
#
# When building src.rpms use --with nodist (or --define 'nodist 1' - deprecated) to avoid a fully disttagged
# filename.
# Good defaults
%nodist %{!?%nodist:0}
# Default repotag is .sb
%repotag %{!?%repotag:.sb}
# First determine if we're using rh/rhel/fc
# *FIXME* CentOS and friends will *not* be recognized as RHEL
%sb_disthandle %(if [ -n "$(grep -i fedora /etc/redhat-release 2> /dev/null)" ]; then echo fc; else if [ -n "$(grep -i enterprise /etc/redhat-release 2> /dev/null)" ]; then echo el; else echo rh; fi; fi;)
# Determine release major for tagging
%sb_distmajor %(sed -e 's/.*release \\([0-9]\\).*/\\1/' < /etc/redhat-release)
# Complete dist identifier
%sb_distrel %{sb_disthandle}%{sb_distmajor}
# Determine distrev (the optional prefixed numeric part of the disttag)
#sb_distrev %(if [ -n "$(echo rh7rh8rh9el2 | grep %{sb_distrel})" ]; then echo 0; elif [ -n "$(echo el3fc3 | grep %{sb_distrel})" ]; then echo 1; elif [ -n "$(echo el4fc4 | grep %{sb_distrel})" ]; then echo 2; elif [ -n "$(echo el5fc5fc6fc7 | grep %{sb_distrel})" ]; then :; else echo 0; fi)
# Setup disttag
# If --with nodist is given then define an empty disttag (for src.rpms etc.)
#sb_disttag %{!?%sb_disttag:%(if [ -z "%{?_with_nodist}" -a "%{nodist}" = "0" ]; then echo .%{sb_distrev}.%{sb_distrel}; fi)}
%sb_disttag %{!?%sb_disttag:%(if [ -z "%{?_with_nodist}" -a "%{nodist}" = "0" ]; then echo .%{sb_distrel}; fi)}
%disttag %{sb_disttag}
# For Fedora specfile compatibility
%dist %{disttag}%{repotag}
# Define all rel tags to either 1 or 0 depending on the current build environment
%el2 %(test "%{sb_distrel}" = "el2" && echo 1 || echo 0)
%el3 %(test "%{sb_distrel}" = "el3" && echo 1 || echo 0)
%el4 %(test "%{sb_distrel}" = "el4" && echo 1 || echo 0)
%el5 %(test "%{sb_distrel}" = "el5" && echo 1 || echo 0)
%rh7 %(test "%{sb_distrel}" = "rh7" && echo 1 || echo 0)
%rh8 %(test "%{sb_distrel}" = "rh8" && echo 1 || echo 0)
%rh9 %(test "%{sb_distrel}" = "rh9" && echo 1 || echo 0)
%fc3 %(test "%{sb_distrel}" = "fc3" && echo 1 || echo 0)
%fc4 %(test "%{sb_distrel}" = "fc4" && echo 1 || echo 0)
%fc5 %(test "%{sb_distrel}" = "fc5" && echo 1 || echo 0)
%fc6 %(test "%{sb_distrel}" = "fc6" && echo 1 || echo 0)
%fc7 %(test "%{sb_distrel}" = "fc7" && echo 1 || echo 0)
# Fedora Extras also introduces these useful variables
# See: http://fedoraproject.org/wiki/DistTag
# They are only defined if the dist matches. That is rhel is not defined
# on RHL and Fedora and sofort.
# Note that there's a gotcha when using this for version matching.
# You must be very careful with < (less than) since "" (undefined) is less than any
# right side value. Ie. "%{?rhel}" < "3" will always be true on RHL & Fedora
%rhl %(if [ "%{sb_disthandle}" = "rh" ]; then echo %{sb_distmajor}; fi)
%rhel %(if [ "%{sb_disthandle}" = "el" ]; then echo %{sb_distmajor}; fi)
%fedora %(if [ "%{sb_disthandle}" = "fc" ]; then echo %{sb_distmajor}; fi)
#### End RPMForge/Fedora style disttagging
More information about the packagers
mailing list