Bug 240177

Summary: sysutils/iocage: Fix `iocage upgrade` (to 11.3-RELEASE and future 12.x releases)
Product: Ports & Packages Reporter: Michael Gmelin <grembo>
Component: Individual Port(s)Assignee: Michael Gmelin <grembo>
Status: Closed FIXED    
Severity: Affects Some People Flags: bugzilla: maintainer-feedback? (araujo)
grembo: merge-quarterly?
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://github.com/iocage/iocage/pull/1027
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229346
https://github.com/iocage/iocage/pull/1027
Attachments:
Description Flags
Fix iocage upgrade - patch
none
Patch to fix iocage upgrade - updated to version none

Description Michael Gmelin freebsd_committer freebsd_triage 2019-08-28 17:42:51 UTC
Created attachment 206984 [details]
Fix iocage upgrade - patch

This addresses a couple problems that prevented `iocage upgrade' from working properly.

1. Bug #229346 changed freebsd-update to exit with status code 1 in case of no more updates are available. This fixed ezjail and iocell, but broke iocage. As a result, iocage upgrade -r 11.3-RELEASE would not finish updating iocage jail config and exit with an error message. This happened first on 11.3-RELEASE and will also happen on 12.1-RELEASE

2. When updating a jail to 11.x-RELEASE on a 12.x machine, merging config files will create empty files (which then all end up as merge errors). As a result, all configuration is lost (or the attentive sysadmin exits the process in time and fixes things manually). This is caused by the fact that rcs was removed from base in 12.x. Its freebsd-update uses diff3 instead. As iocage always fetches the freebsd-update script of the target release, it gets one from 11.x which will break. This was fixed by adding rcs57 as a dependency of the package (based on the existence of "merge").

3. Upgrading multiple jails (iocage upgrade ALL -r <release>) would break, because of a workaround (setting UNAME_r in the environment) that shouldn't be required any more (iocage 1.2RC already has it removed).

I also:
- bumped revision
- moved NO_ARCH to pacify portlint

See also:
https://github.com/iocage/iocage/pull/1027
Comment 1 Michael Gmelin freebsd_committer freebsd_triage 2019-08-30 01:53:29 UTC
Created attachment 207014 [details]
Patch to fix iocage upgrade - updated to version

The new version includes a runaway check in case future versions of freebsd-update cause breakage. I'll add a comment to this bug with a link to the commit, once it's merged into upstream.
Comment 2 Michael Gmelin freebsd_committer freebsd_triage 2019-08-30 10:29:50 UTC
The pull request[0] has been merged[1] upstream now

[0]https://github.com/iocage/iocage/pull/1027
[1]https://github.com/iocage/iocage/commit/f66d9f0724daa03dc08cebc3f30b04abc7e97f82
Comment 3 Michael Gmelin freebsd_committer freebsd_triage 2019-09-10 20:37:59 UTC
@araujo Do you object to any of the changes in the patch? (maintainer feedback).
Comment 4 Michael Gmelin freebsd_committer freebsd_triage 2019-09-19 00:03:55 UTC
Taking and committing (maintainer timeout). I think it's a good point in time to commit this, as:

- It's affecting more and more people (the 11.3 update issue as well as the diff3 issue on >= 12-RELEASE).
- 11.2 is close to EoL (freebsd-update is already emitting warnings), this means more people will try to upgrade to 11.3 (and get into trouble).
- It's still >10 days from cutting 2019Q4, so if there is anything really stupid in this commit, it can be fixed before it hits quarterly.
- People on quarterly will have a fixed, but otherwise proven version in 2019Q4 (which is not 1.2, which might have new issues for all I know).
- 12.1-RELEASE is supposed to happen in Q4, which will be affected in the same way as 11.3-RELEASE is. So one more reason why we need a fixed version in 2019Q4.

Note that in addition to the patch from 2019-08-30, the commit will include a patch to allow `make check-plist'/`poudriere testport' finish successfully, something I noticed while QA'ing the patches (see https://github.com/iocage/iocage/issues/1043 for details).

Besides having the changes reviewed and merged upstream, I did local testing (including poudriere runs).
Comment 5 commit-hook freebsd_committer freebsd_triage 2019-09-19 00:21:17 UTC
A commit references this bug:

Author: grembo
Date: Thu Sep 19 00:21:11 UTC 2019
New revision: 512299
URL: https://svnweb.freebsd.org/changeset/ports/512299

