timezone/timezone.spec

123 lines
4.4 KiB
RPMSpec

#
# spec file for package timezone
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: timezone
Summary: Time Zone Descriptions
License: BSD-3-Clause and SUSE-Public-Domain
Group: System/Base
Url: http://www.iana.org/time-zones
PreReq: filesystem, coreutils
# COMMON-BEGIN
Version: 2018c
Release: 0
Source: https://www.iana.org/time-zones/repository/releases/tzdata%{version}.tar.gz
Source1: https://www.iana.org/time-zones/repository/releases/tzcode%{version}.tar.gz
Source2: https://www.iana.org/time-zones/repository/releases/tzdata%{version}.tar.gz.asc
Source3: https://www.iana.org/time-zones/repository/releases/tzcode%{version}.tar.gz.asc
Source4: %{name}.keyring
Source5: %{name}.changes
Patch0: tzdata-china.diff
Patch3: iso3166-uk.diff
# COMMON-END
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global AREA Etc
%global ZONE UTC
%description
These are configuration files that describe available time zones. You
can select an appropriate time zone for your system with YaST.
%prep
%setup -q -c -a 1
# COMMON-PREP-BEGIN
%patch0 -p1
%patch3 -p1
sed -ri 's@/usr/local/etc/zoneinfo@%{_datadir}/zoneinfo@g' *.[1358]
# COMMON-PREP-END
%build
unset ${!LC_*}
LANG=POSIX
LC_ALL=POSIX
AREA=%{AREA}
ZONE=%{ZONE}
export AREA LANG LC_ALL ZONE
make %{?_smp_mflags} TZDIR=%{_datadir}/zoneinfo CFLAGS="%{optflags} -DHAVE_GETTEXT=1 -DTZDEFAULT='\"/etc/localtime\"' -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone -Dlint" AWK=awk
make %{?_smp_mflags} TZDIR=zoneinfo AWK=awk zones
# Generate posixrules
./zic -y ./yearistype -d zoneinfo -p %{AREA}/%{ZONE}
%install
mkdir -p %{buildroot}%{_prefix}/share/zoneinfo
cp -a zoneinfo %{buildroot}%{_prefix}/share/zoneinfo/posix
cp -al %{buildroot}%{_prefix}/share/zoneinfo/posix/. %{buildroot}%{_prefix}/share/zoneinfo
cp -a zoneinfo-leaps %{buildroot}%{_prefix}/share/zoneinfo/right
mkdir -p %{buildroot}/etc
rm -f %{buildroot}/etc/localtime
rm -f %{buildroot}%{_prefix}/share/zoneinfo/posixrules
%if 0%{?suse_version} >= 1230
ln -sf %{_prefix}/share/zoneinfo/%{AREA}/%{ZONE} %{buildroot}/etc/localtime
%else
cp -fp %{buildroot}%{_prefix}/share/zoneinfo/%{AREA}/%{ZONE} %{buildroot}/etc/localtime
%endif
ln -sf /etc/localtime %{buildroot}%{_prefix}/share/zoneinfo/posixrules
install -m 644 iso3166.tab %{buildroot}%{_prefix}/share/zoneinfo/iso3166.tab
install -m 644 zone.tab %{buildroot}%{_prefix}/share/zoneinfo/zone.tab
install -m 644 zone1970.tab %{buildroot}%{_prefix}/share/zoneinfo/zone1970.tab
install -D -m 755 tzselect %{buildroot}%{_bindir}/tzselect
install -D -m 755 zdump %{buildroot}%{_sbindir}/zdump
install -D -m 755 zic %{buildroot}%{_sbindir}/zic
%post
if [ -f /etc/sysconfig/clock ];
then
. /etc/sysconfig/clock
if [ -n "$TIMEZONE" -a -f /etc/localtime -a -f /usr/share/zoneinfo/$TIMEZONE ]; then
%if 0%{?suse_version} >= 1230
ln -sf /usr/share/zoneinfo/$TIMEZONE /etc/localtime
%else
new=$(mktemp /etc/localtime.XXXXXXXX) || exit 1
cp -fl /usr/share/zoneinfo/$TIMEZONE $new 2>/dev/null || cp -fp /usr/share/zoneinfo/$TIMEZONE $new
mv -f $new /etc/localtime
%endif
else
[ ! -f /etc/localtime ] || echo "WARNING: Not updating /etc/localtime with new zone file" >&2
fi
fi
if [ ! -L /usr/share/zoneinfo/posixrules ]; then
rm -f /usr/share/zoneinfo/posixrules
ln -sf /etc/localtime /usr/share/zoneinfo/posixrules
fi
if [ -e /usr/share/zoneinfo/posixrules.rpmnew ]; then
rm -f /usr/share/zoneinfo/posixrules.rpmnew
fi
%files
%defattr(-,root,root)
%verify(not link md5 size mtime) %config(missingok,noreplace) /etc/localtime
%verify(not link md5 size mtime) %{_datadir}/zoneinfo/posixrules
%{_datadir}/zoneinfo
%{_bindir}/tzselect
%{_sbindir}/zdump
%{_sbindir}/zic
%changelog