Bug 205998 - release/release.sh fails if packages are already installed in chroot
Summary: release/release.sh fails if packages are already installed in chroot
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 10.2-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: Glen Barber
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2016-01-07 08:10 UTC by Enji Cooper
Modified: 2016-01-14 00:47 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer 2016-01-07 08:10:36 UTC
I used release/release.sh in a chroot more than once, and unfortunately it failed when installing packages in the chroot, until I replaced the following `install` lines with `reinstall` (which effectively does -DFORCE_PKG_REGISTER).

It might be a good idea to use similar logic with chroots that are used more than once..

$ svn diff release/                                                                                                                                                                  
Index: release/release.sh
===================================================================
--- release/release.sh  (revision 293115)
+++ release/release.sh  (working copy)
@@ -275,7 +275,7 @@
                        PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}"
                        chroot ${CHROOTDIR} make -C /usr/ports/textproc/docproj \
                                ${PBUILD_FLAGS} OPTIONS_UNSET="FOP IGOR" \
-                               install clean distclean
+                               reinstall clean distclean
                fi
        fi
 
@@ -282,7 +282,7 @@
        if [ ! -z "${EMBEDDEDPORTS}" ]; then
                for _PORT in ${EMBEDDEDPORTS}; do
                        eval chroot ${CHROOTDIR} make -C /usr/ports/${_PORT} \
-                               BATCH=1 FORCE_PKG_REGISTER=1 install clean distclean
+                               BATCH=1 FORCE_PKG_REGISTER=1 reinstall clean distclean
                done
        fi
Comment 1 commit-hook freebsd_committer 2016-01-09 00:46:03 UTC
A commit references this bug:

Author: gjb
Date: Sat Jan  9 00:45:38 UTC 2016
New revision: 293452
URL: https://svnweb.freebsd.org/changeset/base/293452

Log:
  Set FORCE_PKG_REGISTER=1 when installing packages to avoid failures
  when re-using build chroot(8) environments.

  This is based on the patch in the PR referenced below, but instead
  of using 'reinstall' in two locations (one of which already uses
  FORCE_PKG_REGISTER=1), changes the non-embedded behavior.

  PR:		205998
  Submitted by:	ngie
  MFC after:	5 days
  Sponsored by:	The FreeBSD Foundation

Changes:
  head/release/release.sh
Comment 2 Glen Barber freebsd_committer 2016-01-09 00:48:04 UTC
A simpler change was committed, since FORCE_PKG_REGISTER=1 was already used in the embedded build path.

I will MFC after 5 days, when this is tested with the next set of snapshot builds.

Thank you for the report and patch.
Comment 3 Glen Barber freebsd_committer 2016-01-09 00:49:43 UTC
On a side note, regarding a comment in the original PR text, the intent of this script is to build releases in a pristine environment.  Re-using chroot(8) environments is not something this script is intended (nor planned to intend) to support.
Comment 4 commit-hook freebsd_committer 2016-01-14 00:27:22 UTC
A commit references this bug:

Author: gjb
Date: Thu Jan 14 00:26:32 UTC 2016
New revision: 293859
URL: https://svnweb.freebsd.org/changeset/base/293859

Log:
  MFC 293452:
    Set FORCE_PKG_REGISTER=1 when installing packages to avoid failures
    when re-using build chroot(8) environments.

  PR:		205998
  Sponsored by:	The FreeBSD Foundation

Changes:
_U  stable/10/
  stable/10/release/release.sh
Comment 5 Enji Cooper freebsd_committer 2016-01-14 00:47:41 UTC
Thanks gjb :)!