summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/libzypp/libzypp/no-builtin-arch.patch
blob: 22dd89c45f2117930a6d08eae9ca8850658d0733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
This patch adds the ${MACHINE_ARCH} and ${PACKAGE_ARCH} to
libzypp available archs, see do_archpatch in .bb for more
details, this is the version for ${BASE_PACKAGE_ARCH} not
recognized in libzypp.

Also "all" is added as a synonym for noarch.

Signed-off-by: Qing He <qing.he@intel.com>

diff --git a/zypp/Arch.cc b/zypp/Arch.cc
index 7b357bb..d4cbca6 100644
--- a/zypp/Arch.cc
+++ b/zypp/Arch.cc
@@ -122,7 +122,13 @@ namespace zypp
 
   /** \relates Arch::CompatEntry */
   inline bool operator==( const Arch::CompatEntry & lhs, const Arch::CompatEntry & rhs )
-  { return lhs._idStr == rhs._idStr; }
+  {
+    if ( (lhs._idStr == "all" && rhs._idStr == "noarch") ||
+         (lhs._idStr == "noarch" && rhs._idStr == "all") )
+      return true;
+    else
+      return lhs._idStr == rhs._idStr;
+  }
   /** \relates Arch::CompatEntry */
   inline bool operator!=( const Arch::CompatEntry & lhs, const Arch::CompatEntry & rhs )
   { return ! ( lhs == rhs ); }
@@ -153,7 +159,7 @@ namespace zypp
     //       bit for each architecture.
     //
 #define DEF_BUILTIN(A) const IdString  _##A( #A );
-    DEF_BUILTIN( noarch );
+    const IdString _noarch( "all" );
 
     DEF_BUILTIN( i386 );
     DEF_BUILTIN( i486 );
@@ -202,6 +208,9 @@ namespace zypp
 
     DEF_BUILTIN( sh4 );
     DEF_BUILTIN( sh4a );
+
+    const IdString _package( "@PKG_ARCH@" );
+    const IdString _machine( "@MACHINE_ARCH@" );
 #undef DEF_BUILTIN
 
     ///////////////////////////////////////////////////////////////////
@@ -326,12 +335,15 @@ namespace zypp
         //
         defCompatibleWith( _sh4,	_noarch );
         defCompatibleWith( _sh4a,	_noarch,_sh4 );
+
+        defCompatibleWith( _package,    _noarch );
+        defCompatibleWith( _machine,    _noarch,_package );
         //
         ///////////////////////////////////////////////////////////////////
         // dumpOn( USR ) << endl;
       }
 
-    private:
+    public:
       /** Return the next avialable _idBit.
        * Ctor injects _noarch into the _compatSet, 1 is for
        * nonbuiltin archs, so we can use <tt>size</tt> for
@@ -440,6 +452,9 @@ namespace zypp
   const Arch Arch_sh4( _sh4 );
   const Arch Arch_sh4a( _sh4a );
 
+  const Arch Arch_package( _package );
+  const Arch Arch_machine( _machine );
+
   ///////////////////////////////////////////////////////////////////
   //
   //	METHOD NAME : Arch::Arch
diff --git a/zypp/Arch.h b/zypp/Arch.h
index 6b18a6e..f91a562 100644
--- a/zypp/Arch.h
+++ b/zypp/Arch.h
@@ -249,6 +249,9 @@ namespace zypp
   extern const Arch Arch_sh4;
   /** \relates Arch */
   extern const Arch Arch_sh4a;
+
+  extern const Arch Arch_package;
+  extern const Arch Arch_machine;
   //@}
 
   ///////////////////////////////////////////////////////////////////
diff --git a/zypp/parser/yum/schema/common-inc.rnc b/zypp/parser/yum/schema/common-inc.rnc
index f12ac3b..04677c3 100644
--- a/zypp/parser/yum/schema/common-inc.rnc
+++ b/zypp/parser/yum/schema/common-inc.rnc
@@ -26,6 +26,7 @@ private.evr =
 private.localizedtext = attribute lang { "en" | "de" }, text
 
 private.archenum = "noarch"
+            | "all"
             | "armv4l"
             | "armv5el"
             | "armv5tel"
@@ -46,4 +47,6 @@ private.archenum = "noarch"
             | "sh4"
             | "x86_64"
             | "src"
+            | "@PKG_ARCH@"
+            | "@MACHINE_ARCH@"
 
diff --git a/zypp/parser/yum/schema/common-inc.rng b/zypp/parser/yum/schema/common-inc.rng
index 60e5742..27694aa 100644
--- a/zypp/parser/yum/schema/common-inc.rng
+++ b/zypp/parser/yum/schema/common-inc.rng
@@ -89,6 +89,7 @@
   <define name="private.archenum">
     <choice>
       <value>noarch</value>
+      <value>all</value>
       <value>armv4l</value>
       <value>armv5el</value>
       <value>armv5tel</value>
@@ -109,6 +110,8 @@
       <value>sh4</value>
       <value>x86_64</value>
       <value>src</value>
+      <value>@PKG_ARCH@</value>
+      <value>@MACHINE_ARCH@</value>
     </choice>
   </define>
 </grammar>