LC_ADDRESS is a GNU extension, treat it as such (upstream).

This commit is contained in:
ajacoutot 2013-04-17 17:31:06 +00:00
parent 0f4c7feee0
commit d6dfc636b4
5 changed files with 199 additions and 51 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.139 2013/04/16 13:17:00 ajacoutot Exp $ # $OpenBSD: Makefile,v 1.140 2013/04/17 17:31:06 ajacoutot Exp $
SHARED_ONLY= Yes SHARED_ONLY= Yes
@ -6,6 +6,7 @@ COMMENT= unified backend for PIM programs
GNOME_PROJECT= evolution-data-server GNOME_PROJECT= evolution-data-server
GNOME_VERSION= 3.8.1 GNOME_VERSION= 3.8.1
REVISION= 0
CATEGORIES= databases productivity CATEGORIES= databases productivity

View File

@ -1,18 +1,25 @@
$OpenBSD: patch-addressbook_libebook-contacts_e-book-query_c,v 1.1 2013/03/29 15:17:01 ajacoutot Exp $ $OpenBSD: patch-addressbook_libebook-contacts_e-book-query_c,v 1.2 2013/04/17 17:31:06 ajacoutot Exp $
XXX fix and push upstream From 0076314596c1c0315884a181b9ae9daa21d38840 Mon Sep 17 00:00:00 2001
From: Matthew Barnes <mbarnes@redhat.com>
Date: Wed, 17 Apr 2013 14:37:13 +0000
Subject: LC_ADDRESS is a GNU extension. Treat it as such.
--- addressbook/libebook-contacts/e-book-query.c.orig Fri Mar 29 14:38:02 2013 --- addressbook/libebook-contacts/e-book-query.c.orig Sun Mar 17 13:46:02 2013
+++ addressbook/libebook-contacts/e-book-query.c Fri Mar 29 14:39:13 2013 +++ addressbook/libebook-contacts/e-book-query.c Wed Apr 17 19:12:31 2013
@@ -200,8 +200,11 @@ e_book_query_not (EBookQuery *q, @@ -200,7 +200,14 @@ e_book_query_not (EBookQuery *q,
static const gchar * static const gchar *
address_locale (void) address_locale (void)
{ {
+#if 0 - const gchar *locale = setlocale (LC_ADDRESS, NULL);
const gchar *locale = setlocale (LC_ADDRESS, NULL); + const gchar *locale;
+
+#if defined (LC_ADDRESS)
+ /* LC_ADDRESS is a GNU extension. */
+ locale = setlocale (LC_ADDRESS, NULL);
+#else
+ locale = NULL;
+#endif +#endif
+ const gchar *locale = NULL;
if (locale == NULL || strcmp (locale, "C") == 0) if (locale == NULL || strcmp (locale, "C") == 0)
locale = setlocale (LC_MESSAGES, NULL); locale = setlocale (LC_MESSAGES, NULL);

View File

@ -1,26 +1,56 @@
$OpenBSD: patch-tests_libebook-contacts_test-phone-number_c,v 1.1 2013/03/29 15:17:01 ajacoutot Exp $ $OpenBSD: patch-tests_libebook-contacts_test-phone-number_c,v 1.2 2013/04/17 17:31:06 ajacoutot Exp $
XXX fix and push upstream From 0076314596c1c0315884a181b9ae9daa21d38840 Mon Sep 17 00:00:00 2001
From: Matthew Barnes <mbarnes@redhat.com>
Date: Wed, 17 Apr 2013 14:37:13 +0000
Subject: LC_ADDRESS is a GNU extension. Treat it as such.
--- tests/libebook-contacts/test-phone-number.c.orig Fri Mar 29 15:50:05 2013 --- tests/libebook-contacts/test-phone-number.c.orig Sun Apr 14 16:32:35 2013
+++ tests/libebook-contacts/test-phone-number.c Fri Mar 29 15:41:25 2013 +++ tests/libebook-contacts/test-phone-number.c Wed Apr 17 19:12:31 2013
@@ -342,7 +342,9 @@ test_country_code_for_region (void) @@ -26,6 +26,15 @@
#include <libebook-contacts/libebook-contacts.h>
#include <locale.h>
+/* Pick a locale category to set and test. */
+#ifdef LC_ADDRESS
+/* LC_ADDRESS is a GNU extension. */
+#define CATEGORY LC_ADDRESS
+#else
+/* Mimic the fallback branch in EBookQuery. */
+#define CATEGORY LC_MESSAGES
+#endif /* LC_ADDRESS */
+
static const gchar *match_candidates[] = {
"not-a-number",
"+1-617-4663489", "617-4663489", "4663489",
@@ -342,7 +351,7 @@ test_country_code_for_region (void)
GError *error = NULL; GError *error = NULL;
gint code; gint code;
+#if 0 - g_assert_cmpstr (setlocale (LC_ADDRESS, NULL), ==, "en_US.UTF-8");
g_assert_cmpstr (setlocale (LC_ADDRESS, NULL), ==, "en_US.UTF-8"); + g_assert_cmpstr (setlocale (CATEGORY, NULL), ==, "en_US.UTF-8");
+#endif
#ifdef ENABLE_PHONENUMBER #ifdef ENABLE_PHONENUMBER
@@ -381,7 +383,9 @@ test_default_region (void) @@ -381,7 +390,7 @@ test_default_region (void)
GError *error = NULL; GError *error = NULL;
gchar *country; gchar *country;
+#if 0 - g_assert_cmpstr (setlocale (LC_ADDRESS, NULL), ==, "en_US.UTF-8");
g_assert_cmpstr (setlocale (LC_ADDRESS, NULL), ==, "en_US.UTF-8"); + g_assert_cmpstr (setlocale (CATEGORY, NULL), ==, "en_US.UTF-8");
+#endif
country = e_phone_number_get_default_region (&error); country = e_phone_number_get_default_region (&error);
#ifdef ENABLE_PHONENUMBER #ifdef ENABLE_PHONENUMBER
@@ -408,7 +417,11 @@ main (gint argc,
{
size_t i, j;
- setlocale (LC_ALL, "en_US.UTF-8");
+ if (setlocale (LC_ALL, "en_US.UTF-8") == NULL) {
+ g_message ("Failed to set locale to en_US.UTF-8");
+ g_message ("Skipping all /ebook-phone-number/* tests");
+ return 0;
+ }
g_type_init ();

View File

@ -1,46 +1,152 @@
$OpenBSD: patch-tests_libebook-contacts_test-query_c,v 1.2 2013/04/14 16:21:20 ajacoutot Exp $ $OpenBSD: patch-tests_libebook-contacts_test-query_c,v 1.3 2013/04/17 17:31:06 ajacoutot Exp $
XXX fix and push upstream From 0076314596c1c0315884a181b9ae9daa21d38840 Mon Sep 17 00:00:00 2001
From: Matthew Barnes <mbarnes@redhat.com>
Date: Wed, 17 Apr 2013 14:37:13 +0000
Subject: LC_ADDRESS is a GNU extension. Treat it as such.
--- tests/libebook-contacts/test-query.c.orig Sun Apr 14 16:32:35 2013 --- tests/libebook-contacts/test-query.c.orig Sun Apr 14 16:32:35 2013
+++ tests/libebook-contacts/test-query.c Sun Apr 14 18:05:44 2013 +++ tests/libebook-contacts/test-query.c Wed Apr 17 19:12:31 2013
@@ -37,7 +37,9 @@ test_query (gconstpointer data) @@ -6,6 +6,15 @@
#define QUERY_STRING1
#define QUERY_STRING2
+/* Pick a locale category to set and test. */
+#ifdef LC_ADDRESS
+/* LC_ADDRESS is a GNU extension. */
+#define CATEGORY LC_ADDRESS
+#else
+/* Mimic the fallback branch in EBookQuery. */
+#define CATEGORY LC_MESSAGES
+#endif /* LC_ADDRESS */
+
typedef struct {
EBookQuery *query;
gchar *locale;
@@ -37,7 +46,7 @@ test_query (gconstpointer data)
EBookQuery *query; EBookQuery *query;
gchar *sexp; gchar *sexp;
+#if 0 - setlocale (LC_ADDRESS, test->locale);
setlocale (LC_ADDRESS, test->locale); + g_assert (setlocale (CATEGORY, test->locale) != NULL);
+#endif
sexp = e_book_query_to_string (test->query); sexp = e_book_query_to_string (test->query);
normalize_space (sexp); normalize_space (sexp);
@@ -74,7 +76,9 @@ add_query_test (const gchar *path, @@ -74,7 +83,7 @@ add_query_test (const gchar *path,
{ {
TestData *data = g_slice_new (TestData); TestData *data = g_slice_new (TestData);
+#if 0 - data->locale = g_strdup (setlocale (LC_ADDRESS, NULL));
data->locale = g_strdup (setlocale (LC_ADDRESS, NULL)); + data->locale = g_strdup (setlocale (CATEGORY, NULL));
+#endif
data->sexp = g_strdup (sexp); data->sexp = g_strdup (sexp);
data->query = query; data->query = query;
@@ -90,7 +94,9 @@ main (gint argc, @@ -90,8 +99,6 @@ main (gint argc,
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/"); g_test_bug_base ("http://bugzilla.gnome.org/");
+#if 0 - setlocale (LC_ADDRESS, "en_US.UTF-8");
setlocale (LC_ADDRESS, "en_US.UTF-8"); -
+#endif
add_query_test ( add_query_test (
"/libebook/test-query/sexp/all", "/libebook/test-query/sexp/all",
@@ -187,7 +193,9 @@ main (gint argc, e_book_query_any_field_contains (NULL),
" (eqphone_short \"phone\" \"5423789\" \"en_US.UTF-8\")" @@ -166,49 +173,57 @@ main (gint argc,
" )"); "5423789"),
"(endswith \"phone\" \"5423789\")");
+#if 0 - add_query_test (
setlocale (LC_ADDRESS, "en_GB.UTF-8"); - "/libebook/test-query/sexp/eqphone/us",
+#endif - e_book_query_orv (
- e_book_query_field_test (
- E_CONTACT_TEL,
- E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
- "+1-2215423789"),
- e_book_query_field_test (
- E_CONTACT_TEL,
- E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
- "2215423789"),
- e_book_query_field_test (
- E_CONTACT_TEL,
- E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER,
- "5423789"),
- NULL),
- "(or (eqphone \"phone\" \"+1-2215423789\" \"en_US.UTF-8\")"
- " (eqphone_national \"phone\" \"2215423789\" \"en_US.UTF-8\")"
- " (eqphone_short \"phone\" \"5423789\" \"en_US.UTF-8\")"
- " )");
+ if (setlocale (CATEGORY, "en_US.UTF-8") != NULL) {
+ add_query_test (
+ "/libebook/test-query/sexp/eqphone/us",
+ e_book_query_orv (
+ e_book_query_field_test (
+ E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
+ "+1-2215423789"),
+ e_book_query_field_test (
+ E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
+ "2215423789"),
+ e_book_query_field_test (
+ E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER,
+ "5423789"),
+ NULL),
+ "(or (eqphone \"phone\" \"+1-2215423789\" \"en_US.UTF-8\")"
+ " (eqphone_national \"phone\" \"2215423789\" \"en_US.UTF-8\")"
+ " (eqphone_short \"phone\" \"5423789\" \"en_US.UTF-8\")"
+ " )");
+ } else {
+ g_message ("Failed to set locale to en_US.UTF-8");
+ g_message ("Skipping /libebook/test-query/sexp/eqphone/us");
+ }
add_query_test ( - setlocale (LC_ADDRESS, "en_GB.UTF-8");
"/libebook/test-query/sexp/eqphone/gb", -
- add_query_test (
- "/libebook/test-query/sexp/eqphone/gb",
- e_book_query_orv (
- e_book_query_field_test (
- E_CONTACT_TEL,
- E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
- "+1-2215423789"),
- e_book_query_field_test (
- E_CONTACT_TEL,
- E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
- "2215423789"),
- e_book_query_field_test (
- E_CONTACT_TEL,
- E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER,
- "5423789"),
- NULL),
- "(or (eqphone \"phone\" \"+1-2215423789\" \"en_GB.UTF-8\")"
- " (eqphone_national \"phone\" \"2215423789\" \"en_GB.UTF-8\")"
- " (eqphone_short \"phone\" \"5423789\" \"en_GB.UTF-8\")"
- " )");
+ if (setlocale (CATEGORY, "en_GB.UTF-8") != NULL) {
+ add_query_test (
+ "/libebook/test-query/sexp/eqphone/gb",
+ e_book_query_orv (
+ e_book_query_field_test (
+ E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_PHONE_NUMBER,
+ "+1-2215423789"),
+ e_book_query_field_test (
+ E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER,
+ "2215423789"),
+ e_book_query_field_test (
+ E_CONTACT_TEL,
+ E_BOOK_QUERY_EQUALS_SHORT_PHONE_NUMBER,
+ "5423789"),
+ NULL),
+ "(or (eqphone \"phone\" \"+1-2215423789\" \"en_GB.UTF-8\")"
+ " (eqphone_national \"phone\" \"2215423789\" \"en_GB.UTF-8\")"
+ " (eqphone_short \"phone\" \"5423789\" \"en_GB.UTF-8\")"
+ " )");
+ } else {
+ g_message ("Failed to set locale to en_GB.UTF-8");
+ g_message ("Skipping /libebook/test-query/sexp/eqphone/gb");
+ }
return g_test_run ();
}

View File

@ -1,14 +1,18 @@
$OpenBSD: patch-tests_libebook_client_test-client-custom-summary_c,v 1.2 2013/04/14 16:21:20 ajacoutot Exp $ $OpenBSD: patch-tests_libebook_client_test-client-custom-summary_c,v 1.3 2013/04/17 17:31:06 ajacoutot Exp $
XXX fix and push upstream From 0076314596c1c0315884a181b9ae9daa21d38840 Mon Sep 17 00:00:00 2001
From: Matthew Barnes <mbarnes@redhat.com>
Date: Wed, 17 Apr 2013 14:37:13 +0000
Subject: LC_ADDRESS is a GNU extension. Treat it as such.
--- tests/libebook/client/test-client-custom-summary.c.orig Sun Apr 14 16:32:35 2013 --- tests/libebook/client/test-client-custom-summary.c.orig Sun Apr 14 16:32:35 2013
+++ tests/libebook/client/test-client-custom-summary.c Sun Apr 14 18:05:44 2013 +++ tests/libebook/client/test-client-custom-summary.c Wed Apr 17 19:12:31 2013
@@ -343,7 +343,9 @@ main (gint argc, @@ -343,7 +343,10 @@ main (gint argc,
g_setenv ("LC_ALL", "en_US.UTF-8", TRUE); g_setenv ("LC_ALL", "en_US.UTF-8", TRUE);
setlocale (LC_ALL, ""); setlocale (LC_ALL, "");
+#if 0 +#if defined (LC_ADDRESS)
+ /* LC_ADDRESS is a GNU extension. */
g_assert_cmpstr (setlocale (LC_ADDRESS, NULL), ==, "en_US.UTF-8"); g_assert_cmpstr (setlocale (LC_ADDRESS, NULL), ==, "en_US.UTF-8");
+#endif +#endif