confctl 2.1.0 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94823b33bdeb90ed8aa1a2aa835e8a3f48300c116ee951c3d41e8c433e9ea1ed
4
- data.tar.gz: 7ec55e71a411a0844a687047d797c0324efeeb2b2f2fd1dd5efa3261ede6a184
3
+ metadata.gz: bd99990731daa837f1243feb4a3b098320180badbbb9cc3846c105e7b747b794
4
+ data.tar.gz: 2ab400c25ea0bfc35f53713826b0e69aeff4667314048aaf6f8f56c942dda4e3
5
5
  SHA512:
6
- metadata.gz: 83cf4e6ef92ec1cf76f2b260e689a45b52dc3653c35d82bdddabb3246e37b0ddb5d056ad60ebed5506e72612f235e7a283d9eecd29b1822482013ffa1562037a
7
- data.tar.gz: aa12794664afe5a91595f91da89e8fe7d8e7205ad4428918bf0e0047ea2f1603244f3fb7aec458d0d0f2e5fdef21add41d431136b6872ec2ae26fe401258111e
6
+ metadata.gz: 7b2f85762c2c9c8173ffc38fd1fd6c37e2866ae8a6d5a4d1cbfc6d4cbbb8e8037dc9e9d40d0d8f9f12f7a0eae7140c4c52f435ea6e952327803024a6cd08720b
7
+ data.tar.gz: a3f87cfe12b26ef6c0a520030256a798418b85cee9dbedc2cd63e35b7625aa7e763c4f3d07f9e194826c6d3cffd5f12bc1a55d04201c6963067412a5010c4bad
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # Fri Jun 06 2025 -- version 2.2.0
2
+ - Handle `pkgs.substituteAll` / `pkgs.replaceVarsWith` compatibility on NixOS unstable
3
+ and 25.05
4
+ - Change swpin files only when revisions are updated, skip commit when no changes were made
5
+ - Add option `--[no-]editor` to `confctl swpins core/cluster/channel set/update` commands
6
+
1
7
  # Sun May 11 2025 -- version 2.1.0
2
8
  - Support for referring to generations by their offset
3
9
  - Resolved generations are printed on build/deploy/etc.
data/Gemfile CHANGED
@@ -1,2 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
+
4
+ group :development do
5
+ gem 'overcommit'
6
+ gem 'rubocop', '~> 1.75.0'
7
+ gem 'rubocop-rake'
8
+ end
@@ -537,6 +537,9 @@ module ConfCtl::Cli
537
537
  c.desc 'Include changelog in the commit message'
538
538
  c.switch :changelog, default_value: true
539
539
 
540
+ c.desc 'Open $EDITOR with commit message'
541
+ c.switch :editor, default_value: true
542
+
540
543
  c.desc 'Generate changelog for downgrade'
541
544
  c.switch %i[d downgrade], default_value: false
542
545
 
@@ -37,11 +37,12 @@ module ConfCtl::Cli
37
37
 
38
38
  channels.each(&:save)
39
39
 
40
- return unless opts[:commit]
40
+ return if !opts[:commit] || !change_set.any_changes?
41
41
 
42
42
  change_set.commit(
43
43
  type: opts[:downgrade] ? :downgrade : :upgrade,
44
- changelog: opts[:changelog]
44
+ changelog: opts[:changelog],
45
+ editor: opts[:editor]
45
46
  )
46
47
  end
47
48
 
@@ -62,11 +63,12 @@ module ConfCtl::Cli
62
63
 
63
64
  channels.each(&:save)
64
65
 
65
- return unless opts[:commit]
66
+ return if !opts[:commit] || !change_set.any_changes?
66
67
 
67
68
  change_set.commit(
68
69
  type: opts[:downgrade] ? :downgrade : :upgrade,
69
- changelog: opts[:changelog]
70
+ changelog: opts[:changelog],
71
+ editor: opts[:editor]
70
72
  )
71
73
  end
72
74
  end
