From 8364086c0e499802d37d7a52ed295cf8c3014eb8 Mon Sep 17 00:00:00 2001
From: Balint Reczey <rbalint@gaia.sz13.dyndns.org>
Date: Tue, 22 Apr 2014 20:58:00 +0200
Subject: [PATCH 1/3] Add hardened-amd64 architecture

Use the new GNU name linux-gnuhardened for the hardened-amd64 arch.
Also extend tests to cover the new arch
---
 lib/dpkg/test/t-arch.c |  3 ++-
 ostable                |  1 +
 scripts/t/Dpkg_Arch.t  | 15 ++++++++++++++-
 triplettable           |  1 +
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/lib/dpkg/test/t-arch.c b/lib/dpkg/test/t-arch.c
index 6078be4..3326c40 100644
--- a/lib/dpkg/test/t-arch.c
+++ b/lib/dpkg/test/t-arch.c
@@ -44,6 +44,7 @@ test_dpkg_arch_name_is_illegal(void)
 	/* Test valid architecture names. */
 	test_pass(dpkg_arch_name_is_illegal("i386") == NULL);
 	test_pass(dpkg_arch_name_is_illegal("amd64") == NULL);
+	test_pass(dpkg_arch_name_is_illegal("hardened-amd64") == NULL);
 	test_pass(dpkg_arch_name_is_illegal("hurd-i386") == NULL);
 	test_pass(dpkg_arch_name_is_illegal("kfreebsd-i386") == NULL);
 	test_pass(dpkg_arch_name_is_illegal("kfreebsd-amd64") == NULL);
