]> git.pld-linux.org Git - packages/tzdata.git/blobdiff - tzdata.spec
Use timedatectl to set timezone under systemd
[packages/tzdata.git] / tzdata.spec
index 520c0f17c581aab7924eb299986344cf7236ce67..bd59a41093f203b281690e7c101644127d3cdcad 100644 (file)
@@ -1,38 +1,58 @@
 #
 # Conditional build
 %bcond_without tests           # make check
-%bcond_with    java            # build java subpackage
+%bcond_without java            # build java subpackage
 
-%define                tzcode_ver      2010j
-%define                tzdata_ver      2010j
+%if "%{pld_release}" == "ac"
+%ifnarch i586 i686 pentium3 pentium4 athlon %{x8664}
+%undefine      with_java
+%endif
+%endif
+
+%define                tzcode_ver      2015d
+%define                tzdata_ver      2015d
 Summary:       Timezone data
 Summary(pl.UTF-8):     Dane o strefach czasowych
 Name:          tzdata
 Version:       %{tzdata_ver}
-Release:       1
+Release:       2
 License:       Public Domain (database), BSD/LGPL v2.1+ (code/test suite)
 Group:         Base
+# The tzdata-base-0.tar.bz2 is a simple building infrastructure and
+# a test suite. It is occasionally updated from glibc sources, and as
+# such is under LGPL v2+, but none of this ever gets to be part of
+# final zoneinfo files.
 Source0:       %{name}-base-0.tar.bz2
-# Source0-md5: 906a4c98cc5240f416524a256b039c42
-Source1:       ftp://elsie.nci.nih.gov/pub/%{name}%{tzdata_ver}.tar.gz
-# Source1-md5: f668f66b260e14b477eac3f48bcfb5f4
-Source2:       ftp://elsie.nci.nih.gov/pub/tzcode%{tzcode_ver}.tar.gz
-# Source2-md5: 5ba8345720296d3a659b349b2052d139
+# Source0-md5: e36d2f742c22f8c8dbf0686ac9769b55
+# ftp://elsie.nci.nih.gov/pub/ has been shut down because of lawsuit
+#Source1Download: http://www.iana.org/time-zones/
+Source1:       ftp://ftp.iana.org/tz/releases/%{name}%{tzdata_ver}.tar.gz
+# Source1-md5: b595bdc4474b8fc1a15cffc67c66025b
+#Source2Download: http://www.iana.org/time-zones/
+Source2:       ftp://ftp.iana.org/tz/releases/tzcode%{tzcode_ver}.tar.gz
+# Source2-md5: 4008a3abc025a398697b2587c48258b9
 Source3:       timezone.init
 Source4:       timezone.sysconfig
 Source5:       javazic.tar.gz
 # Source5-md5: 6a3392cd5f1594d13c12c1a836ac8d91
+Source6:       timezone.upstart
+Source7:       timezone.service
+Source8:       timezone.sh
 Patch0:                %{name}-test-update.patch
 Patch1:                javazic-fixup.patch
+Patch2:                install.patch
 URL:           http://www.twinsun.com/tz/tz-link.htm
-BuildRequires: rpmbuild(macros) >= 1.300
+BuildRequires: rpm >= 4.4.9-56
+BuildRequires: rpmbuild(macros) >= 1.623
 %if %{with java}
+BuildRequires: jdk
 BuildRequires: jpackage-utils
 BuildRequires: rpm-javaprov
 %endif
-Requires(post,preun):  /sbin/chkconfig
+Requires(post,preun,postun):   systemd-units >= 38
 Requires:      /sbin/chkconfig
-Requires:      rc-scripts >= 0.4.1.4
+Requires:      rc-scripts >= 0.4.3.0
+Requires:      systemd-units >= 38
 BuildArch:     noarch
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -44,15 +64,15 @@ around the world.
 Ten pakiet zawiera pliki z danymi na temat reguł stref czasowych na
 całym świecie.
 
-%package java
+%package -n java-tzdata
 Summary:       Timezone data for Java
 Summary(pl.UTF-8):     Dane stref czasowych dla Javy
 Group:         Base
 
-%description java
+%description -n java-tzdata
 This package contains timezone information for use by Java runtimes.
 
-%description java -l pl.UTF-8
+%description -n java-tzdata -l pl.UTF-8
 Ten pakiet zawiera informacje o strefach czasowych przeznaczone dla
 programów w Javie.
 
