pmcf 6.52.2 → 6.53.1

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": "pmcf",
3
- "version": "6.52.2",
3
+ "version": "6.53.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/content.mjs CHANGED
@@ -37,6 +37,10 @@ export class content extends core {
37
37
  static attributes = {
38
38
  name: { ...name_attribute_writable, packagingProperty: true },
39
39
  description: { ...description_attribute_writable, packagingProperty: true },
40
+ fragments: {
41
+ ...string_set_attribute_writable,
42
+ name: "fragments"
43
+ },
40
44
  permissions: {
41
45
  ...default_collection_attribute_writable,
42
46
  type: permission,
@@ -63,6 +67,11 @@ export class content extends core {
63
67
  name: "replaces",
64
68
  packagingProperty: true
65
69
  },
70
+ conflicts: {
71
+ ...string_set_attribute_writable,
72
+ name: "conflicts",
73
+ packagingProperty: true
74
+ },
66
75
  optional: {
67
76
  ...string_set_attribute_writable,
68
77
  name: "optional",
@@ -90,6 +99,7 @@ export class content extends core {
90
99
  addType(this);
91
100
  }
92
101
 
102
+ _fragments = new Set();
93
103
  _permissions = new Map();
94
104
  _packaging = new Set();
95
105
  _provides = new Set();
@@ -98,6 +108,7 @@ export class content extends core {
98
108
  _optional = new Set();
99
109
  _groups = new Set();
100
110
  _hooks = new Set();
111
+ _conflicts = new Set();
101
112
 
102
113
  get host() {
103
114
  return this.owner.host;
@@ -200,6 +211,16 @@ export class content extends core {
200
211
  );
201
212
  }
202
213
 
214
+ set conflicts(value) {
215
+ this._conflicts = union(value, this._conflicts);
216
+ }
217
+
218
+ get conflicts() {
219
+ return this.expand(
220
+ this.unionFromDirections(["this", "extends"], "_conflicts")
221
+ );
222
+ }
223
+
203
224
  set optional(value) {
204
225
  this._optional = union(value, this._optional);
205
226
  }
@@ -256,8 +277,19 @@ export class content extends core {
256
277
  }
257
278
  }
258
279
 
280
+ set fragments(value) {
281
+ this._fragments = union(value, this._fragments);
282
+ }
283
+
284
+ get fragments() {
285
+ return this.expand(
286
+ this.unionFromDirections(["this", "extends"], "_fragments")
287
+ );
288
+ }
289
+
259
290
  async preparePackage() {
260
291
  const packageData = {
292
+ fragments: this.fragments,
261
293
  sources: [],
262
294
  outputs: this.outputs,
263
295
  properties: Object.fromEntries(
@@ -265,7 +297,8 @@ export class content extends core {
265
297
  this.constructor,
266
298
  attribute => attribute.packagingProperty
267
299
  ).map(([path, attribute]) => [path[0], this[path[0]]])
268
- )
300
+ ),
301
+ dir: () => this.sources?.[0].dir
269
302
  };
270
303
 
271
304
  await this.loadHooks(packageData);
@@ -248,7 +248,7 @@ export class bind_key extends base {
248
248
  `${this.name}.conf`,
249
249
  [
250
250
  `key "${this.name}" {`,
251
- ` # ` + asArray(this.tags).join(','),
251
+ ` # ` + asArray(this.tags).join(","),
252
252
  ` algorithm ${this.algorithm};`,
253
253
  ` secret "${this.secret}";`,
254
254
  "};"
@@ -369,7 +369,6 @@ class bind_view extends bind_object {
369
369
  name: "sharedWith",
370
370
  type: bind_view
371
371
  },
372
-
373
372
  matchClients: {
374
373
  ...acl_attribute,
375
374
  name: "matchClients"
@@ -697,19 +696,21 @@ class bind_view extends bind_object {
697
696
  ...(await Array.fromAsync(this.templateContent(this.service.content)))
698
697
  );
699
698
 
700
- for (const config of this.zoneConfigs.values()) {
701
- await config.write(outputControl.dir);
702
- }
699
+ if (outputControl.packageData.fragments.has("zones")) {
700
+ for (const config of this.zoneConfigs.values()) {
701
+ await config.write(outputControl.dir);
702
+ }
703
703
 
704
- if (this.foreignDomains.size) {
705
- addHook(
706
- outputControl.packageData,
707
- "post_upgrade",
708
- `/usr/bin/named-hostname-update ${[...this.foreignDomains].join(" ")}`
709
- );
710
- }
704
+ if (this.foreignDomains.size) {
705
+ addHook(
706
+ outputControl.packageData,
707
+ "post_upgrade",
708
+ `/usr/bin/named-hostname-update ${[...this.foreignDomains].join(" ")}`
709
+ );
710
+ }
711
711
 
712
- return outputControl.packageData;
712
+ return outputControl.packageData;
713
+ }
713
714
  }
714
715
  }
715
716
 
@@ -865,6 +866,7 @@ export class bind extends CoreService {
865
866
  `server ${service.address()} {`,
866
867
  " keys {" +
867
868
  asArray(service.keys.values())
869
+ .filter(key=>key.tags.has('server'))
868
870
  .map(key => ` ${key.name};`)
869
871
  .join("") +
870
872
  " };",
@@ -872,6 +874,7 @@ export class bind extends CoreService {
872
874
  ];
873
875
  })
874
876
  );
877
+ return true;
875
878
  }
876
879
 
877
880
  async *preparePackages(dir) {
@@ -885,27 +888,30 @@ export class bind extends CoreService {
885
888
 
886
889
  const outputControl = { packageData, dir };
887
890
 
888
- for (const key of this.keys.values()) {
889
- await key.packageContent(outputControl);
890
- hasContent = true;
891
- }
892
-
893
- for (const acl of this.acls.values()) {
894
- await acl.packageContent(outputControl);
895
- hasContent = true;
896
- }
897
-
898
891
  for (const view of this.views.values()) {
899
892
  const present = await view.packageContent(outputControl);
900
893
  hasContent ||= present;
901
894
  }
902
895
 
903
- let present;
904
- present = await this.writeServers(outputControl);
896
+ if (packageData.fragments.has("base")) {
897
+ for (const key of this.keys.values()) {
898
+ await key.packageContent(outputControl);
899
+ hasContent = true;
900
+ }
905
901
 
906
- present = await this.writeForwarders(outputControl);
902
+ for (const acl of this.acls.values()) {
903
+ await acl.packageContent(outputControl);
904
+ hasContent = true;
905
+ }
906
+
907
+ let present;
908
+ present = await this.writeForwarders(outputControl);
909
+ hasContent ||= present;
910
+ present = await this.writeServers(outputControl);
911
+ hasContent ||= present;
912
+ }
907
913
 
908
- if (hasContent || present) {
914
+ if (hasContent) {
909
915
  yield packageData;
910
916
  }
911
917
  }