npm-pkgbuild 10.19.9 → 10.20.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "10.19.9",
3
+ "version": "10.20.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -113,6 +113,10 @@ export async function* extractFromPackage(options = {}, env = {}) {
113
113
  ? [packageContent.pkgbuild]
114
114
  : []) {
115
115
  const requires = pkgbuild.requires;
116
+ delete pkgbuild.requires;
117
+
118
+ let priority = 1;
119
+
116
120
  if (requires) {
117
121
  if (requires.properties) {
118
122
  let fullfilled = true;
@@ -125,13 +129,13 @@ export async function* extractFromPackage(options = {}, env = {}) {
125
129
  if (!fullfilled) {
126
130
  continue;
127
131
  }
128
- delete pkgbuild.requires;
129
132
  }
130
133
 
131
134
  if (requires.environment) {
132
135
  if (env[requires.environment.has] === undefined) {
133
136
  continue;
134
137
  }
138
+ priority++;
135
139
  }
136
140
  }
137
141
 
@@ -139,7 +143,8 @@ export async function* extractFromPackage(options = {}, env = {}) {
139
143
  name: `${packageContent.name}[${i++}]`,
140
144
  depends: packageContent.engines || {},
141
145
  arch: new Set(),
142
- restrictArch: new Set()
146
+ restrictArch: new Set(),
147
+ priority
143
148
  };
144
149
 
145
150
  if (packageContent.cpu) {
@@ -221,7 +226,6 @@ export async function* extractFromPackage(options = {}, env = {}) {
221
226
  fragments[fragment.name] = fragment;
222
227
 
223
228
  if (pkgbuild.variant) {
224
- fragment.priority = 1;
225
229
  variants[pkgbuild.variant] = fragment;
226
230
  }
227
231
 
@@ -241,7 +245,9 @@ export async function* extractFromPackage(options = {}, env = {}) {
241
245
  //console.log("FRAGMENTS", Object.keys(fragments));
242
246
  //console.log("VARIANTS", variants);
243
247
 
244
- for (const [name, variant] of Object.entries(variants)) {
248
+ for (const [name, variant] of Object.entries(variants).sort(
249
+ ([ua, a], [ub, b]) => a.priority - b.priority
250
+ )) {
245
251
  let arch = variant.arch;
246
252
  const properties = {};
247
253
  const depends = {};
@@ -72,7 +72,7 @@ program
72
72
  for (const outputFactory of allOutputs.filter(
73
73
  o => options[o.name] === true || output[o.name] !== undefined
74
74
  )) {
75
- if (options.available && !(await outputFactory.prepare)) {
75
+ if (options.available && !(await outputFactory.prepare(options))) {
76
76
  continute;
77
77
  }
78
78
 
@@ -74,25 +74,28 @@ export class ARCH extends Packager {
74
74
  return fields;
75
75
  }
76
76
 
77
- static async prepare() {
78
- if(_prepared === undefined) {
79
- try {
80
- await execa("makepkg", ["-V"]);
81
-
82
- const cfg = await readFile("/etc/makepkg.conf", utf8StreamOptions);
83
- const i = cfg.indexOf("PKGEXT='");
84
- if (i > 0) {
85
- const m = cfg
86
- .substring(i)
87
- .split(/\n/)[0]
88
- .match(/='([^']+)'/);
89
- _ext = m[1];
77
+ static async prepare(options) {
78
+ if (_prepared === undefined) {
79
+ try {
80
+ await execa("makepkg", ["-V"]);
81
+
82
+ const cfg = await readFile("/etc/makepkg.conf", utf8StreamOptions);
83
+ if(options.verbose) {
84
+ console.log(cfg);
85
+ }
86
+ const i = cfg.indexOf("PKGEXT='");
87
+ if (i > 0) {
88
+ const m = cfg
89
+ .substring(i)
90
+ .split(/\n/)[0]
91
+ .match(/='([^']+)'/);
92
+ _ext = m[1];
93
+ }
94
+ _prepared = true;
95
+ } catch {
96
+ _prepared = false;
90
97
  }
91
- _prepared = true;
92
- } catch {
93
- _prepared = false;
94
98
  }
95
- }
96
99
  return _prepared;
97
100
  }
98
101