From owner-svn-src-head@freebsd.org Thu Dec 27 23:27:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2887214269CA; Thu, 27 Dec 2018 23:27:49 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ADE8069EFF; Thu, 27 Dec 2018 23:27:48 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AA0F1AA55; Thu, 27 Dec 2018 23:27:48 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wBRNRmJc013520; Thu, 27 Dec 2018 23:27:48 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wBRNRmLd013519; Thu, 27 Dec 2018 23:27:48 GMT (envelope-from will@FreeBSD.org) Message-Id: <201812272327.wBRNRmLd013519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Thu, 27 Dec 2018 23:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342560 - head/tools/build X-SVN-Group: head X-SVN-Commit-Author: will X-SVN-Commit-Paths: head/tools/build X-SVN-Commit-Revision: 342560 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ADE8069EFF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Dec 2018 23:27:49 -0000 Author: will Date: Thu Dec 27 23:27:48 2018 New Revision: 342560 URL: https://svnweb.freebsd.org/changeset/base/342560 Log: beinstall: try to save progress from pkg updates. This is primarily aimed at failed updates due to package conflicts, and affects treatment of failed updates. Whereas before potentially a large number of packages would need to be synced for each attempt, they can now be persisted. Requires rsync. There may be better ways to implement this, e.g. using secondary cache path that is only used on followup attempts and then wiped on success, which avoids polluting current cache. Modified: head/tools/build/beinstall.sh Modified: head/tools/build/beinstall.sh ============================================================================== --- head/tools/build/beinstall.sh Thu Dec 27 22:44:07 2018 (r342559) +++ head/tools/build/beinstall.sh Thu Dec 27 23:27:48 2018 (r342560) @@ -82,6 +82,14 @@ unmount_be() { mount | grep " on ${BE_MNTPT}" | awk '{print $3}' | sort -r | xargs -t umount -f } +copy_pkgs() { + # Before cleaning up, try to save progress in pkg(8) updates, to + # speed up future updates. This is only called on the error path; + # no need to run on success. + echo "Rsyncing back newly saved packages..." + rsync -av --progress ${BE_MNTPT}/var/cache/pkg/. /var/cache/pkg/. +} + cleanup_be() { # Before destroying, unmount any child filesystems that may have # been mounted under the boot environment. Sort them in reverse @@ -223,6 +231,10 @@ chroot ${BE_MNTPT} make "$@" -C ${srcdir} installworld if [ -n "${CONFIG_UPDATER}" ]; then "update_${CONFIG_UPDATER}" [ $? -ne 0 ] && errx "${CONFIG_UPDATER} (post-world) failed!" +fi + +if which rsync >/dev/null 2>&1; then + cleanup_commands="copy_pkgs ${cleanup_commands}" fi BE_PKG="chroot ${BE_MNTPT} env ASSUME_ALWAYS_YES=true pkg"