From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZiEJ-00046S-0Q for guix-patches@gnu.org; Wed, 19 Dec 2018 15:14:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZiEE-0004DR-K2 for guix-patches@gnu.org; Wed, 19 Dec 2018 15:14:06 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:50858) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gZiEE-0004DI-F1 for guix-patches@gnu.org; Wed, 19 Dec 2018 15:14:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gZiEE-0002Hu-8m for guix-patches@gnu.org; Wed, 19 Dec 2018 15:14:02 -0500 Subject: [bug#33805] [PATCH]: refresh: Allow searching recursively Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58126) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZiDe-0003f2-1X for guix-patches@gnu.org; Wed, 19 Dec 2018 15:13:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gZiDY-0003lC-BW for guix-patches@gnu.org; Wed, 19 Dec 2018 15:13:25 -0500 Received: from flashner.co.il ([178.62.234.194]:47138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gZiDW-0003jb-Gr for guix-patches@gnu.org; Wed, 19 Dec 2018 15:13:20 -0500 Received: from localhost (unknown [141.226.9.73]) by flashner.co.il (Postfix) with ESMTPSA id DF56440041 for ; Wed, 19 Dec 2018 20:13:14 +0000 (UTC) Date: Wed, 19 Dec 2018 22:13:13 +0200 From: Efraim Flashner Message-ID: <20181219201313.GC2581@macbook41> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CGDBiGfvSTbxKZlW" Content-Disposition: inline List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 33805@debbugs.gnu.org --CGDBiGfvSTbxKZlW Content-Type: multipart/mixed; boundary="T7mxYSe680VjQnyC" Content-Disposition: inline --T7mxYSe680VjQnyC Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Currently no test cases since `guix refresh` needs network access. I currently have two implementations for refresh-recursive, the commented one I started with and was adding cases which caused errors for guix refresh. The second, with par-for-each=C2=B9, has an undefined return value, so it doesn't care about errors (libuv-julia, autoconf-wrapper, etc). I'm pretty sure the par-for-each implementation is faster too. =C2=B9 https://www.gnu.org/software/guile/manual/guile.html#Parallel-Forms --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --T7mxYSe680VjQnyC Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-scripts-refresh-Allow-searching-recursively.patch" Content-Transfer-Encoding: quoted-printable =46rom 8e73b5e0b7ecbac3f4c407cee407b918060b7d1b Mon Sep 17 00:00:00 2001 =46rom: Efraim Flashner Date: Wed, 19 Dec 2018 22:08:18 +0200 Subject: [PATCH] scripts: refresh: Allow searching recursively. * guix/scripts/refresh.scm (refresh-recursive, list-recursive): New procedures. (show-help): Document it. (guix-refresh): Add flags and checks for new options. * doc/guix.texi (Invoking guix refresh): Document new options. --- doc/guix.texi | 32 +++++++++++++++++++++ guix/scripts/refresh.scm | 62 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 20b5013fd..2888d1efb 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -7370,6 +7370,22 @@ are many packages, though, for which it lacks a meth= od to determine whether a new upstream release is available. However, the mechanism is extensible, so feel free to get in touch with us to add a new method! =20 +@table @code + +@item --recursive +Consider the packages specified, and all the packages upon which they depe= nd. + +@example +$ guix refresh --recursive coreutils +gnu/packages/acl.scm:35:2: warning: no updater for acl +gnu/packages/m4.scm:30:12: info: 1.4.18 is already the latest version of m4 +gnu/packages/xml.scm:68:2: warning: no updater for expat +gnu/packages/multiprecision.scm:40:12: info: 6.1.2 is already the latest v= ersion of gmp +@dots{} +@end example + +@end table + Sometimes the upstream name differs from the package name used in Guix, and @command{guix refresh} needs a little help. Most updaters honor the @code{upstream-name} property in package definitions, which can be used @@ -7543,6 +7559,22 @@ hop@@2.4.0 geiser@@0.4 notmuch@@0.18 mu@@0.9.9.5 cfl= ow@@1.4 idutils@@4.6 @dots{} The command above lists a set of packages that could be built to check for compatibility with an upgraded @code{flex} package. =20 +@table @code + +@item --list-recursive +List all the packages which one or more packages depend upon. + +@example +$ guix refresh --list-recursive flex +flex@2.6.4 depends on the following 25 packages: perl@5.28.0 help2man@1.47= =2E6 +bison@3.0.5 indent@2.2.10 tar@1.30 gzip@1.9 bzip2@1.0.6 xz@5.2.4 file@5.33= @dote{} +@end example + +@end table + +The command above lists a set of packages which, when changed, would cause +@code{flex} to be rebuilt. + The following options can be used to customize GnuPG operation: =20 @table @code diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index 1d86f949c..08fd25118 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -5,6 +5,7 @@ ;;; Copyright =C2=A9 2015 Alex Kost ;;; Copyright =C2=A9 2016 Ben Woodcroft ;;; Copyright =C2=A9 2017 Mathieu Othacehe +;;; Copyright =C2=A9 2018 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -40,6 +41,7 @@ #:use-module (ice-9 regex) #:use-module (ice-9 vlist) #:use-module (ice-9 format) + #:use-module (ice-9 threads) ; par-for-each #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) @@ -88,6 +90,12 @@ (option '(#\l "list-dependent") #f #f (lambda (opt name arg result) (alist-cons 'list-dependent? #t result))) + (option '(#\r "recursive") #f #f + (lambda (opt name arg result) + (alist-cons 'recursive? #t result))) + (option '("list-recursive") #f #f + (lambda (opt name arg result) + (alist-cons 'list-recursive? #t result))) =20 (option '("keyring") #t #f (lambda (opt name arg result) @@ -140,6 +148,10 @@ specified with `--select'.\n")) (display (G_ " -l, --list-dependent list top-level dependent packages that would need= to be rebuilt as a result of upgrading PACKAGE...")) + (display (G_ " + -r, --recursive check the PACKAGE and its inputs for upgrades")) + (display (G_ " + --list-recursive list all the packages that PACKAGE depends on")) (newline) (display (G_ " --keyring=3DFILE use FILE as the keyring of upstream OpenPGP key= s")) @@ -323,6 +335,50 @@ dependent packages are rebuilt: ~{~a~^ ~}~%" (map full-name covering)))) (return #t)))) =20 +(define (refresh-recursive packages) + "Check all of the package inputs of PACKAGES for newer upstream versions= =2E" + (mlet %store-monad ((edges (node-edges %bag-node-type + ;; Here we don't want the -boot0 = packages. + (fold-packages cons '())))) + (let ((dependent (node-transitive-edges packages edges))) + ;; par-for-each has an undefined return value, so packages which cau= se + ;; errors can be ignored. + (par-for-each (lambda (package) + ;(for-each (lambda (package) + ; (unless (any (cute string-suffix? <> package) + ; ;; A partial list of package suffixes that + ; ;; cause guix-refresh to error. + ; '("bootstrap" "for-build" "intermediate" + ; "minimal" "union" "without-mesa" "wrappe= r")) + (guix-refresh package)) + ; ) + (map package-name dependent))) + (return #t))) + +(define (list-recursive packages) + "List all the things that would cause PACKAGES to be rebuilt if they are= changed." + ;; Using %BAG-NODE-TYPE is more accurate than using %PACKAGE-NODE-TYPE + ;; because it includes implicit dependencies. + (define (full-name package) + (string-append (package-name package) "@" + (package-version package))) + + (mlet %store-monad ((edges (node-edges %bag-node-type + ;; Here we don't want the -boot0 = packages. + (fold-packages cons '())))) + (let ((dependent (node-transitive-edges packages edges))) + (match packages + ((x) + (format (current-output-port) + (G_ "~a depends on the following ~d packages: ~{~a~^ ~}~%= =2E") + (full-name x) (length dependent) (map full-name dependent= ))) + (lst + (format (current-output-port) + (G_ "The following ~d packages \ +all are dependent packages: ~{~a~^ ~}~%") + (length dependent) (map full-name dependent)))) + (return #t)))) + =0C ;;; ;;; Manifest. @@ -402,7 +458,9 @@ update would trigger a complete rebuild." (let* ((opts (parse-options)) (update? (assoc-ref opts 'update?)) (updaters (options->updaters opts)) + (recursive? (assoc-ref opts 'recursive?)) (list-dependent? (assoc-ref opts 'list-dependent?)) + (list-recursive? (assoc-ref opts 'list-recursive?)) (key-download (assoc-ref opts 'key-download)) =20 ;; Warn about missing updaters when a package is explicitly given= on @@ -441,6 +499,10 @@ update would trigger a complete rebuild." (cond (list-dependent? (list-dependents packages)) + (list-recursive? + (list-recursive packages)) + (recursive? + (refresh-recursive packages)) (update? (parameterize ((%openpgp-key-server (or (assoc-ref opts 'key-server) --=20 2.20.0 --T7mxYSe680VjQnyC-- --CGDBiGfvSTbxKZlW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAlwaplkACgkQQarn3Mo9 g1FVzQ/+PNLkPR9avPovDr3b5jXfzOB9CIPpqhb0fZz16jaoD3DhquOJf3a4n+NT 0OwR3bqm58+5QhWMRHI6YAzA3i5PEp+/Nu9+CkszH00tggwUcwbH3f69A183RLkl gTKnJobssry+Nt0dhvU5l8qeG3+2EZIiNMaBCSbx0ick2uG2NA1dNXs3HBB8stXw I5imGm4iaOc3XKERGPFj+zUBLqchBFdXsd7QIug2I7CAL6LwyUgi7gxhfdLUR08w nR8d80+jhY8U3dazvB7/rmSLy7yGBdsF299dv9dF9cGMbaQEt0TbOKfI9fnkpISX CmfkSITN/sRfyDdiC2yiAMly2UttICtlgDrADQr06MduMBHIdkrLK4+lLHz2syzh gJJx+g1u8fE0CekpowUVsfZgBMF9X44FJKsV4WvxVxN6zGPObSwrH5hJLrNlyea6 2cJueKek4LVEwE6DgNYHM/lMpe0f5lUgQ40OV15m94SXJ3TN6H0Pt3QsTmtElUzB Eux1H6jKuv6QmxeW3ZojEmbC0YUAyATrQDBCma833r7idmrOxT0vKrQ3JzGZfn8c Sle24CKIVJ5KdtsgBjTQ+BuiOvr4sXIF1RymnFXKKnntXcCjJ6lk79OF2UTgBhaa REhSWkD4Vurx3ZQN8fysDN+/xZpE9SDvHKXWpbbqUwXsTlb3CbQ= =y4u6 -----END PGP SIGNATURE----- --CGDBiGfvSTbxKZlW--