@@ -42,11 +42,12 @@ module ConfCtl::Cli
42
42
 
43
43
  cluster_names.each(&:save)
44
44
 
45
- return unless opts[:commit]
45
+ return if !opts[:commit] || !change_set.any_changes?
46
46
 
47
47
  change_set.commit(
48
48
  type: opts[:downgrade] ? :downgrade : :upgrade,
49
- changelog: opts[:changelog]
49
+ changelog: opts[:changelog],
50
+ editor: opts[:editor]
50
51
  )
51
52
  end
52
53
 
@@ -69,11 +70,12 @@ module ConfCtl::Cli
69
70
 
70
71
  cluster_names.each(&:save)
71
72
 
72
- return unless opts[:commit]
73
+ return if !opts[:commit] || !change_set.any_changes?
73
74
 
74
75
  change_set.commit(
75
76
  type: opts[:downgrade] ? :downgrade : :upgrade,
76
- changelog: opts[:changelog]
77
+ changelog: opts[:changelog],
78
+ editor: opts[:editor]
77
79
  )
78
80
  end
79
81
  end
@@ -46,11 +46,12 @@ module ConfCtl::Cli
46
46
  core.save
47
47
  core.pre_evaluate
48
48
 
49
- return unless opts[:commit]
49
+ return if !opts[:commit] || !change_set.any_changes?
50
50
 
51
51
  change_set.commit(
52
52
  type: opts[:downgrade] ? :downgrade : :upgrade,
53
- changelog: opts[:changelog]
53
+ changelog: opts[:changelog],
54
+ editor: opts[:editor]
54
55
  )
55
56
  end
56
57
 
@@ -75,11 +76,12 @@ module ConfCtl::Cli
75
76
  core.save
76
77
  core.pre_evaluate
77
78
 
78
- return unless opts[:commit]
79
+ return if !opts[:commit] || !change_set.any_changes?
79
80
 
80
81
  change_set.commit(
81
82
  type: opts[:downgrade] ? :downgrade : :upgrade,
82
- changelog: opts[:changelog]
83
+ changelog: opts[:changelog],
84
+ editor: opts[:editor]
83
85
  )
84
86
  end
85
87
  end
@@ -48,22 +48,29 @@ module ConfCtl
48
48
 
49
49
  # @param type [:upgrade, :downgrade]
50
50
  # @param changelog [Boolean]
51
- def commit(type: :upgrade, changelog: false)
51
+ # @param editor [Boolean]
52
+ def commit(type: :upgrade, changelog: false, editor: true)
52
53
  return if @owners.empty?
53
54
 
54
- ret = Kernel.system(
55
+ git_commit = [
55
56
  'git',
56
57
  'commit',
57
- '-e',
58
+ editor ? '-e' : nil,
58
59
  '-m', build_message(type, changelog),
59
60
  *changed_files
60
- )
61
+ ].compact
62
+
63
+ ret = Kernel.system(*git_commit)
61
64
 
62
65
  return if ret
63
66
 
64
67
  raise 'git commit exited with non-zero status code'
65
68
  end
66
69
 
70
+ def any_changes?
71
+ @owners.any? { |_, spec_sets| spec_sets.any?(&:changed?) }
72
+ end
73
+
67
74
  protected
68
75
 
69
76
  def build_message(type, changelog)
@@ -90,14 +90,18 @@ module ConfCtl
90
90
  raise "nix-prefetch-git failed with status #{$?.exitstatus}" if $?.exitstatus != 0
91
91
 
92
92
  ret = JSON.parse(json.strip)
93
- self.state = {
94
- 'rev' => ret['rev'],
95
- 'date' => Time.now.iso8601
96
- }
97
- self.info = {
98
- 'rev' => ret['rev'],
99
- 'sha256' => ret['sha256']
100
- }
93
+
94
+ if state.nil? || state['rev'] != ret['rev']
95
+ self.state = {
96
+ 'rev' => ret['rev'],
97
+ 'date' => Time.now.iso8601
98
+ }
99
+ self.info = {
100
+ 'rev' => ret['rev'],
101
+ 'sha256' => ret['sha256']
102
+ }
103
+ end
104
+
101
105
  ret