Log:
  Fix `iocage upgrade' for 11.3-RELEASE and upcoming 12.1-RELEASE[0]

  Also:
  - Fix dependencies when upgrading <12 jails running on a 12-RELEASE jailhost
    (depend on `merge' from devel/rcs57).
  - Fix to unbreak updating multiple jails at once[1].
  - Patch to `setup.py' to make `make check-plist' pass[2].
  - Move `NO_ARCH' to make portlint happy

  See:
  [0]https://github.com/iocage/iocage/pull/1027 and
  https://github.com/iocage/iocage/commit/f66d9f0724daa03dc08cebc3f30b04abc7e97f82
  [1]https://github.com/iocage/iocage/commit/47d7c28ad2db76eaba797921555bbf68a476eb9b#diff-134cbca4d064a61a693d1199494d24df
  [2]https://github.com/iocage/iocage/issues/1043

  PR:		240177
  Approved by:	araujo (maintainer timeout)

Changes:
  head/sysutils/iocage/Makefile
  head/sysutils/iocage/files/patch-iocage_lib-ioc_upgrade.py
  head/sysutils/iocage/files/patch-setup.py
Comment 6 commit-hook freebsd_committer freebsd_triage 2019-09-24 20:50:21 UTC
A commit references this bug:

Author: grembo
Date: Tue Sep 24 20:49:33 UTC 2019
New revision: 352662
URL: https://svnweb.freebsd.org/changeset/base/352662

Log:
  freebsd-update: Add `updatesready' and `showconfig' commands

  `freebsd-update updatesready' can be used to check if there are any pending
  fetched updates that can be installed.

  `freebsd-update showconfig' writes freebsd-update's configuration to
  stdout.

  This also changes the exit code of `freebsd-update install' to 2 in case
  there are no updates pending to be installed and there wasn't a fetch phase
  in the same invocation. This allows scripts to tell apart these error
  conditions without breaking existing jail managers.

  See freebsd-update(8) for details.

  PR:		240757, 240177, 229346
  Reviewed by:	manpages (bcr), sectam (emaste), yuripv
  Differential Revision:	https://reviews.freebsd.org/D21473

Changes:
  head/usr.sbin/freebsd-update/freebsd-update.8
  head/usr.sbin/freebsd-update/freebsd-update.sh
Comment 7 commit-hook freebsd_committer freebsd_triage 2019-09-26 16:33:31 UTC
A commit references this bug:

Author: grembo
Date: Thu Sep 26 16:33:21 UTC 2019
New revision: 352758
URL: https://svnweb.freebsd.org/changeset/base/352758

Log:
  MFC r352513, r352514, r352662:

  As suggested by koobs, MFC recent freebsd-update changes to
  have a consistent user experience on all supported
  versions.

  r352513:
  freebsd-update.8: appease igor

  igor follows American style guides in the belief that abbreviations i.e.
  and e.g. are always followed by a comma.  Make that change now so that
  future updates to freebsd-update.8 do not complain about this.

  r352514:
  freebsd-update: make usage output consistent

  Drop trailing . which appeared only on description of IDS.

  r352662:
  freebsd-update: Add `updatesready' and `showconfig' commands

  `freebsd-update updatesready' can be used to check if there are any pending
  fetched updates that can be installed.

  `freebsd-update showconfig' writes freebsd-update's configuration to
  stdout.

  This also changes the exit code of `freebsd-update install' to 2 in case
  there are no updates pending to be installed and there wasn't a fetch phase
  in the same invocation. This allows scripts to tell apart these error
  conditions without breaking existing jail managers.

  PR:		240757, 240177, 229346
  Reviewed by:	manpages (bcr), secteam (emaste), yuripv
  Differential Revision:	https://reviews.freebsd.org/D21473

Changes:
  stable/11/usr.sbin/freebsd-update/freebsd-update.8
  stable/11/usr.sbin/freebsd-update/freebsd-update.sh
Comment 8 commit-hook freebsd_committer freebsd_triage 2019-09-26 16:35:39 UTC
A commit references this bug:

Author: grembo
Date: Thu Sep 26 16:34:44 UTC 2019
New revision: 352759
URL: https://svnweb.freebsd.org/changeset/base/352759

Log:
  MFC r352513, r352514, r352662:

  As suggested by koobs, MFC recent freebsd-update changes to
  have a consistent user experience on all supported
  versions.

  r352513:
  freebsd-update.8: appease igor

  igor follows American style guides in the belief that abbreviations i.e.
  and e.g. are always followed by a comma.  Make that change now so that
  future updates to freebsd-update.8 do not complain about this.

  r352514:
  freebsd-update: make usage output consistent

  Drop trailing . which appeared only on description of IDS.

  r352662:
  freebsd-update: Add `updatesready' and `showconfig' commands

  `freebsd-update updatesready' can be used to check if there are any pending
  fetched updates that can be installed.

  `freebsd-update showconfig' writes freebsd-update's configuration to
  stdout.

  This also changes the exit code of `freebsd-update install' to 2 in case
  there are no updates pending to be installed and there wasn't a fetch phase
  in the same invocation. This allows scripts to tell apart these error
  conditions without breaking existing jail managers.

  PR:		240757, 240177, 229346
  Reviewed by:	manpages (bcr), secteam (emaste), yuripv
  Differential Revision:	https://reviews.freebsd.org/D21473

Changes:
  stable/12/usr.sbin/freebsd-update/freebsd-update.8
  stable/12/usr.sbin/freebsd-update/freebsd-update.sh
Comment 9 commit-hook freebsd_committer freebsd_triage 2019-09-26 20:56:11 UTC
A commit references this bug:

Author: grembo
Date: Thu Sep 26 20:56:08 UTC 2019
New revision: 352774
URL: https://svnweb.freebsd.org/changeset/base/352774

Log:
  MF stable/12 r352759,r352771

  Approved by:	re (gjb)

  r352759:
  freebsd-update.8: Style fixes, document new features.
  freebsd-update:   Make usage output consistent.
  freebsd-update:   Add `updatesready' and `showconfig' commands
  freebsd-update:   Change exit code of `freebsd-update install' to 2
                    in case there are no pending updates and there wasn't
                    a fetch phase in the same invocation.

  r352771:
  Add mergeinfo missing in r352759

  PR:		240757, 240177, 229346
  Reviewed by:	manpages (bcr), secteam (emaste), yuripv
  Differential Revision:	https://reviews.freebsd.org/D21473

Changes:
_U  releng/12.1/
  releng/12.1/usr.sbin/freebsd-update/freebsd-update.8
  releng/12.1/usr.sbin/freebsd-update/freebsd-update.sh