[Fedora-packaging] disttag
Tom 'spot' Callaway
tcallawa at redhat.com
Fri Feb 25 22:57:07 UTC 2005
On Fri, 2005-02-25 at 17:48 -0500, Chuck R. Anderson wrote:
>Problems with %{version} aside, my point was that Jeff Johnson
>mentioned to me once that the best way to get the distro version
>package is to get what Provides: redhat-release, not hardcoding either
>/etc/redhat-release or the package name redhat-release. So:
>
>rpm -q --whatprovides redhat-release
>
>rather than:
>
>rpm -qf /etc/redhat-release
Ehhh... I think this may be nit-picking, but its probably right.
Alright. How about THESE macros:
# Disttag macros (you really only want to use %{disttag})
# When we get to Fedora Core 6, we'll need to revisit this.
%disttaglong %{expand:%%(rpm -q --whatprovides redhat-release --qf
'%{VERSION}')}
%rheldisttag %{expand:%%(echo %{disttaglong} | sed -e 's/[^0-9.]//g' -e
's/^/el/')}
%rhldisttag %{expand:%%(echo %{disttaglong} | cut -d "." -f 1 | sed -e
's/^/rh/')}
%fcdisttag %{expand:%%(echo %{disttaglong} | sed -e 's/^/fc/')}
%disttag %{expand:%%(if echo %{disttaglong} | grep "[^0-9.]"
> /dev/null; then \
case "%{rheldisttag}" in \
( "el2" ) \
echo 0.%{rheldisttag} \
;; \
( "el3" ) \
echo 1.%{rheldisttag} \
;; \
( "el4" ) \
echo 2.%{rheldisttag} \
;; \
( "el5" ) \
echo 3.%{rheldisttag} \
;; \
esac; \
else \
case "%{disttaglong}" in \
( "7.0" | "7.1" | "7.2" | "7.3" | "8" | "9" ) \
echo 0.%{rhldisttag} \
;; \
( "1" | "2" | "3" ) \
echo 1.%{fcdisttag} \
;; \
("4" | "5" | "6" ) \
echo 2.%{fcdisttag} \
;; \
esac; \
fi;)}
~spot
---
Tom "spot" Callaway: Red Hat Sales Engineer || GPG Fingerprint: 93054260
Fedora Extras Steering Committee Member (RPM Standards and Practices)
Aurora Linux Project Leader: http://auroralinux.org
Lemurs, llamas, and sparcs, oh my!
More information about the Fedora-packaging
mailing list