102
106
  end
103
107
 
@@ -111,14 +115,17 @@ module ConfCtl
111
115
 
112
116
  raise "nix-prefetch-url failed with status #{$?.exitstatus}" if $?.exitstatus != 0
113
117
 
114
- self.state = {
115
- 'rev' => rev,
116
- 'date' => Time.now.iso8601
117
- }
118
- self.info = {
119
- 'rev' => rev,
120
- 'sha256' => hash
121
- }
118
+ if state.nil? || state['rev'] != rev
119
+ self.state = {
120
+ 'rev' => rev,
121
+ 'date' => Time.now.iso8601
122
+ }
123
+ self.info = {
124
+ 'rev' => rev,
125
+ 'sha256' => hash
126
+ }
127
+ end
128
+
122
129
  { 'url' => url, 'sha256' => hash }
123
130
  end
124
131
 
@@ -1,3 +1,3 @@
1
1
  module ConfCtl
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  end
data/man/man8/confctl.8 CHANGED
@@ -549,6 +549,9 @@ on the type of the software pin, for git it is a git reference, e.g. a revision.
549
549
  Include changelog in the commit message when \fB\fC\-\-commit\fR is used. Enabled by
550
550
  default.
551
551
  .TP
552
+ \fB\fC\-\-[no]\-editor\fR
553
+ Open \fB\fC$EDITOR\fR with the commit message. Enabled by default.
554
+ .TP
552
555
  \fB\fC\-d\fR, \fB\fC\-\-downgrade\fR
553
556
  Use when the new version is older than the previously set version. Used for
554
557
  generating changelog for the commit message.
@@ -563,6 +566,9 @@ this command. The usual case for git is to pin to the current branch head.
563
566
  \fB\fC\-\-[no\-]changelog\fR
564
567
  Include changelog in the commit message when \fB\fC\-\-commit\fR is used. Enabled by
565
568
  default.
569
+ .PP
570
+ \fB\fC\-\-[no]\-editor\fR
571
+ Open \fB\fC$EDITOR\fR with the commit message. Enabled by default.
566
572
  .PP
567
573
  \fB\fC\-d\fR, \fB\fC\-\-downgrade\fR
568
574
  Use when the new version is older than the previously set version. Used for
@@ -582,6 +588,9 @@ reference, e.g. a revision.
582
588
  \fB\fC\-\-[no\-]changelog\fR
583
589
  Include changelog in the commit message when \fB\fC\-\-commit\fR is used. Enabled by
584
590
  default.
591
+ .PP
592
+ \fB\fC\-\-[no]\-editor\fR
593
+ Open \fB\fC$EDITOR\fR with the commit message. Enabled by default.
585
594
  .PP
586
595
  \fB\fC\-d\fR, \fB\fC\-\-downgrade\fR
587
596
  Use when the new version is older than the previously set version. Used for
@@ -598,6 +607,9 @@ branch head.
598
607
  \fB\fC\-\-[no\-]changelog\fR
599
608
  Include changelog in the commit message when \fB\fC\-\-commit\fR is used. Enabled by
600
609
  default.
610
+ .PP
611
+ \fB\fC\-\-[no]\-editor\fR
612
+ Open \fB\fC$EDITOR\fR with the commit message. Enabled by default.
601
613
  .PP
602
614
  \fB\fC\-d\fR, \fB\fC\-\-downgrade\fR
603
615
  Use when the new version is older than the previously set version. Used for
@@ -617,6 +629,9 @@ reference, e.g. a revision.
617
629
  \fB\fC\-\-[no\-]changelog\fR
618
630
  Include changelog in the commit message when \fB\fC\-\-commit\fR is used. Enabled by
619
631
  default.
