- Use a better patch to find the UTF8 locale for t0251

This commit is contained in:
Brian C. Lane 2014-08-13 13:59:06 -07:00
parent 06fca52438
commit 2edf16c913
3 changed files with 50 additions and 35 deletions

View File

@ -1,33 +0,0 @@
From 9489285380f256bb8072d5e24cecf906b80994b9 Mon Sep 17 00:00:00 2001
From: Fedora Ninjas <parted-owner@fedoraproject.org>
Date: Wed, 30 Jul 2014 07:48:49 -0700
Subject: [PATCH] tests: Fall back to C.UTF-8 if no en_US available
Not all distributions (Fedora) have C.UTF-8 so first try en_US and fall
back to it. This may still fail if neither exist.
* tests/t0251-gpt-unicode.sh: Test for en_US and fall back to C.UTF-8
---
tests/t0251-gpt-unicode.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh
index c845950..a51f541 100755
--- a/tests/t0251-gpt-unicode.sh
+++ b/tests/t0251-gpt-unicode.sh
@@ -22,7 +22,11 @@ dev=loop-file
# create zeroed device
truncate -s 10m $dev || fail=1
-export LC_ALL=C.UTF-8
+if [ -e "/usr/share/locale/en_US/" ]; then
+ export LC_ALL=en_US.UTF-8
+else
+ export LC_ALL=C.UTF-8
+fi
# create gpt label with named partition
part_name=$(printf 'foo\341\264\244')
parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 $part_name > empty 2>&1 || fail=1
--
1.9.3

View File

@ -0,0 +1,45 @@
From e73c27f435017e22a68383255f15ebaa562dd414 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Wed, 13 Aug 2014 13:40:28 -0700
Subject: [PATCH] tests: Try several UTF8 locales
Not all distributions (Fedora) have C.UTF-8 so try several (en_US, de_DE,
fr_FR, es_ES). This may still fail if none exist.
* tests/t0251-gpt-unicode.sh: Test for en_US de_DE fr_FR es_ES
---
tests/t0251-gpt-unicode.sh | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/tests/t0251-gpt-unicode.sh b/tests/t0251-gpt-unicode.sh
index c845950..537aaa1 100755
--- a/tests/t0251-gpt-unicode.sh
+++ b/tests/t0251-gpt-unicode.sh
@@ -22,7 +22,23 @@ dev=loop-file
# create zeroed device
truncate -s 10m $dev || fail=1
-export LC_ALL=C.UTF-8
+found_locale=no
+for locale in en_US de_DE fr_FR es_ES
+do
+ LC_ALL="$locale.utf8"
+
+ # In a UTF-8 locale, the string below prints as 4 characters.
+ if [ `printf 'foo\341\264\244' | wc -m` -eq 4 ]; then
+ found_locale=yes
+ break
+ fi
+done
+
+if [ "$found_locale" != "yes" ]; then
+ echo "no valid UTF-8 locale found; skipping" >&2
+ exit 77
+fi
+
# create gpt label with named partition
part_name=$(printf 'foo\341\264\244')
parted -s $dev mklabel gpt mkpart primary ext2 1MiB 2MiB name 1 $part_name > empty 2>&1 || fail=1
--
1.9.3

View File

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.2
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@ -14,7 +14,7 @@ Source1: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz.sig
Source2: pubkey.jim.meyering
Source3: pubkey.phillip.susi
Patch0001: 0001-tests-Fall-back-to-C.UTF-8-if-no-en_US-available.patch
Patch0001: 0001-tests-Try-several-UTF8-locales.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel
@ -156,6 +156,9 @@ fi
%changelog
* Wed Aug 13 2014 Brian C. Lane <bcl@redhat.com> 3.2-2
- Use a better patch to find the UTF8 locale for t0251
* Wed Jul 30 2014 Brian C. Lane <bcl@redhat.com> 3.2-1
- Rebase on upstream stable release v3.2
- Drop upstream patches.