npm-pkgbuild 17.3.4 → 17.5.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/README.md +55 -55
- package/package.json +1 -1
- package/src/content/content-provider.mjs +4 -14
- package/src/content/file-content-provider.mjs +6 -10
- package/src/content/file-system-entry-with-permissions.mjs +18 -0
- package/src/content/nft-content-provider.mjs +9 -13
- package/src/content/node-modules-content-provider.mjs +10 -6
- package/src/content/npm-pack-content-provider.mjs +36 -29
- package/src/output/arch.mjs +33 -4
- package/src/util.mjs +4 -6
- package/types/content/content-provider.d.mts +2 -2
- package/types/content/file-content-provider.d.mts +2 -1
- package/types/content/file-system-entry-with-permissions.d.mts +7 -0
- package/types/content/nft-content-provider.d.mts +2 -1
package/README.md
CHANGED
|
@@ -99,24 +99,25 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
|
|
|
99
99
|
* [Properties](#properties)
|
|
100
100
|
* [extractFromPackage](#extractfrompackage)
|
|
101
101
|
* [Parameters](#parameters-1)
|
|
102
|
-
* [
|
|
102
|
+
* [BUILDAH](#buildah)
|
|
103
|
+
* [ContentProvider](#contentprovider)
|
|
103
104
|
* [Parameters](#parameters-2)
|
|
104
105
|
* [Properties](#properties-1)
|
|
106
|
+
* [asyncIterator](#asynciterator)
|
|
107
|
+
* [FileContentProvider](#filecontentprovider)
|
|
108
|
+
* [Parameters](#parameters-3)
|
|
105
109
|
* [name](#name)
|
|
106
110
|
* [NodeModulesContentProvider](#nodemodulescontentprovider)
|
|
107
|
-
* [Parameters](#parameters-
|
|
111
|
+
* [Parameters](#parameters-4)
|
|
108
112
|
* [Properties](#properties-2)
|
|
109
113
|
* [name](#name-1)
|
|
110
|
-
* [
|
|
111
|
-
* [Parameters](#parameters-
|
|
114
|
+
* [NPMPackContentProvider](#npmpackcontentprovider)
|
|
115
|
+
* [Parameters](#parameters-5)
|
|
116
|
+
* [Properties](#properties-3)
|
|
112
117
|
* [name](#name-2)
|
|
113
118
|
* [NFTContentProvider](#nftcontentprovider)
|
|
114
|
-
* [Parameters](#parameters-5)
|
|
115
|
-
* [name](#name-3)
|
|
116
|
-
* [ContentProvider](#contentprovider)
|
|
117
119
|
* [Parameters](#parameters-6)
|
|
118
|
-
* [
|
|
119
|
-
* [asyncIterator](#asynciterator)
|
|
120
|
+
* [name](#name-3)
|
|
120
121
|
* [DEBIAN](#debian)
|
|
121
122
|
* [hookMapping](#hookmapping)
|
|
122
123
|
* [prepare](#prepare)
|
|
@@ -125,18 +126,17 @@ See [mf-hosting](https://www.npmjs.com/package/mf-hosting) or [mf-hosting-fronte
|
|
|
125
126
|
* [fields](#fields-1)
|
|
126
127
|
* [fields](#fields-2)
|
|
127
128
|
* [fields](#fields-3)
|
|
128
|
-
* [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
|
|
129
129
|
* [quoteFile](#quotefile)
|
|
130
130
|
* [Parameters](#parameters-8)
|
|
131
131
|
* [RPM](#rpm)
|
|
132
132
|
* [hookMapping](#hookmapping-1)
|
|
133
133
|
* [prepare](#prepare-1)
|
|
134
134
|
* [Parameters](#parameters-9)
|
|
135
|
+
* [pkgKeyValuePairOptions](#pkgkeyvaluepairoptions)
|
|
135
136
|
* [OCI](#oci)
|
|
136
137
|
* [DOCKER](#docker)
|
|
137
138
|
* [prepare](#prepare-2)
|
|
138
139
|
* [Parameters](#parameters-10)
|
|
139
|
-
* [BUILDAH](#buildah)
|
|
140
140
|
* [Packager](#packager)
|
|
141
141
|
* [Parameters](#parameters-11)
|
|
142
142
|
* [packageName](#packagename)
|
|
@@ -244,20 +244,45 @@ Extract package definition from package.json.
|
|
|
244
244
|
|
|
245
245
|
Returns **AsyncIterable<[PackageDefinition](#packagedefinition)>** 
|
|
246
246
|
|
|
247
|
-
##
|
|
247
|
+
## BUILDAH
|
|
248
248
|
|
|
249
|
-
**Extends
|
|
249
|
+
**Extends DOCKER**
|
|
250
250
|
|
|
251
|
-
|
|
251
|
+
Use buildah @see <https://buildah.io>
|
|
252
|
+
|
|
253
|
+
## ContentProvider
|
|
254
|
+
|
|
255
|
+
Source of package content.
|
|
252
256
|
|
|
253
257
|
### Parameters
|
|
254
258
|
|
|
255
|
-
* `definitions`
|
|
256
|
-
* `entryProperties`
|
|
259
|
+
* `definitions`  
|
|
260
|
+
* `entryProperties`  
|
|
257
261
|
|
|
258
262
|
### Properties
|
|
259
263
|
|
|
260
264
|
* `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
265
|
+
* `transformer` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Transformer>** 
|
|
266
|
+
|
|
267
|
+
### asyncIterator
|
|
268
|
+
|
|
269
|
+
List all entries.
|
|
270
|
+
|
|
271
|
+
Returns **AsyncIterable\<ContentEntry>** all entries
|
|
272
|
+
|
|
273
|
+
## FileContentProvider
|
|
274
|
+
|
|
275
|
+
**Extends ContentProvider**
|
|
276
|
+
|
|
277
|
+
Content provided form the file system.
|
|
278
|
+
|
|
279
|
+
### Parameters
|
|
280
|
+
|
|
281
|
+
* `definitions` **([Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object) | [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String))** 
|
|
282
|
+
|
|
283
|
+
* `definitions.pattern` **([string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) | [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>)** 
|
|
284
|
+
* `definitions.base` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** base directory where to find the files
|
|
285
|
+
* `entryProperties`  
|
|
261
286
|
|
|
262
287
|
### name
|
|
263
288
|
|
|
@@ -283,19 +308,20 @@ Requires .npmrc or NPM\_TOKEN environment
|
|
|
283
308
|
|
|
284
309
|
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
|
|
285
310
|
|
|
286
|
-
##
|
|
311
|
+
## NPMPackContentProvider
|
|
287
312
|
|
|
288
313
|
**Extends ContentProvider**
|
|
289
314
|
|
|
290
|
-
Content
|
|
315
|
+
Content from npm pack.
|
|
291
316
|
|
|
292
317
|
### Parameters
|
|
293
318
|
|
|
294
|
-
* `definitions` **
|
|
319
|
+
* `definitions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** 
|
|
320
|
+
* `entryProperties` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** to be set for each entry
|
|
295
321
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
* `
|
|
322
|
+
### Properties
|
|
323
|
+
|
|
324
|
+
* `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
299
325
|
|
|
300
326
|
### name
|
|
301
327
|
|
|
@@ -319,26 +345,6 @@ Content provided form the file system.
|
|
|
319
345
|
|
|
320
346
|
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** name of the content provider
|
|
321
347
|
|
|
322
|
-
## ContentProvider
|
|
323
|
-
|
|
324
|
-
Source of package content.
|
|
325
|
-
|
|
326
|
-
### Parameters
|
|
327
|
-
|
|
328
|
-
* `definitions`  
|
|
329
|
-
* `entryProperties`  
|
|
330
|
-
|
|
331
|
-
### Properties
|
|
332
|
-
|
|
333
|
-
* `dir` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
334
|
-
* `transformer` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<Transformer>** 
|
|
335
|
-
|
|
336
|
-
### asyncIterator
|
|
337
|
-
|
|
338
|
-
List all entries.
|
|
339
|
-
|
|
340
|
-
Returns **AsyncIterable\<ContentEntry>** all entries
|
|
341
|
-
|
|
342
348
|
## DEBIAN
|
|
343
349
|
|
|
344
350
|
**Extends Packager**
|
|
@@ -367,21 +373,17 @@ Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
367
373
|
|
|
368
374
|
## fields
|
|
369
375
|
|
|
370
|
-
|
|
371
|
-
<https://www.archlinux.org/pacman/PKGBUILD.5.html>
|
|
376
|
+
* **See**: <https://rpm-packaging-guide.github.io>
|
|
372
377
|
|
|
373
378
|
## fields
|
|
374
379
|
|
|
375
|
-
|
|
380
|
+
well known package properties
|
|
381
|
+
<https://www.archlinux.org/pacman/PKGBUILD.5.html>
|
|
376
382
|
|
|
377
383
|
## fields
|
|
378
384
|
|
|
379
385
|
* **See**: <https://docs.docker.com/engine/reference/builder/>
|
|
380
386
|
|
|
381
|
-
## pkgKeyValuePairOptions
|
|
382
|
-
|
|
383
|
-
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
384
|
-
|
|
385
387
|
## quoteFile
|
|
386
388
|
|
|
387
389
|
### Parameters
|
|
@@ -411,6 +413,10 @@ Check for rpmbuild presence.
|
|
|
411
413
|
|
|
412
414
|
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** true when rpmbuild executable is present
|
|
413
415
|
|
|
416
|
+
## pkgKeyValuePairOptions
|
|
417
|
+
|
|
418
|
+
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
|
|
419
|
+
|
|
414
420
|
## OCI
|
|
415
421
|
|
|
416
422
|
**Extends Packager**
|
|
@@ -436,12 +442,6 @@ Check for docker presence.
|
|
|
436
442
|
|
|
437
443
|
Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)>** true when docker executable is present
|
|
438
444
|
|
|
439
|
-
## BUILDAH
|
|
440
|
-
|
|
441
|
-
**Extends DOCKER**
|
|
442
|
-
|
|
443
|
-
Use buildah @see <https://buildah.io>
|
|
444
|
-
|
|
445
445
|
## Packager
|
|
446
446
|
|
|
447
447
|
### Parameters
|
package/package.json
CHANGED
|
@@ -8,22 +8,12 @@ import { ContentEntry } from "content-entry";
|
|
|
8
8
|
export class ContentProvider {
|
|
9
9
|
transformers = [];
|
|
10
10
|
entryProperties;
|
|
11
|
+
directoryProperties;
|
|
11
12
|
dir;
|
|
12
13
|
|
|
13
|
-
constructor(definitions, entryProperties) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
for (const a of ["mode"]) {
|
|
18
|
-
if (this.entryProperties[a] !== undefined) {
|
|
19
|
-
if (!this.baseProperties) {
|
|
20
|
-
this.baseProperties = {};
|
|
21
|
-
}
|
|
22
|
-
this.baseProperties[a] = { value: this.entryProperties[a] };
|
|
23
|
-
delete this.entryProperties[a];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
14
|
+
constructor(definitions, entryProperties, directoryProperties) {
|
|
15
|
+
this.entryProperties = entryProperties;
|
|
16
|
+
this.directoryProperties = directoryProperties;
|
|
27
17
|
}
|
|
28
18
|
|
|
29
19
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dirname, join } from "node:path";
|
|
2
2
|
import { globby } from "globby";
|
|
3
|
-
import {
|
|
3
|
+
import { FileSystemEntryWithPermissions } from "./file-system-entry-with-permissions.mjs";
|
|
4
4
|
import { asArray } from "../util.mjs";
|
|
5
5
|
import { ContentProvider } from "./content-provider.mjs";
|
|
6
6
|
|
|
@@ -24,8 +24,8 @@ export class FileContentProvider extends ContentProvider {
|
|
|
24
24
|
return "use plain files source";
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
constructor(definitions, entryProperties) {
|
|
28
|
-
super(definitions, entryProperties);
|
|
27
|
+
constructor(definitions, entryProperties, directoryProperties) {
|
|
28
|
+
super(definitions, entryProperties, directoryProperties);
|
|
29
29
|
|
|
30
30
|
if (typeof definitions === "string") {
|
|
31
31
|
if (definitions.endsWith("/")) {
|
|
@@ -62,15 +62,11 @@ export class FileContentProvider extends ContentProvider {
|
|
|
62
62
|
for (const name of await globby(definitions.pattern, {
|
|
63
63
|
cwd: base
|
|
64
64
|
})) {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
yield new FileSystemEntryWithPermissions(
|
|
66
|
+
name,
|
|
67
|
+
base,
|
|
67
68
|
this.entryProperties
|
|
68
69
|
);
|
|
69
|
-
|
|
70
|
-
yield this.baseProperties
|
|
71
|
-
? Object.create(entry, this.baseProperties)
|
|
72
|
-
: entry;
|
|
73
|
-
|
|
74
70
|
count++;
|
|
75
71
|
}
|
|
76
72
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FileSystemEntry } from "content-entry-filesystem";
|
|
2
|
+
|
|
3
|
+
export class FileSystemEntryWithPermissions extends FileSystemEntry {
|
|
4
|
+
constructor(name, baseDir, properties) {
|
|
5
|
+
super(name, baseDir);
|
|
6
|
+
Object.assign(this, properties);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#mode;
|
|
10
|
+
|
|
11
|
+
set mode(value) {
|
|
12
|
+
this.#mode = value;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get mode() {
|
|
16
|
+
return this.#mode || super.mode;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { nodeFileTrace } from "@vercel/nft";
|
|
2
|
-
import {
|
|
2
|
+
import { FileSystemEntryWithPermissions } from "./file-system-entry-with-permissions.mjs";
|
|
3
3
|
import { asArray } from "../util.mjs";
|
|
4
4
|
import { ContentProvider } from "./content-provider.mjs";
|
|
5
5
|
|
|
@@ -17,13 +17,12 @@ export class NFTContentProvider extends ContentProvider {
|
|
|
17
17
|
return "nft";
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
static get description()
|
|
21
|
-
|
|
22
|
-
return "user vercels NFT as source"
|
|
20
|
+
static get description() {
|
|
21
|
+
return "user vercels NFT as source";
|
|
23
22
|
}
|
|
24
|
-
|
|
25
|
-
constructor(definitions, entryProperties) {
|
|
26
|
-
super(definitions, entryProperties);
|
|
23
|
+
|
|
24
|
+
constructor(definitions, entryProperties, directoryProperties) {
|
|
25
|
+
super(definitions, entryProperties, directoryProperties);
|
|
27
26
|
|
|
28
27
|
if (typeof definitions === "string") {
|
|
29
28
|
this.definitions = { start: [definitions] };
|
|
@@ -44,14 +43,11 @@ export class NFTContentProvider extends ContentProvider {
|
|
|
44
43
|
const { fileList } = await nodeFileTrace(definitions.start);
|
|
45
44
|
|
|
46
45
|
for (const name of fileList) {
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
yield new FileSystemEntryWithPermissions(
|
|
47
|
+
name,
|
|
48
|
+
base,
|
|
49
49
|
this.entryProperties
|
|
50
50
|
);
|
|
51
|
-
|
|
52
|
-
yield this.baseProperties
|
|
53
|
-
? Object.create(entry, this.baseProperties)
|
|
54
|
-
: entry;
|
|
55
51
|
}
|
|
56
52
|
}
|
|
57
53
|
}
|
|
@@ -5,7 +5,7 @@ import { globby } from "globby";
|
|
|
5
5
|
import Arborist from "@npmcli/arborist";
|
|
6
6
|
import { parse } from "ini";
|
|
7
7
|
import { StringContentEntry } from "content-entry";
|
|
8
|
-
import {
|
|
8
|
+
import { FileSystemEntryWithPermissions } from "./file-system-entry-with-permissions.mjs";
|
|
9
9
|
import { ContentProvider } from "./content-provider.mjs";
|
|
10
10
|
import { utf8StreamOptions } from "../util.mjs";
|
|
11
11
|
import { shrinkNPM } from "../npm-shrink.mjs";
|
|
@@ -29,11 +29,14 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
29
29
|
|
|
30
30
|
withoutDevelpmentDependencies = true;
|
|
31
31
|
|
|
32
|
-
constructor(definitions, entryProperties) {
|
|
33
|
-
if (
|
|
32
|
+
constructor(definitions, entryProperties, directoryProperties) {
|
|
33
|
+
if (
|
|
34
|
+
entryProperties?.destination &&
|
|
35
|
+
!entryProperties.destination.endsWith("/")
|
|
36
|
+
) {
|
|
34
37
|
entryProperties.destination += "/";
|
|
35
38
|
}
|
|
36
|
-
super(definitions, entryProperties);
|
|
39
|
+
super(definitions, entryProperties, directoryProperties);
|
|
37
40
|
Object.assign(this, definitions);
|
|
38
41
|
}
|
|
39
42
|
|
|
@@ -120,8 +123,9 @@ export class NodeModulesContentProvider extends ContentProvider {
|
|
|
120
123
|
console.error(e, name);
|
|
121
124
|
}
|
|
122
125
|
}
|
|
123
|
-
yield
|
|
124
|
-
|
|
126
|
+
yield new FileSystemEntryWithPermissions(
|
|
127
|
+
name,
|
|
128
|
+
nodeModulesDir,
|
|
125
129
|
this.entryProperties
|
|
126
130
|
);
|
|
127
131
|
}
|
|
@@ -25,11 +25,14 @@ export class NPMPackContentProvider extends ContentProvider {
|
|
|
25
25
|
return "use npm pack as source";
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
constructor(definitions, entryProperties) {
|
|
29
|
-
if (
|
|
28
|
+
constructor(definitions, entryProperties, directoryProperties) {
|
|
29
|
+
if (
|
|
30
|
+
entryProperties?.destination &&
|
|
31
|
+
!entryProperties.destination.endsWith("/")
|
|
32
|
+
) {
|
|
30
33
|
entryProperties.destination += "/";
|
|
31
34
|
}
|
|
32
|
-
super(definitions, entryProperties);
|
|
35
|
+
super(definitions, entryProperties, directoryProperties);
|
|
33
36
|
Object.assign(this, definitions);
|
|
34
37
|
}
|
|
35
38
|
|
|
@@ -40,38 +43,42 @@ export class NPMPackContentProvider extends ContentProvider {
|
|
|
40
43
|
async *[Symbol.asyncIterator]() {
|
|
41
44
|
const entries = [];
|
|
42
45
|
|
|
43
|
-
await pacote.tarball.stream(
|
|
44
|
-
|
|
46
|
+
await pacote.tarball.stream(
|
|
47
|
+
this.dir,
|
|
48
|
+
async stream => {
|
|
49
|
+
const ex = extract();
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
ex.on("entry", async (header, stream, next) => {
|
|
52
|
+
stream.on("end", () => next());
|
|
48
53
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
const chunks = [];
|
|
55
|
+
for await (const chunk of await stream) {
|
|
56
|
+
chunks.push(chunk);
|
|
57
|
+
}
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
entries.push(
|
|
60
|
+
Object.assign(
|
|
61
|
+
Object.create(
|
|
62
|
+
new BufferContentEntry(
|
|
63
|
+
header.name.substring(8),
|
|
64
|
+
Buffer.concat(chunks)
|
|
65
|
+
),
|
|
66
|
+
{
|
|
67
|
+
mtime: { value: header.mtime },
|
|
68
|
+
mode: { value: header.mode }
|
|
69
|
+
}
|
|
60
70
|
),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
),
|
|
66
|
-
this.entryProperties
|
|
67
|
-
)
|
|
68
|
-
);
|
|
71
|
+
this.entryProperties
|
|
72
|
+
)
|
|
73
|
+
);
|
|
69
74
|
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
stream.resume();
|
|
76
|
+
});
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
await pipeline(stream, createGunzip(), ex);
|
|
79
|
+
},
|
|
80
|
+
{ Arborist }
|
|
81
|
+
);
|
|
75
82
|
|
|
76
83
|
for (const entry of entries) {
|
|
77
84
|
yield entry;
|
package/src/output/arch.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { createWriteStream } from "node:fs";
|
|
3
|
-
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import { execa } from "execa";
|
|
5
5
|
import { ContentEntry, ReadableStreamContentEntry } from "content-entry";
|
|
6
6
|
import { transform } from "content-entry-transform";
|
|
@@ -145,6 +145,7 @@ export class ARCH extends Packager {
|
|
|
145
145
|
|
|
146
146
|
const self = this;
|
|
147
147
|
async function* trailingLines() {
|
|
148
|
+
console.log();
|
|
148
149
|
yield `
|
|
149
150
|
package() {
|
|
150
151
|
depends=(${self.makeDepends(properties.dependencies).join(" ")})
|
|
@@ -152,6 +153,8 @@ package() {
|
|
|
152
153
|
if [ "$(ls -A $srcdir)" ]
|
|
153
154
|
then
|
|
154
155
|
cp -rp $srcdir/* "$pkgdir"
|
|
156
|
+
### CHOWN ###
|
|
157
|
+
|
|
155
158
|
fi
|
|
156
159
|
}
|
|
157
160
|
`;
|
|
@@ -177,22 +180,48 @@ package() {
|
|
|
177
180
|
createEntryWhenMissing: () => new ContentEntry(PKGBUILD)
|
|
178
181
|
});
|
|
179
182
|
|
|
183
|
+
const ownership = [];
|
|
184
|
+
|
|
180
185
|
for await (const file of copyEntries(
|
|
181
186
|
transform(aggregateFifo(sources), transformer),
|
|
182
187
|
join(staging, "src"),
|
|
183
188
|
expander
|
|
184
189
|
)) {
|
|
190
|
+
if (file.owner || file.group) {
|
|
191
|
+
ownership.push(file);
|
|
192
|
+
}
|
|
193
|
+
|
|
185
194
|
if (options.verbose) {
|
|
186
195
|
console.log(file.destination);
|
|
187
196
|
}
|
|
188
197
|
}
|
|
189
198
|
|
|
199
|
+
if (ownership.length) {
|
|
200
|
+
const pkgbuild = join(staging, PKGBUILD);
|
|
201
|
+
let content = await readFile(pkgbuild, utf8StreamOptions);
|
|
202
|
+
const markerPos = content.indexOf("### CHOWN ###");
|
|
203
|
+
|
|
204
|
+
content =
|
|
205
|
+
content.substring(0, markerPos) +
|
|
206
|
+
ownership
|
|
207
|
+
.map(
|
|
208
|
+
f =>
|
|
209
|
+
` chown ${[f.owner || "", f.group || ""].join(":")} \"$pkgdir/${
|
|
210
|
+
f.destination
|
|
211
|
+
}\"`
|
|
212
|
+
)
|
|
213
|
+
.join("\n") +
|
|
214
|
+
content.substring(markerPos + 14);
|
|
215
|
+
|
|
216
|
+
await writeFile(pkgbuild, content, utf8StreamOptions);
|
|
217
|
+
}
|
|
218
|
+
|
|
190
219
|
if (options.verbose) {
|
|
191
220
|
console.log(await readFile(join(staging, PKGBUILD), utf8StreamOptions));
|
|
192
|
-
console.log("***", staging, "***");
|
|
221
|
+
/*console.log("***", staging, "***");
|
|
193
222
|
const ls = await execa("ls", ["-lR"], { cwd: staging });
|
|
194
223
|
console.log(ls.stdout);
|
|
195
|
-
console.log("*** end ***")
|
|
224
|
+
console.log("*** end ***");*/
|
|
196
225
|
}
|
|
197
226
|
|
|
198
227
|
if (!options.dry) {
|
|
@@ -202,7 +231,7 @@ package() {
|
|
|
202
231
|
PACKAGER = person(properties.contributors);
|
|
203
232
|
}
|
|
204
233
|
|
|
205
|
-
const makepkg = await execa("makepkg", ["-c", "-f", "-e"], {
|
|
234
|
+
const makepkg = await execa("makepkg", ["--noprogressbar", "-c", "-f", "-e"], {
|
|
206
235
|
cwd: staging,
|
|
207
236
|
env: { PKGDEST: destination, PACKAGER }
|
|
208
237
|
});
|
package/src/util.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { createWriteStream } from "node:fs";
|
|
|
5
5
|
import { ContentEntry } from "content-entry";
|
|
6
6
|
|
|
7
7
|
export function compileFields(fields) {
|
|
8
|
-
for(const [k,v] of Object.entries(fields)) {
|
|
8
|
+
for (const [k, v] of Object.entries(fields)) {
|
|
9
9
|
v.name = k;
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -171,9 +171,9 @@ export function fieldProvider(properties, fields) {
|
|
|
171
171
|
yield [name, field.default];
|
|
172
172
|
}
|
|
173
173
|
} else {
|
|
174
|
-
if(field.mapping) {
|
|
174
|
+
if (field.mapping) {
|
|
175
175
|
const mappedValue = field.mapping[value];
|
|
176
|
-
if(mappedValue) {
|
|
176
|
+
if (mappedValue) {
|
|
177
177
|
value = mappedValue;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -219,11 +219,9 @@ export async function* copyEntries(
|
|
|
219
219
|
const destination = join(destinationDirectory, name);
|
|
220
220
|
await mkdir(dirname(destination), { recursive: true });
|
|
221
221
|
|
|
222
|
-
const options = { mode: entry.mode };
|
|
223
|
-
|
|
224
222
|
await pipeline(
|
|
225
223
|
await entry.readStream,
|
|
226
|
-
createWriteStream(destination,
|
|
224
|
+
createWriteStream(destination, entry.mode ? { mode: entry.mode } : undefined)
|
|
227
225
|
);
|
|
228
226
|
|
|
229
227
|
yield entry;
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @property {Transformer[]} transformer
|
|
5
5
|
*/
|
|
6
6
|
export class ContentProvider {
|
|
7
|
-
constructor(definitions: any, entryProperties: any);
|
|
7
|
+
constructor(definitions: any, entryProperties: any, directoryProperties: any);
|
|
8
8
|
transformers: any[];
|
|
9
9
|
entryProperties: any;
|
|
10
|
+
directoryProperties: any;
|
|
10
11
|
dir: any;
|
|
11
|
-
baseProperties: {};
|
|
12
12
|
/**
|
|
13
13
|
* List all entries.
|
|
14
14
|
* @return {AsyncIterable<ContentEntry>} all entries
|
|
@@ -8,6 +8,7 @@ export class FileContentProvider extends ContentProvider {
|
|
|
8
8
|
static get description(): string;
|
|
9
9
|
definitions: any;
|
|
10
10
|
get isPatternMatch(): any;
|
|
11
|
-
[Symbol.asyncIterator](): AsyncGenerator<
|
|
11
|
+
[Symbol.asyncIterator](): AsyncGenerator<FileSystemEntryWithPermissions, void, unknown>;
|
|
12
12
|
}
|
|
13
13
|
import { ContentProvider } from "./content-provider.mjs";
|
|
14
|
+
import { FileSystemEntryWithPermissions } from "./file-system-entry-with-permissions.mjs";
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
export class NFTContentProvider extends ContentProvider {
|
|
8
8
|
static get description(): string;
|
|
9
9
|
definitions: any;
|
|
10
|
-
[Symbol.asyncIterator](): AsyncGenerator<
|
|
10
|
+
[Symbol.asyncIterator](): AsyncGenerator<FileSystemEntryWithPermissions, void, unknown>;
|
|
11
11
|
}
|
|
12
12
|
import { ContentProvider } from "./content-provider.mjs";
|
|
13
|
+
import { FileSystemEntryWithPermissions } from "./file-system-entry-with-permissions.mjs";
|