npm-pkgbuild 10.1.0 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/extract-from-package.mjs +19 -8
package/package.json
CHANGED
|
@@ -44,6 +44,7 @@ const entryAttributeNames = ["owner", "group", "mode"];
|
|
|
44
44
|
* - for each architecture deliver a new result
|
|
45
45
|
* - if not architecture is given one result set is provided nethertheless
|
|
46
46
|
* - architectures are taken from cpu (node arch ids) and from pkgbuild.arch (raw arch ids)
|
|
47
|
+
* - architecture given in a abstract definition are used to reduce the set of avaliable architectures
|
|
47
48
|
* @param {Object} pkg package.json content
|
|
48
49
|
* @param {string} dir
|
|
49
50
|
* @returns {AsyncIter<PackageDefinition>}
|
|
@@ -96,17 +97,25 @@ export async function* extractFromPackage(json, dir) {
|
|
|
96
97
|
let sources = [];
|
|
97
98
|
let output = {};
|
|
98
99
|
let arch = new Set();
|
|
99
|
-
|
|
100
|
+
let restrictArch = new Set();
|
|
101
|
+
|
|
100
102
|
const processPkg = (json, dir, modulePath) => {
|
|
101
103
|
const pkg = json.pkgbuild;
|
|
102
104
|
|
|
103
105
|
if (pkg) {
|
|
104
|
-
if
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
if(!modulePath) {
|
|
107
|
+
if (json.cpu) {
|
|
108
|
+
for (const a of asArray(json.cpu)) {
|
|
109
|
+
arch.add(npmArchMapping[a]);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if(pkg.arch) {
|
|
113
|
+
for(const a of asArray(pkg.arch)) {
|
|
114
|
+
arch.add(a);
|
|
115
|
+
}
|
|
107
116
|
}
|
|
108
117
|
}
|
|
109
|
-
|
|
118
|
+
|
|
110
119
|
if (pkg.abstract || !modulePath) {
|
|
111
120
|
if (pkg.variant) {
|
|
112
121
|
variant = pkg.variant;
|
|
@@ -114,7 +123,7 @@ export async function* extractFromPackage(json, dir) {
|
|
|
114
123
|
|
|
115
124
|
if (pkg.arch) {
|
|
116
125
|
for (const a of asArray(pkg.arch)) {
|
|
117
|
-
|
|
126
|
+
restrictArch.add(a);
|
|
118
127
|
}
|
|
119
128
|
}
|
|
120
129
|
|
|
@@ -178,8 +187,10 @@ export async function* extractFromPackage(json, dir) {
|
|
|
178
187
|
if (arch.size > 0) {
|
|
179
188
|
// provide each arch separadly
|
|
180
189
|
for (const a of arch) {
|
|
181
|
-
|
|
182
|
-
|
|
190
|
+
if(!restrictArch.size || restrictArch.has(a)) {
|
|
191
|
+
properties.arch = [a];
|
|
192
|
+
yield { properties, sources, dependencies, output, variant };
|
|
193
|
+
}
|
|
183
194
|
}
|
|
184
195
|
} else {
|
|
185
196
|
// or one set if no arch is given
|