From 9776df6ec9fccd973efc9060c1d55b93b03dc9216ff39ea5a29e608d165599c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Sat, 25 Aug 2012 21:03:54 +0000 Subject: [PATCH] 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 --- timezone.changes | 7 +++++ timezone.spec | 5 ++++ tzcode-symlink.patch | 66 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 tzcode-symlink.patch diff --git a/timezone.changes b/timezone.changes index b3032d5..82c4c30 100644 --- a/timezone.changes +++ b/timezone.changes @@ -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 diff --git a/timezone.spec b/timezone.spec index 62c3b9b..44b36d6 100644 --- a/timezone.spec +++ b/timezone.spec @@ -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 diff --git a/tzcode-symlink.patch b/tzcode-symlink.patch new file mode 100644 index 0000000..f931b32 --- /dev/null +++ b/tzcode-symlink.patch @@ -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;