SHA256
3
0
forked from pool/timezone

Accepting request 131519 from home:fcrozat:branches:Base:System

- Add tzcode-symlink.patch: use a symlink to create /etc/localtime
  (bnc#773491)
- Do not apply tzcode-link.diff on openSUSE < 12.2 (bnc#773491).

OBS-URL: https://build.opensuse.org/request/show/131519
OBS-URL: https://build.opensuse.org/package/show/Base:System/timezone?expand=0&rev=82
This commit is contained in:
Cristian Rodríguez 2012-08-25 21:03:54 +00:00 committed by Git OBS Bridge
parent 9fd823107e
commit 9776df6ec9
3 changed files with 78 additions and 0 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Aug 20 15:47:57 UTC 2012 - fcrozat@suse.com
- Add tzcode-symlink.patch: use a symlink to create /etc/localtime
(bnc#773491)
- Do not apply tzcode-link.diff on openSUSE < 12.2 (bnc#773491).
-------------------------------------------------------------------
Mon Aug 6 10:52:34 UTC 2012 - dmueller@suse.com

View File

@ -32,6 +32,7 @@ Patch1: tzcode-zic.diff
Patch2: tzcode-ksh.diff
Patch3: iso3166-uk.diff
Patch4: tzcode-link.diff
Patch5: tzcode-symlink.patch
# COMMON-END
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%global AREA Etc
@ -50,7 +51,11 @@ can select an appropriate time zone for your system with YaST.
%patch1
%patch2
%patch3
%if 0%{?suse_version} < 1220
%patch4
%else
%patch5 -p1
%endif
# COMMON-PREP-END
%build

66
tzcode-symlink.patch Normal file
View File

@ -0,0 +1,66 @@
Index: timezone-2012e/zic.c
===================================================================
--- timezone-2012e.orig/zic.c
+++ timezone-2012e/zic.c
@@ -113,7 +113,7 @@ static void associate(void);
static int ciequal(const char * ap, const char * bp);
static void convert(long val, char * buf);
static void convert64(zic_t val, char * buf);
-static void dolink(const char * fromfield, const char * tofield);
+static void dolink(const char * fromfield, const char * tofield, int defaultsymlink);
static void doabbr(char * abbr, const char * format,
const char * letters, int isdst, int doquotes);
static void eat(const char * name, int num);
@@ -595,7 +595,7 @@ _("%s: More than one -L option specified
*/
for (i = 0; i < nlinks; ++i) {
eat(links[i].l_filename, links[i].l_linenum);
- dolink(links[i].l_from, links[i].l_to);
+ dolink(links[i].l_from, links[i].l_to, FALSE);
if (noise)
for (j = 0; j < nlinks; ++j)
if (strcmp(links[i].l_to,
@@ -604,19 +604,20 @@ _("%s: More than one -L option specified
}
if (lcltime != NULL) {
eat("command line", 1);
- dolink(lcltime, TZDEFAULT);
+ dolink(lcltime, TZDEFAULT,TRUE);
}
if (psxrules != NULL) {
eat("command line", 1);
- dolink(psxrules, TZDEFRULES);
+ dolink(psxrules, TZDEFRULES,FALSE);
}
return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
static void
-dolink(fromfield, tofield)
+dolink(fromfield, tofield, defaultsymlink)
const char * const fromfield;
const char * const tofield;
+const int defaultsymlink;
{
register char * fromname;
register char * toname;
@@ -641,15 +642,16 @@ const char * const tofield;
*/
if (!itsdir(toname))
(void) remove(toname);
- if (link(fromname, toname) != 0) {
+ if (defaultsymlink || link(fromname, toname) != 0) {
int result;
if (mkdirs(toname) != 0)
exit(EXIT_FAILURE);
- result = link(fromname, toname);
+ if (!defaultsymlink)
+ result = link(fromname, toname);
#if HAVE_SYMLINK
- if (result != 0 &&
+ if ((defaultsymlink || (!defaultsymlink && result != 0)) &&
access(fromname, F_OK) == 0 &&
!itsdir(fromname)) {
const char *s = tofield;