@@ -89,12 +109,17 @@ Plik nagłówkowy bazy danych stref czasowych.
 %prep
 %setup -qc
 mv tzdata/* .
+%patch0 -p1
+
 %{__tar} xzf %{SOURCE1} -C tzdata
-mkdir tzcode
+# don't override Makefile from base tar
+%{__mv} tzdata/Makefile{,.tzdata}
+
+install -d tzcode
 %{__tar} xzf %{SOURCE2} -C tzcode
-%patch0 -p1
+%patch2 -p1
 
-sed -e "
+%{__sed} -e "
 s|@objpfx@|`pwd`/obj/|
 s|@datadir@|%{_datadir}|
 s|@install_root@|$RPM_BUILD_ROOT|
@@ -132,20 +157,18 @@ cd ../tzdata
 %java -classpath ../javazic/ rht.tools.javazic.Main -V %{version} \
        -d ../zoneinfo/java \
        africa antarctica asia australasia europe northamerica pacificnew \
-       southamerica backward etcetera solar87 solar88 solar89 systemv \
+       southamerica backward etcetera factory systemv \
        ../javazic/tzdata_jdk/gmt ../javazic/tzdata_jdk/jdk11_backward
 cd ..
 %endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT/etc/{sysconfig,rc.d/init.d}
-install -d $RPM_BUILD_ROOT%{_includedir}
-install -d $RPM_BUILD_ROOT%{_mandir}/man5
-
+install -d $RPM_BUILD_ROOT{/etc/{sysconfig,rc.d/init.d},%{_mandir}/man5,%{_includedir},%{systemdunitdir}}
 %{__make} install
 
 %if %{with tests}
+# test needs to be ran after "make install", as it uses installed files
 : ====================TESTING=========================
 %{__make} check \
        CC="%{__cc}" \
@@ -154,7 +177,7 @@ install -d $RPM_BUILD_ROOT%{_mandir}/man5
 %endif
 
 # glibc.spec didn't keep it. so won't here either.
-rm -rf $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posix
+%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posix
 # behave more like glibc.spec
 ln -sf %{_sysconfdir}/localtime        $RPM_BUILD_ROOT%{_datadir}/zoneinfo/localtime
 ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixtime
@@ -163,11 +186,17 @@ ln -sf localtime $RPM_BUILD_ROOT%{_datadir}/zoneinfo/posixrules
 > $RPM_BUILD_ROOT/etc/localtime
 
 # header file
-cp -a tzcode/tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
-cp -a tzcode/tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
+cp -p tzcode/tzfile.h $RPM_BUILD_ROOT%{_includedir}/tzfile.h
+cp -p tzcode/tzfile.5 $RPM_BUILD_ROOT%{_mandir}/man5
 
 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/timezone
-cp -a %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
+cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/timezone
+
+install -d $RPM_BUILD_ROOT/etc/init
+cp -p %{SOURCE6} $RPM_BUILD_ROOT/etc/init/timezone.conf
+
+install -p %{SOURCE7} $RPM_BUILD_ROOT%{systemdunitdir}/timezone.service
+install -p %{SOURCE8} $RPM_BUILD_ROOT/lib/systemd/pld-timezone
 
 %if %{with java}
 cp -a zoneinfo/java $RPM_BUILD_ROOT%{_datadir}/javazi
@@ -179,21 +208,25 @@ rm -rf $RPM_BUILD_ROOT
 %post
 /sbin/chkconfig --add timezone
 %service timezone restart
+%systemd_post timezone.service
 
 %preun
 if [ "$1" = "0" ]; then
        /sbin/chkconfig --del timezone
 
        # save for postun
-       cp -f /etc/localtime /etc/localtime.rpmsave
+       cp -af /etc/localtime /etc/localtime.rpmsave
 fi
+%systemd_preun timezone.service
 
 %postun
 if [ "$1" = "0" ]; then
        if [ ! -f /etc/localtime -a -f /etc/localtime.rpmsave ]; then
+               echo >&2 "Preserving /etc/localtime"
                mv -f /etc/localtime{.rpmsave,}
        fi
 fi
+%systemd_reload
 
 %triggerpostun -- rc-scripts < 0.4.1.4
 /sbin/chkconfig --add timezone
@@ -213,18 +246,24 @@ if ! grep -q '^TIMEZONE=' /etc/sysconfig/timezone; then
        %service timezone restart
 fi
 
+%triggerpostun -- tzdata < 2012a-2
+%systemd_trigger timezone.service
+
 %files
 %defattr(644,root,root,755)
 %doc tzcode/README tzcode/Theory tzcode/tz-link.html
 %ghost /etc/localtime
 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/timezone
 %attr(754,root,root) /etc/rc.d/init.d/timezone
+%config(noreplace) %verify(not md5 mtime size) /etc/init/timezone.conf
+%{systemdunitdir}/timezone.service
+%attr(755,root,root) /lib/systemd/pld-timezone
 
 %{_datadir}/zoneinfo
 %exclude %{_datadir}/zoneinfo/right
 
 %if %{with java}
-%files java
+%files -n java-tzdata
 %defattr(644,root,root,755)
 %{_datadir}/javazi
 %endif
This page took 0.094008 seconds and 4 git commands to generate.