diff options
author | Allan McRae <allan@archlinux.org> | 2013-07-21 16:38:17 +1000 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-07-30 13:01:26 +1000 |
commit | d7bd40045c5a8c1240800bddf61ddac3fa4bd3d2 (patch) | |
tree | d60fe355b76701c3f400846ef6403d2e48ae9edd | |
parent | e81faa9d6d2ac910720a9a87a9f469b80cf106e5 (diff) | |
download | pacman-d7bd40045c5a8c1240800bddf61ddac3fa4bd3d2.tar.xz |
Remove setlocale usage from the backend
Using setlocale in the backend is bound to lead to frontend issues
and we have have been using epoch in our databases since April 2007
(commit 47622eef). Remove support for old style times.
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r-- | lib/libalpm/util.c | 15 | ||||
-rw-r--r-- | test/pacman/tests/query002.py | 5 | ||||
-rw-r--r-- | test/pacman/tests/sync1100.py | 3 |
3 files changed, 1 insertions, 22 deletions
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 1e213627..f1f760a5 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -31,7 +31,6 @@ #include <errno.h> #include <limits.h> #include <sys/wait.h> -#include <locale.h> /* setlocale */ #include <fnmatch.h> /* libarchive */ @@ -1169,20 +1168,6 @@ alpm_time_t _alpm_parsedate(const char *line) long long result; errno = 0; - if(isalpha((unsigned char)line[0])) { - const char *oldlocale; - /* initialize to null in case of failure */ - struct tm tmp_tm; - memset(&tmp_tm, 0, sizeof(struct tm)); - - oldlocale = setlocale(LC_TIME, NULL); - setlocale(LC_TIME, "C"); - strptime(line, "%a %b %e %H:%M:%S %Y", &tmp_tm); - setlocale(LC_TIME, oldlocale); - - return (alpm_time_t)mktime(&tmp_tm); - } - result = strtoll(line, &end, 10); if(result == 0 && end == line) { /* line was not a number */ diff --git a/test/pacman/tests/query002.py b/test/pacman/tests/query002.py index ccf18f44..5de1f37b 100644 --- a/test/pacman/tests/query002.py +++ b/test/pacman/tests/query002.py @@ -1,4 +1,4 @@ -self.description = "Query info on a package (old date)" +self.description = "Query info on a package" p = pmpkg("foobar") p.files = ["bin/foobar"] @@ -7,8 +7,6 @@ p.groups = ["foo"] p.url = "http://www.archlinux.org" p.license = "GPL2" p.arch = "i686" -# test old style date -p.builddate = "Mon Oct 1 01:40:21 2007 UTC" p.packager = "Arch Linux" self.addpkg2db("local", p) @@ -18,4 +16,3 @@ self.args = "-Qi %s" % p.name self.addrule("PACMAN_RETCODE=0") self.addrule("PACMAN_OUTPUT=^Name.*%s" % p.name) self.addrule("PACMAN_OUTPUT=^Description.*%s" % p.desc) -self.addrule("PACMAN_OUTPUT=^Build Date.* 2007") diff --git a/test/pacman/tests/sync1100.py b/test/pacman/tests/sync1100.py index c7bb56aa..8f59f375 100644 --- a/test/pacman/tests/sync1100.py +++ b/test/pacman/tests/sync1100.py @@ -8,8 +8,6 @@ sp.groups = ["foo"] sp.url = "http://www.archlinux.org" sp.license = "GPL2" sp.arch = "i686" -# test both old style and new style dates -sp.builddate = "Mon Oct 1 01:40:21 2007 UTC" sp.packager = "Arch Linux" sp.md5sum = "00000000000000000000000000000000" @@ -20,4 +18,3 @@ self.args = "-Si %s" % sp.name self.addrule("PACMAN_RETCODE=0") self.addrule("PACMAN_OUTPUT=^Name.*%s" % sp.name) self.addrule("PACMAN_OUTPUT=^Description.*%s" % sp.desc) -self.addrule("PACMAN_OUTPUT=^Build Date.*2007") |