632
+ .PP
633
+ \fB\fC\-\-[no]\-editor\fR
634
+ Open \fB\fC$EDITOR\fR with the commit message. Enabled by default.
620
635
  .PP
621
636
  \fB\fC\-d\fR, \fB\fC\-\-downgrade\fR
622
637
  Use when the new version is older than the previously set version. Used for
@@ -633,6 +648,9 @@ branch head.
633
648
  \fB\fC\-\-[no\-]changelog\fR
634
649
  Include changelog in the commit message when \fB\fC\-\-commit\fR is used. Enabled by
635
650
  default.
651
+ .PP
652
+ \fB\fC\-\-[no]\-editor\fR
653
+ Open \fB\fC$EDITOR\fR with the commit message. Enabled by default.
636
654
  .PP
637
655
  \fB\fC\-d\fR, \fB\fC\-\-downgrade\fR
638
656
  Use when the new version is older than the previously set version. Used for
@@ -648,6 +666,9 @@ in all channels, all machine\-specific pins and the core pins.
648
666
  \fB\fC\-\-[no\-]changelog\fR
649
667
  Include changelog in the commit message when \fB\fC\-\-commit\fR is used. Enabled by
650
668
  default.
669
+ .PP
670
+ \fB\fC\-\-[no]\-editor\fR
671
+ Open \fB\fC$EDITOR\fR with the commit message. Enabled by default.
651
672
  .PP
652
673
  \fB\fC\-d\fR, \fB\fC\-\-downgrade\fR
653
674
  Use when the new version is older than the previously set version. Used for
@@ -539,6 +539,9 @@ the generation before last and so on.
539
539
  Include changelog in the commit message when `--commit` is used. Enabled by
540
540
  default.
541
541
 
542
+ `--[no]-editor`
543
+ Open `$EDITOR` with the commit message. Enabled by default.
544
+
542
545
  `-d`, `--downgrade`
543
546
  Use when the new version is older than the previously set version. Used for
544
547
  generating changelog for the commit message.
@@ -554,6 +557,9 @@ the generation before last and so on.
554
557
  Include changelog in the commit message when `--commit` is used. Enabled by
555
558
  default.
556
559
 
560
+ `--[no]-editor`
561
+ Open `$EDITOR` with the commit message. Enabled by default.
562
+
557
563
  `-d`, `--downgrade`
558
564
  Use when the new version is older than the previously set version. Used for
559
565
  generating changelog for the commit message.
@@ -573,6 +579,9 @@ the generation before last and so on.
573
579
  Include changelog in the commit message when `--commit` is used. Enabled by
574
580
  default.
575
581
 
582
+ `--[no]-editor`
583
+ Open `$EDITOR` with the commit message. Enabled by default.
584
+
576
585
  `-d`, `--downgrade`
577
586
  Use when the new version is older than the previously set version. Used for
578
587
  generating changelog for the commit message.
@@ -589,6 +598,9 @@ the generation before last and so on.
589
598
  Include changelog in the commit message when `--commit` is used. Enabled by
590
599
  default.
591
600
 
601
+ `--[no]-editor`
602
+ Open `$EDITOR` with the commit message. Enabled by default.
603
+
592
604
  `-d`, `--downgrade`
593
605
  Use when the new version is older than the previously set version. Used for
594
606
  generating changelog for the commit message.
@@ -608,6 +620,9 @@ the generation before last and so on.
608
620
  Include changelog in the commit message when `--commit` is used. Enabled by
609
621
  default.
610
622
 
623
+ `--[no]-editor`
624
+ Open `$EDITOR` with the commit message. Enabled by default.
625
+
611
626
  `-d`, `--downgrade`
612
627
  Use when the new version is older than the previously set version. Used for
613
628
  generating changelog for the commit message.
@@ -624,6 +639,9 @@ the generation before last and so on.
624
639
  Include changelog in the commit message when `--commit` is used. Enabled by
625
640
  default.
626
641
 
642
+ `--[no]-editor`
643
+ Open `$EDITOR` with the commit message. Enabled by default.
644
+
627
645
  `-d`, `--downgrade`
