npm-pkgbuild 7.22.9 → 7.23.2
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 +1 -1
- package/src/npm-pkgbuild-cli.mjs +2 -2
- package/src/output/rpm.mjs +48 -31
package/package.json
CHANGED
package/src/npm-pkgbuild-cli.mjs
CHANGED
|
@@ -53,7 +53,7 @@ program
|
|
|
53
53
|
let values = value.split(/,/);
|
|
54
54
|
if (values.length > 1) {
|
|
55
55
|
values = values.map(v => process.env[v] || v);
|
|
56
|
-
return { url:
|
|
56
|
+
return { url: values[0], user: values[1], password: values[2] };
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
return { url: value };
|
|
@@ -129,7 +129,7 @@ program
|
|
|
129
129
|
|
|
130
130
|
if (options.verbose) {
|
|
131
131
|
console.log(output.properties);
|
|
132
|
-
console.log(`sources: ${sources}`);
|
|
132
|
+
console.log(`sources: ${sources.join('\n ')}`);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
const fileName = await output.execute(
|
package/src/output/rpm.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { join } from "path";
|
|
2
|
+
import { createReadStream } from "fs";
|
|
2
3
|
import { cp } from "fs/promises";
|
|
3
4
|
import { execa } from "execa";
|
|
4
5
|
import { EmptyContentEntry, ReadableStreamContentEntry } from "content-entry";
|
|
@@ -8,7 +9,22 @@ import {
|
|
|
8
9
|
colonSeparatedKeyValuePairOptions
|
|
9
10
|
} from "key-value-transformer";
|
|
10
11
|
import { Packager } from "./packager.mjs";
|
|
11
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
copyEntries,
|
|
14
|
+
fieldProvider,
|
|
15
|
+
utf8StreamOptions,
|
|
16
|
+
extractFunctions
|
|
17
|
+
} from "../util.mjs";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* map install hook named from arch to rpm
|
|
21
|
+
*/
|
|
22
|
+
const hookMapping = {
|
|
23
|
+
pre_instll: "pre",
|
|
24
|
+
post_install: "post",
|
|
25
|
+
pre_remove: "preun",
|
|
26
|
+
post_remove: "postun"
|
|
27
|
+
};
|
|
12
28
|
|
|
13
29
|
export class RPM extends Packager {
|
|
14
30
|
static get name() {
|
|
@@ -64,29 +80,40 @@ export class RPM extends Packager {
|
|
|
64
80
|
|
|
65
81
|
async function* trailingLines() {
|
|
66
82
|
yield "%define _unpackaged_files_terminate_build 0\n";
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
)
|
|
82
|
-
if (options.verbose) {
|
|
83
|
-
console.log(file.destination);
|
|
84
|
-
}
|
|
85
|
-
yield file.destination + "\n";
|
|
86
|
-
}
|
|
83
|
+
yield `%description\n\n`;
|
|
84
|
+
|
|
85
|
+
if (properties.hooks) {
|
|
86
|
+
for await (const f of extractFunctions(
|
|
87
|
+
createReadStream(properties.hooks, utf8StreamOptions)
|
|
88
|
+
)) {
|
|
89
|
+
const name = hookMapping[f.name];
|
|
90
|
+
if (name) {
|
|
91
|
+
yield `%${name}\n`;
|
|
92
|
+
|
|
93
|
+
yield f.body.replace(
|
|
94
|
+
/\{\{(\w+)\}\}/m,
|
|
95
|
+
(match, key, offset, string) =>
|
|
96
|
+
properties[key] || "{{" + key + "}}"
|
|
97
|
+
) + "\n\n";
|
|
87
98
|
}
|
|
88
99
|
}
|
|
89
100
|
}
|
|
101
|
+
|
|
102
|
+
yield `%files\n\n`;
|
|
103
|
+
for (const file of files) {
|
|
104
|
+
yield "/" + file + "\n";
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
for await (const file of copyEntries(
|
|
108
|
+
transform(sources, transformer),
|
|
109
|
+
staging,
|
|
110
|
+
expander
|
|
111
|
+
)) {
|
|
112
|
+
if (options.verbose) {
|
|
113
|
+
console.log(file.destination);
|
|
114
|
+
}
|
|
115
|
+
yield file.destination + "\n";
|
|
116
|
+
}
|
|
90
117
|
}
|
|
91
118
|
|
|
92
119
|
const fp = fieldProvider(properties, fields);
|
|
@@ -159,13 +186,3 @@ const fields = {
|
|
|
159
186
|
URL: { alias: "homepage", type: "string" },
|
|
160
187
|
Requires: { type: "string[]" }
|
|
161
188
|
};
|
|
162
|
-
|
|
163
|
-
const sections = {
|
|
164
|
-
description: { mandatory: true },
|
|
165
|
-
prep: { mandatory: false },
|
|
166
|
-
build: { mandatory: false },
|
|
167
|
-
install: { mandatory: false },
|
|
168
|
-
check: { mandatory: false },
|
|
169
|
-
files: { mandatory: true },
|
|
170
|
-
changelog: { mandatory: false }
|
|
171
|
-
};
|