npm-pkgbuild 22.2.0 → 22.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "npm-pkgbuild",
3
- "version": "22.2.0",
3
+ "version": "22.2.2",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": false
@@ -61,7 +61,7 @@
61
61
  "key-value-transformer": "^3.3.2",
62
62
  "npm-package-walker": "^8.0.11",
63
63
  "npm-packlist": "^11.3.0",
64
- "pacc": "^11.12.6",
64
+ "pacc": "^11.13.0",
65
65
  "package-directory": "^8.2.0",
66
66
  "pacote": "^22.0.0",
67
67
  "picomatch": "^4.0.7",
@@ -20,7 +20,8 @@ import {
20
20
  pkgbuild_version_attribute,
21
21
  pkgbuild_description_attribute,
22
22
  pkgbuild_name_attribute,
23
- dependency_attribute_collection_writable
23
+ dependency_attribute_collection_writable,
24
+ arch_attribute_writable
24
25
  } from "../types.mjs";
25
26
  import {
26
27
  copyEntries,
@@ -124,6 +125,7 @@ export class ALPM extends Packager {
124
125
  },
125
126
  license: {
126
127
  ...string_collection_attribute_writable,
128
+ separator: undefined,
127
129
  name: "license",
128
130
  skipEmpty: true
129
131
  },
@@ -177,10 +179,8 @@ export class ALPM extends Packager {
177
179
  skipEmpty: true
178
180
  },
179
181
  arch: {
180
- ...string_collection_attribute_writable,
181
- name: "arch",
182
- default: ["any"],
183
- mandatory: true
182
+ ...arch_attribute_writable,
183
+ default: ["any"]
184
184
  },
185
185
  backup: {
186
186
  ...string_collection_attribute_writable,
@@ -21,7 +21,7 @@ import {
21
21
  pkgbuild_description_attribute,
22
22
  pkgbuild_name_attribute,
23
23
  dependency_attribute_collection_writable,
24
- architectureType
24
+ arch_attribute_writable
25
25
  } from "../types.mjs";
26
26
 
27
27
  const debian_dependency_attribute_collection_writable = {
@@ -70,13 +70,10 @@ export class DEBIAN extends Packager {
70
70
  mandatory: true
71
71
  },
72
72
  arch: {
73
- ...string_attribute_writable,
74
- name: "arch",
73
+ ...arch_attribute_writable,
75
74
  externalName: "Architecture",
76
75
  default: "all",
77
- mandatory: true,
78
- type: architectureType,
79
- mapping: { aarch64: "arm64" }
76
+ mapping: { aarch64: "arm64", any: "all" }
80
77
  },
81
78
  groups: {
82
79
  ...string_attribute_writable,
@@ -3,9 +3,9 @@ import { readFile } from "node:fs/promises";
3
3
  import { cp } from "node:fs/promises";
4
4
  import { execa } from "execa";
5
5
  import {
6
- integer_attribute,
7
- url_attribute,
8
- string_attribute,
6
+ integer_attribute_writable,
7
+ url_attribute_writable,
8
+ string_attribute_writable,
9
9
  string_collection_attribute_writable
10
10
  } from "pacc";
11
11
  import { ContentEntry, IteratorContentEntry } from "content-entry";
@@ -19,7 +19,9 @@ import { Packager } from "./packager.mjs";
19
19
  import {
20
20
  pkgbuild_version_attribute,
21
21
  pkgbuild_description_attribute,
22
- pkgbuild_name_attribute
22
+ pkgbuild_name_attribute,
23
+ arch_attribute_writable,
24
+ dependency_attribute_collection_writable
23
25
  } from "../types.mjs";
24
26
  import {
25
27
  copyEntries,
@@ -64,34 +66,59 @@ export class RPM extends Packager {
64
66
  name: { ...pkgbuild_name_attribute, externalName: "Name" },
65
67
  description: { ...pkgbuild_description_attribute, externalName: "Summary" },
66
68
  license: {
67
- ...string_attribute,
69
+ ...string_attribute_writable,
68
70
  name: "license",
69
71
  externalName: "License",
70
72
  mandatory: true
71
73
  },
72
74
  version: { ...pkgbuild_version_attribute, externalName: "Version" },
73
75
  release: {
74
- ...integer_attribute,
76
+ ...integer_attribute_writable,
75
77
  externalName: "Release",
76
78
  name: "release",
77
79
  default: 1,
78
80
  mandatory: true
79
81
  },
80
- source: { ...string_attribute, externalName: "Source0", name: "source" },
81
- groups: { ...string_attribute, externalName: "Group", name: "groups" },
82
- maintainer: { ...string_attribute, name: "maintainer", externalName: "Packager" },
83
- vendor: { ...string_attribute, externalName: "Vendor", name: "vendor" },
82
+ source: {
83
+ ...string_attribute_writable,
84
+ externalName: "Source0",
85
+ name: "source"
86
+ },
87
+ groups: {
88
+ ...string_attribute_writable,
89
+ externalName: "Group",
90
+ name: "groups",
91
+ skipEmpty: true
92
+ },
93
+ maintainer: {
94
+ ...string_attribute_writable,
95
+ name: "maintainer",
96
+ externalName: "Packager"
97
+ },
98
+ vendor: {
99
+ ...string_attribute_writable,
100
+ externalName: "Vendor",
101
+ name: "vendor",
102
+ skipEmpty: true
103
+ },
84
104
  arch: {
85
- ...string_attribute,
105
+ ...arch_attribute_writable,
86
106
  externalName: "BuildArch",
87
- name: "arch",
88
107
  default: "noarch",
89
- mandatory: true
108
+ mapping: { any: "noarch" }
109
+ },
110
+ URL: {
111
+ ...url_attribute_writable,
112
+ name: "URL",
113
+ alias: "homepage",
114
+ skipEmpty: true
115
+ },
116
+ dependencies: {
117
+ ...dependency_attribute_collection_writable,
118
+ externalName: "Requires"
90
119
  },
91
- URL: { ...url_attribute, name: "URL", alias: "homepage" },
92
- Requires: { ...string_collection_attribute_writable, name: "Requires" },
93
- Obsoletes: { ...string_collection_attribute_writable, name: "Obsoletes" },
94
- Conflicts: { ...string_collection_attribute_writable, name: "Conflicts" }
120
+ Obsoletes: { ...dependency_attribute_collection_writable, name: "Obsoletes" },
121
+ Conflicts: { ...dependency_attribute_collection_writable, name: "Conflicts" }
95
122
  };
96
123
 
97
124
  static get workspaceLayout() {
@@ -152,7 +179,7 @@ export class RPM extends Packager {
152
179
  const { properties, tmpdir, staging, destination } =
153
180
  await this.prepare(options);
154
181
 
155
- properties.Requires = this.makeDepends(properties.dependencies);
182
+ properties.dependencies = this.makeDepends(properties.dependencies);
156
183
 
157
184
  if (properties.Packager?.length > 1) {
158
185
  // TODO how to write several Packages ?
package/src/types.mjs CHANGED
@@ -1,20 +1,16 @@
1
1
  import {
2
2
  types,
3
+ primitive_type,
3
4
  string_collection_attribute_writable,
4
5
  name_attribute,
5
6
  description_attribute,
6
- version_attribute_writable
7
+ version_attribute_writable,
8
+ string_attribute_writable
7
9
  } from "pacc";
8
10
 
9
- export const pkgbuild_name_attribute = {
10
- ...name_attribute,
11
- mandatory: true,
12
- pattern: /^[a-z_][a-z0-9_\-]*$/i
13
- };
14
-
15
11
  export const dependency_type = {
12
+ ...primitive_type,
16
13
  name: "dependency",
17
- primitive: false,
18
14
  toExternal: (value, attribute) => {
19
15
  switch (typeof value) {
20
16
  case "string":
@@ -36,9 +32,9 @@ export const dependency_type = {
36
32
  }
37
33
  };
38
34
 
39
- export const architectureType = {
35
+ export const architecture_type = {
36
+ ...primitive_type,
40
37
  name: "architecture",
41
- primitive: true,
42
38
 
43
39
  toInternal: (value, attribute) => {
44
40
  // console.log("architectureType toInternal", value);
@@ -47,10 +43,24 @@ export const architectureType = {
47
43
 
48
44
  toExternal: (value, attribute) => {
49
45
  // console.log("architectureType toExternal", value);
50
- return attribute.mapping[value] ?? value;
46
+ return attribute.mapping?.[value] ?? value;
51
47
  }
52
48
  };
53
49
 
50
+ export const arch_attribute_writable = {
51
+ ...string_attribute_writable,
52
+ name: "arch",
53
+ default: "all",
54
+ mandatory: true,
55
+ type: architecture_type
56
+ };
57
+
58
+ export const pkgbuild_name_attribute = {
59
+ ...name_attribute,
60
+ mandatory: true,
61
+ pattern: /^[a-z_][a-z0-9_\-]*$/i
62
+ };
63
+
54
64
  export const dependency_attribute_collection_writable = {
55
65
  ...string_collection_attribute_writable,
56
66
  type: dependency_type,
package/src/util.mjs CHANGED
@@ -145,15 +145,11 @@ export function quote(v, qc = "'") {
145
145
  * @returns {Function}
146
146
  */
147
147
  export function fieldProvider(properties, attributes) {
148
- function av(attribute, value) {
149
- return attribute.collection ? asArray(value) : value;
150
- }
151
-
152
- return function* controlProperties(k, v, presentKeys) {
148
+ return function* controlProperties(key, value, presentKeys) {
153
149
  let filter;
154
150
 
155
- if (k) {
156
- filter = attribute => attribute.name === k;
151
+ if (key) {
152
+ filter = attribute => attribute.name === key;
157
153
  }
158
154
 
159
155
  for (const [name, value] of iterateToExternal(