[Fedora-packaging] disttag

Tom 'spot' Callaway tcallawa at redhat.com
Thu Feb 24 23:28:38 UTC 2005


The idea of disttag is not present in the Naming Policy right now, but I
think there is good reason to standardize how it should be used in
Fedora Extras.

In the event that a single spec file is used for multiple versions of
Fedora Extras, it is feasible that two packages with identical
"%{name}-%{version}-%{release}" values could exist. This could lead to
confusion, especially since their contents provide the same application,
merely compiled and linked for different environments and userlands.

In this case, a %{disttag} is needed to differentiate between these two
packages, in the Release: field.

The %{disttag} value should be determined from the build-environment.
Using redhat-release for this purpose seems like the sanest method.
With this command, we can determine the version of the Red Hat/Fedora
distribution present in the build-environment:

rpm -q --qf "%{version}\n" `rpm -qf /etc/redhat-release`

The following chart presents the results:

RHL 7.3: 7.3
RHL 8: 8.0
RHL 9: 9
RHEL 2.1 AS: 2.1AS
RHEL 2.1 ES: 2.1ES
RHEL 2.1 WS: 2.1WS
RHEL 2.1 AW: 2.1AW
RHEL 3 AS: 3AS
RHEL 3 ES: 3ES
RHEL 3 WS: 3WS
RHEL 3 Desktop: 3Desktop
RHEL 4 AS: 4AS
RHEL 4 ES: 4ES
RHEL 4 WS: 4WS
RHEL 4 Desktop: 4Desktop
FC-1: 1
FC-2: 2
FC-3: 3

Now, in theory, we would have a problem with Fedora Core and Red Hat
Linux release versions overlapping, but hopefully, by the time Fedora
Core 9 is current, there will be few remaining users of Red Hat Linux 9.

A bigger problem is dealing with the overlap of RHEL and Fedora Core
releases.

The following rpmmacros aren't terribly pretty, but they do work.

%disttaglong %{expand:%%(rpm -qi `rpm -qf /etc/redhat-release` |grep
Version | cut -d ":" -f 2 | cut -d " " -f 2 | perl -pe 's/^\s+//')}
%rheldisttag %{expand:%%(echo %{disttaglong} | sed -e 's/[^0-9.]//g' -e
's/^/EL/')}
%rhldisttag  %{expand:%%(echo %{disttaglong} | sed -e 's/^/RH/')}
%fcdisttag   %{expand:%%(echo %{disttaglong} | sed -e 's/^/FC/')}
%disttag     %{expand:%%(if echo %{disttaglong} | grep "[^0-9.]"
> /dev/null; then \
  echo %{rheldisttag} \
else \
  case "%{disttaglong}" in \
    ( "6.2" | "7.0" | "7.1" | "7.2" | "7.3" | "8.0" | "9" ) \
    echo %{rhldisttag} \
    ;; \
    ( "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" ) \
    echo %{fcdisttag} \
    ;; \
  esac; \
fi;)}

With macros like these, it is then possible to use %{disttag} in the
spec to allow a single spec file to be used for multiple versions of
Fedora (and outside of Fedora Extras, for RHEL and RHL).

Maintainers would not be required to use %{disttag}. However, should
they choose to do so, it should be placed at the end of the release
field, preceeded by a period, e.g. Release: 1.%{disttag}.

%{disttag} should never be hardcoded in a spec, it will be assigned by
the buildsystem based on the version of the package owning 
/etc/redhat-release.

Feedback, thoughts, and macro improvements welcome.

~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