mbox

[bug#36555,0/2] Refactor out common behavior for system reconfiguration.

Message ID 87imsci9sj.fsf@sdf.lonestar.org
Headers show

Message

Jakob L. Kreuze July 8, 2019, 7:52 p.m. UTC
Hello, Guix!

This is the preliminary version of a patch series to turn the behavior
common between 'guix deploy' and 'guix system reconfigure' into a module
that both can use. I am submitting it as-is both for comments and for
tracking the refactoring effort.

Note that this is _not_ ready to be merged. There are several things
that I need to do before I would consider it ready for upstream Guix:

- This passes my old test suite for 'guix deploy', but I haven't dared
  to run the new 'guix system reconfigure'. I'll set up a new virtual
  machine so I don't put myself out of a working laptop.
- 'switch-system-program', 'upgrade-services-program', and
  'install-bootloader-program' omit some of the features that were
  present in the procedures they replace. For example,
  'install-bootloader' previously supported installing the bootloader
  configuration without actually running the installation script. This
  was fine for 'guix deploy', but I'll need to add it back in for
  'guix system reconfigure'.
- I plan to implement system tests for '(guix scripts system
  reconfigure)'. I suppose I can always submit them as a separate patch,
  but I'll likely finish them before we're through with code review, so
  it may make sense to include them with as part of this patch series,
  albeit as a distinct commit.
- I suspect that some of the effectful procedures in 'system.scm' could
  be refactored out in a similar fashion. Not that 'guix deploy' would
  necessarily be using them, but it would be more consistent to have
  them as 'program-file' objects, and those procedures could then also
  be tested.

I look forward to your comments.

Regards,
Jakob


Jakob L. Kreuze (2):
  guix system: Add 'reconfigure' module.
  guix system: Reimplement 'reconfigure'.

 Makefile.am                         |   1 +
 gnu/machine/ssh.scm                 | 235 ++++++++--------------------
 guix/scripts/system.scm             | 140 +++++------------
 guix/scripts/system/reconfigure.scm | 158 +++++++++++++++++++
 4 files changed, 255 insertions(+), 279 deletions(-)
 create mode 100644 guix/scripts/system/reconfigure.scm

--
2.22.0

Comments

Jakob L. Kreuze July 9, 2019, 7:07 p.m. UTC | #1
I've implemented the features missing from 'switch-system-program',
'upgrade-services-program', and 'install-bootloader-program' and successfully
ran the new 'guix system reconfigure' in a virtual machine.

Also tests for 'switch-system-program' have been implement, but I realized that
I'll need to be a bit more clever to test 'upgrade-services-program' and
'install-bootloader-program' -- the latter, in particular, requires boot
parameters from the machine being tested at build time, so I suspect I'll have
to provide some constant boot parameters to avoid spinning up the virtual
machine outside of the test derivation.

Anyway, I've reverted a change in my previous patch series that updated
'upgrade-shepherd-services' to use 'call-with-service-upgrade-info', since I'd
neglected to check the parameters that it passes to 'mproc'. Basically, it _has_
to be called from 'upgrade-services-program', which already has some
functionality comparible to 'shepherd-service-upgrade'. If someone could take a
look and ensure that it sufficiently implements 'shepherd-service-upgrade', that
would be greatly appreciated.

On that note, I've changed 'upgrade-services-program' to collect Shepherd error
messages as it goes. Is this the right way to go about it? My thinking is that,
this way, both 'guix system reconfigure' and 'guix deploy' will be able to
report Shepherd errors without stopping half-way through because Shepherd errors
out. Either way, I believe this fixes the issue that Ricardo was having with
'guix deploy'.

Regards,
Jakob

Jakob L. Kreuze (3):
  guix system: Add 'reconfigure' module.
  guix system: Reimplement 'reconfigure'.
  tests: Add reconfigure system test.

 Makefile.am                         |   1 +
 gnu/local.mk                        |   1 +
 gnu/machine/ssh.scm                 | 229 +++++++---------------------
 gnu/tests/reconfigure.scm           |  99 ++++++++++++
 guix/scripts/system.scm             | 143 +++++------------
 guix/scripts/system/reconfigure.scm | 170 +++++++++++++++++++++
 6 files changed, 364 insertions(+), 279 deletions(-)
 create mode 100644 gnu/tests/reconfigure.scm
 create mode 100644 guix/scripts/system/reconfigure.scm