@@ -212,7 +213,7 @@ test_dpkg_arch_describe(void)
 void
 test(void)
 {
-	test_plan(60);
+	test_plan(61);
 
 	test_dpkg_arch_name_is_illegal();
 	test_dpkg_arch_get_list();
diff --git a/ostable b/ostable
index 9f559bf..c3f5500 100644
--- a/ostable
+++ b/ostable
@@ -24,6 +24,7 @@ gnuspe-linux		linux-gnuspe		linux[^-]*-gnuspe
 gnux32-linux		linux-gnux32		linux[^-]*-gnux32
 gnulp-linux		linux-gnulp		linux[^-]*-gnulp
 gnu-linux		linux-gnu		linux[^-]*(-gnu.*)?
+gnuhardened-linux	linux-gnuhardened	linux[^-]*(-gnu.*)?
 gnu-kfreebsd		kfreebsd-gnu		kfreebsd[^-]*(-gnu.*)?
 gnu-knetbsd		knetbsd-gnu		knetbsd[^-]*(-gnu.*)?
 gnu-kopensolaris	kopensolaris-gnu	kopensolaris[^-]*(-gnu.*)?
diff --git a/scripts/t/Dpkg_Arch.t b/scripts/t/Dpkg_Arch.t
index 91759ec..dc15966 100644
--- a/scripts/t/Dpkg_Arch.t
+++ b/scripts/t/Dpkg_Arch.t
@@ -13,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
-use Test::More tests => 42;
+use Test::More tests => 54;
 
 use strict;
 use warnings;
@@ -41,11 +41,17 @@ is(debarch_to_multiarch('i386'), 'i386-linux-gnu',
    'normalized i386 multiarch triplet');
 is(debarch_to_multiarch('amd64'), 'x86_64-linux-gnu',
    'normalized amd64 multiarch triplet');
+is(debarch_to_multiarch('hardened-amd64'), 'x86_64-linux-gnuhardened',
+   'normalized hardened-amd64 multiarch triplet');
 
 ok(!debarch_eq('amd64', 'i386'), 'no match, simple arch');
+ok(!debarch_eq('hardened-amd64', 'i386'), 'no match, simple arch');
 ok(!debarch_eq('', 'amd64'), 'no match, empty first arch');
+ok(!debarch_eq('', 'hardened-amd64'), 'no match, empty first arch');
 ok(!debarch_eq('amd64', ''), 'no match, empty second arch');
+ok(!debarch_eq('hardened-amd64', ''), 'no match, empty second arch');
 ok(!debarch_eq('amd64', 'unknown'), 'no match, with first unknown arch');
+ok(!debarch_eq('hardened-amd64', 'unknown'), 'no match, with first unknown arch');
 ok(!debarch_eq('unknown', 'i386'), 'no match, second unknown arch');
 ok(debarch_eq('unknown', 'unknown'), 'match equal unknown arch');
 ok(debarch_eq('amd64', 'amd64'), 'match equal known arch');
@@ -54,11 +60,16 @@ ok(debarch_eq('amd64', 'linux-amd64'), 'match implicit linux arch');
 ok(!debarch_is('unknown', 'linux-any'), 'no match unknown on wildcard cpu');
 ok(!debarch_is('unknown', 'any-amd64'), 'no match unknown on wildcard os');
 ok(!debarch_is('amd64', 'unknown'), 'no match amd64 on unknown wildcard');
+ok(!debarch_is('hardened-amd64', 'unknown'), 'no match amd64 on unknown wildcard');
 ok(!debarch_is('amd64', 'unknown-any'), 'no match amd64 on unknown wildcard');
+ok(!debarch_is('hardened-amd64', 'unknown-any'), 'no match amd64 on unknown wildcard');
 ok(!debarch_is('amd64', 'any-unknown'), 'no match amd64 on unknown wildcard');
+ok(!debarch_is('hardened-amd64', 'any-unknown'), 'no match amd64 on unknown wildcard');
 ok(debarch_is('unknown', 'any'), 'match unknown on global wildcard');
 ok(debarch_is('amd64', 'linux-any'), 'match amd64 on wildcard cpu');
 ok(debarch_is('amd64', 'any-amd64'), 'match amd64 on wildcard os');
+ok(debarch_is('hardened-amd64', 'linux-any'), 'match hardened-amd64 on wildcard cpu');
+ok(debarch_is('hardened-amd64', 'any-amd64'), 'match hardened-amd64 on wildcard os');
 ok(debarch_is('x32', 'any-amd64'), 'match x32 on amd64 wildcard os');
 ok(debarch_is('i386', 'any-i386'), 'match i386 on i386 wildcard os');
 ok(debarch_is('arm', 'any-arm'), 'match arm on arm wildcard os');
@@ -66,6 +77,7 @@ ok(debarch_is('armel', 'any-arm'), 'match armel on arm wildcard os');
 ok(debarch_is('armhf', 'any-arm'), 'match armhf on arm wildcard os');
 
 ok(debarch_is('amd64', 'gnu-any-any'), 'match amd64 on abi wildcard');
+ok(debarch_is('hardened-amd64', 'gnuhardened-any-any'), 'match hardened-amd64 on abi wildcard');
 ok(debarch_is('linux-amd64', 'gnu-any-any'),
    'match linux-amd64 on abi wildcard');
 ok(debarch_is('kfreebsd-amd64', 'gnu-any-any'),
@@ -74,6 +86,7 @@ ok(debarch_is('kfreebsd-amd64', 'gnu-any-any'),
 ok(!debarch_is_wildcard('unknown'), 'unknown is not a wildcard');
 ok(!debarch_is_wildcard('all'), 'all is not a wildcard');
 ok(!debarch_is_wildcard('amd64'), '<arch> is not a wildcard');
+ok(!debarch_is_wildcard('hardened-amd64'), '<arch> is not a wildcard');
 ok(debarch_is_wildcard('any'), '<any> is a global wildcard');
 ok(debarch_is_wildcard('any-any'), '<any>-<any> is a wildcard');
 ok(debarch_is_wildcard('any-any-any'), '<any>-<any>-<any> is a wildcard');
diff --git a/triplettable b/triplettable
index a741fcf..efadc36 100644
--- a/triplettable
+++ b/triplettable
@@ -17,6 +17,7 @@ gnuspe-linux-powerpc	powerpcspe
 gnux32-linux-amd64	x32
 gnulp-linux-i386	lpia
 gnu-linux-<cpu>		<cpu>
+gnuhardened-linux-amd64	hardened-amd64
 gnu-kfreebsd-<cpu>	kfreebsd-<cpu>
 gnu-knetbsd-<cpu>	knetbsd-<cpu>
 gnu-kopensolaris-<cpu>	kopensolaris-<cpu>
-- 
2.1.0