628
646
  Use when the new version is older than the previously set version. Used for
629
647
  generating changelog for the commit message.
@@ -639,6 +657,9 @@ the generation before last and so on.
639
657
  Include changelog in the commit message when `--commit` is used. Enabled by
640
658
  default.
641
659
 
660
+ `--[no]-editor`
661
+ Open `$EDITOR` with the commit message. Enabled by default.
662
+
642
663
  `-d`, `--downgrade`
643
664
  Use when the new version is older than the previously set version. Used for
644
665
  generating changelog for the commit message.
data/nix/evaluator.nix CHANGED
@@ -84,11 +84,28 @@ let
84
84
  in {
85
85
  attribute = result;
86
86
 
87
- autoRollback = corePkgs.substituteAll {
88
- src = ../libexec/auto-rollback.rb;
89
- isExecutable = true;
90
- ruby = nixpkgs.ruby;
91
- };
87
+ autoRollback =
88
+ # pkgs.substituteAll was removed from nixos-unstable, but pkgs.replaceVarsWith
89
+ # is not available in nixos-25.05.
90
+ let
91
+ args = {
92
+ src = ../libexec/auto-rollback.rb;
93
+ isExecutable = true;
94
+ };
95
+
96
+ replacements = {
97
+ ruby = nixpkgs.ruby;
98
+ };
99
+ in
100
+ if builtins.hasAttr "replaceVarsWith" corePkgs then
101
+ corePkgs.replaceVarsWith {
102
+ inherit (args) src isExecutable;
103
+ inherit replacements;
104
+ }
105
+ else
106
+ corePkgs.substituteAll ({
107
+ inherit (args) src isExecutable;
108
+ } // replacements);
92
109
  };
93
110
 
94
111
  evalMachine = machine:
@@ -4,16 +4,18 @@ let
4
4
 
5
5
  cfg = config.confctl.carrier;
6
6
 
7
- carrier-env = pkgs.substituteAll {
7
+ carrier-env = pkgs.confReplaceVarsWith {
8
8
  src = ./carrier-env.rb;
9
9
  name = "carrier-env";
10
10
  isExecutable = true;
11
11
  dir = "bin";
12
- ruby = pkgs.ruby;
13
- onChangeCommands = pkgs.writeScript "carrier-on-change-commands.sh" ''
14
- #!${pkgs.bash}/bin/bash
15
- ${cfg.onChangeCommands}
16
- '';
12
+ replacements = {
13
+ ruby = pkgs.ruby;
14
+ onChangeCommands = pkgs.writeScript "carrier-on-change-commands.sh" ''
15
+ #!${pkgs.bash}/bin/bash
16
+ ${cfg.onChangeCommands}
17
+ '';
18
+ };
17
19
  };
18
20
  in {
19
21
  options = {
@@ -52,13 +52,15 @@ let
52
52
  isoImages = cfg.isoImages;
53
53
  };
54
54
 
55
- builder = pkgs.substituteAll {
55
+ builder = pkgs.confReplaceVarsWith {
56
56
  src = ./build-netboot-server.rb;
57
57
  name = "build-netboot-server";
58
58
  dir = "bin";
59
59
  isExecutable = true;
60
- ruby = pkgs.ruby;
61
- jsonConfig = pkgs.writeText "netboot-server.json" builderConfig;
60
+ replacements = {
61
+ ruby = pkgs.ruby;
62
+ jsonConfig = pkgs.writeText "netboot-server.json" builderConfig;
63
+ };
62
64
  };
63
65
  in {
64
66
  options = {
@@ -4,13 +4,15 @@ let
4
4
 
5
5
  cfg = config.confctl.programs.kexec-netboot;
6
6
 
7
- kexecNetboot = pkgs.substituteAll {
7
+ kexecNetboot = pkgs.confReplaceVarsWith {
8
8
  name = "kexec-netboot";
9
9
  src = ./kexec-netboot.rb;
10
10
  isExecutable = true;
11
- ruby = pkgs.ruby;
12
- kexecTools = pkgs.kexec-tools;
13
- machineFqdn = confMachine.host.fqdn;
11
+ replacements = {
12
+ ruby = pkgs.ruby;
13
+ kexecTools = pkgs.kexec-tools;
14
+ machineFqdn = confMachine.host.fqdn;
15
+ };
14
16
  };
15
17
 
16
18
  kexecNetbootBin = pkgs.runCommand "kexec-netboot-bin" {} ''
@@ -0,0 +1,15 @@
1
+ { config, ... }:
2
+ {
3
+ nixpkgs.overlays = [
4
+ (self: super: {
5
+ # nixos-unstable removed pkgs.substituteAll, but nixos-25.05 does not
6
+ # include the new function pkgs.replaceVarsWith
7
+ confReplaceVarsWith =
8
+ { replacements, ... } @ args:
9
+ if builtins.hasAttr "replaceVarsWith" self then
10
+ self.replaceVarsWith args
11
+ else
12
+ self.substituteAll ((builtins.removeAttrs args [ "replacements" ]) // replacements);
13
+ })
14
+ ];
15
+ }
@@ -4,6 +4,7 @@ let
4
4
  ./confctl/generations.nix
5
5
  ./confctl/cli.nix
6
6
  ./confctl/nix.nix
7
+ ./confctl/overlays.nix
7
8
  ./confctl/swpins.nix
8
9
  ];
9
10
 
data/shell.nix CHANGED
@@ -19,12 +19,19 @@ in stdenv.mkDerivation rec {
19
19
  export GEM_HOME="$(pwd)/.gems"
20
20
  BINDIR="$(ruby -e 'puts Gem.bindir')"
21
21
  mkdir -p "$BINDIR"
22
+
22
23
  export PATH="$BINDIR:$PATH"
23
24
  export RUBYLIB="$GEM_HOME:$CONFCTL/lib"
24
25
  export MANPATH="$CONFCTL/man:$(man --path)"
25
- gem install --no-document bundler overcommit rubocop
26
+ gem install --no-document bundler
26
27
  pushd "$CONFCTL"
27
- bundle install
28
+
29
+ # Purity disabled because of prism gem, which has a native extension.
30
+ # The extension has its header files in .gems, which gets stripped but
31
+ # cc wrapper in Nix. Without NIX_ENFORCE_PURITY=0, we get prism.h not found
32
+ # error.
33
+ NIX_ENFORCE_PURITY=0 bundle install
34
+
28
35
  bundle exec rake md2man:man
29
36
  popd
30
37
 
metadata CHANGED
@@ -1,11 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confctl
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Skokan
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
10
  date: 1980-01-01 00:00:00.000000000 Z
@@ -331,17 +330,16 @@ files:
331
330
  - nix/modules/confctl/kexec-netboot/kexec-netboot.8.adoc
332
331
  - nix/modules/confctl/kexec-netboot/kexec-netboot.rb
333
332
  - nix/modules/confctl/nix.nix
333
+ - nix/modules/confctl/overlays.nix
334
334
  - nix/modules/confctl/swpins.nix
335
335
  - nix/modules/module-list.nix
336
336
  - nix/modules/system-list.nix
337
337
  - shell.nix
338
338
  - template/confctl-options.nix/main.erb
339
339
  - template/confctl-options.nix/options.erb
340
- homepage:
341
340
  licenses:
342
341
  - GPL-3.0-only
343
342
  metadata: {}
344
- post_install_message:
345
343
  rdoc_options: []
346
344
  require_paths:
347
345
  - lib
@@ -356,8 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
356
354
  - !ruby/object:Gem::Version
357
355
  version: '0'
358
356
  requirements: []
359
- rubygems_version: 3.5.22
360
- signing_key:
357
+ rubygems_version: 3.6.6
361
358
  specification_version: 4
362
359
  summary: Nix deployment management tool
363
360
  test_files: []