npm-pkgbuild 11.1.17 → 11.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/npm-pkgbuild-cli.mjs +17 -8
- package/src/output/arch.mjs +16 -12
package/package.json
CHANGED
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -36,7 +36,11 @@ program
|
|
|
36
36
|
Object.assign(former, Object.fromEntries([str.split(/=/)]))
|
|
37
37
|
)
|
|
38
38
|
.option("-p --dir <dir>", "which package to use", process.cwd())
|
|
39
|
-
.option(
|
|
39
|
+
.option(
|
|
40
|
+
"-a --available",
|
|
41
|
+
"only execute availabe output/arch combintions",
|
|
42
|
+
false
|
|
43
|
+
)
|
|
40
44
|
.option("--continue", "continue on error")
|
|
41
45
|
.option(
|
|
42
46
|
"-c --content <dir>",
|
|
@@ -72,7 +76,10 @@ program
|
|
|
72
76
|
for (const outputFactory of allOutputs.filter(
|
|
73
77
|
o => options[o.name] === true || output[o.name] !== undefined
|
|
74
78
|
)) {
|
|
75
|
-
if (
|
|
79
|
+
if (
|
|
80
|
+
options.available &&
|
|
81
|
+
!(await outputFactory.prepare(options, variant))
|
|
82
|
+
) {
|
|
76
83
|
continute;
|
|
77
84
|
}
|
|
78
85
|
|
|
@@ -127,11 +134,11 @@ program
|
|
|
127
134
|
|
|
128
135
|
if (options.verbose) {
|
|
129
136
|
console.log("variant:");
|
|
130
|
-
console.log(kv(variant," "));
|
|
137
|
+
console.log(kv(variant, " "));
|
|
131
138
|
console.log("sources:");
|
|
132
139
|
console.log(" " + sources.join("\n "));
|
|
133
140
|
console.log("dependencies:");
|
|
134
|
-
console.log(kv(dependencies," "));
|
|
141
|
+
console.log(kv(dependencies, " "));
|
|
135
142
|
console.log(kv(output.properties));
|
|
136
143
|
}
|
|
137
144
|
|
|
@@ -166,8 +173,10 @@ function handleError(e, options) {
|
|
|
166
173
|
}
|
|
167
174
|
}
|
|
168
175
|
|
|
169
|
-
function kv(object, prefix="") {
|
|
170
|
-
return object
|
|
171
|
-
.
|
|
172
|
-
|
|
176
|
+
function kv(object, prefix = "") {
|
|
177
|
+
return object
|
|
178
|
+
? Object.entries(object)
|
|
179
|
+
.map(([k, v]) => `${prefix}${k}: ${v}`)
|
|
180
|
+
.join("\n")
|
|
181
|
+
: "";
|
|
173
182
|
}
|
package/src/output/arch.mjs
CHANGED
|
@@ -56,6 +56,7 @@ const PKGBUILD = "PKGBUILD";
|
|
|
56
56
|
|
|
57
57
|
let _ext = ".pkg.tar.xz";
|
|
58
58
|
let _prepared;
|
|
59
|
+
let _architecture = "aarch64";
|
|
59
60
|
|
|
60
61
|
export class ARCH extends Packager {
|
|
61
62
|
static get name() {
|
|
@@ -74,7 +75,7 @@ export class ARCH extends Packager {
|
|
|
74
75
|
return fields;
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
static async prepare(options) {
|
|
78
|
+
static async prepare(options, variant) {
|
|
78
79
|
if (_prepared === undefined) {
|
|
79
80
|
try {
|
|
80
81
|
await execa("makepkg", ["-V"]);
|
|
@@ -83,20 +84,25 @@ export class ARCH extends Packager {
|
|
|
83
84
|
if (options.verbose) {
|
|
84
85
|
console.log(cfg);
|
|
85
86
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
|
|
88
|
+
function getValue(key) {
|
|
89
|
+
const i = cfg.indexOf(`${key}='`);
|
|
90
|
+
if (i > 0) {
|
|
91
|
+
const m = cfg
|
|
92
|
+
.substring(i)
|
|
93
|
+
.split(/\n/)[0]
|
|
94
|
+
.match(/='([^'"]+)['"]/);
|
|
95
|
+
return m[1];
|
|
96
|
+
}
|
|
93
97
|
}
|
|
98
|
+
_ext = getValue("PKGEXT");
|
|
99
|
+
_architecture = getValue("CARCH");
|
|
94
100
|
_prepared = true;
|
|
95
101
|
} catch {
|
|
96
102
|
_prepared = false;
|
|
97
103
|
}
|
|
98
104
|
}
|
|
99
|
-
return _prepared;
|
|
105
|
+
return _prepared && !variant || variant.arch === _architecture;
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
get packageFileName() {
|
|
@@ -172,9 +178,7 @@ package() {
|
|
|
172
178
|
}
|
|
173
179
|
|
|
174
180
|
if (options.verbose) {
|
|
175
|
-
console.log(
|
|
176
|
-
await readFile(join(staging, PKGBUILD), utf8StreamOptions)
|
|
177
|
-
);
|
|
181
|
+
console.log(await readFile(join(staging, PKGBUILD), utf8StreamOptions));
|
|
178
182
|
}
|
|
179
183
|
|
|
180
184
|
if (!options.dry) {
|