]> wolfpit.net Git - tool/Arch-pacman/.git/commitdiff
Remove setlocale usage from the backend
authorAllan McRae <allan@archlinux.org>
Sun, 21 Jul 2013 06:38:17 +0000 (16:38 +1000)
committerAllan McRae <allan@archlinux.org>
Tue, 30 Jul 2013 03:01:26 +0000 (13:01 +1000)
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>
lib/libalpm/util.c
test/pacman/tests/query002.py
test/pacman/tests/sync1100.py

index 1e21362718c39212c232afef1a2153445a8662c0..f1f760a5541f3738ec0910bd0d78a2d9b8d4072f 100644 (file)
@@ -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 */
index ccf18f44d1298f05a0b1bd9d893691445464bae2..5de1f37b5cb26208471bc4d0b4f4146352fca838 100644 (file)
@@ -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.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.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")
index c7bb56aaaccb372db84d8b0f77725f806251dc6a..8f59f37547e2fad91b502acdd3864379896b2945 100644 (file)
@@ -8,8 +8,6 @@
 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.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")