From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 07 15:25:25 2020 Received: (at 41752) by debbugs.gnu.org; 7 Jun 2020 19:25:25 +0000 Received: from localhost ([127.0.0.1]:54930 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ji0v6-0000Wi-Tb for submit@debbugs.gnu.org; Sun, 07 Jun 2020 15:25:25 -0400 Received: from tobias.gr ([80.241.217.52]:36112) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ji0v4-0000WP-7o for 41752@debbugs.gnu.org; Sun, 07 Jun 2020 15:25:23 -0400 Received: by tobias.gr (OpenSMTPD) with ESMTP id 83531a76; Sun, 7 Jun 2020 19:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=tobias.gr; h=from:to:cc :subject:references:in-reply-to:date:message-id:mime-version :content-type; s=2018; i=me@tobias.gr; bh=nSFSDUE+a+YR7qkCUi4bAz xTWd9CVt2g61+0eSSIaRA=; b=cL3FXWnJyF+aLdsYGwxmeDlho0F1ECXFbYy6nC CLW7xRKgnl5Zl17MksgfcJS9wC0uembRiSfI/mybWRq61U778PDkUOS1khl+cLAH WegMs8fj3TwF0/zoPZ8Y5x95mr/KLjOaJbbi0WqkIlgN4g+6haWj9pc+F2/ORzo+ 1tezCgJqRNkQT24KjrUoN1dDXNA9RGHPZN54zF2XKi9Eoswlu3QecPj7LoV4VaF/ QR3E1Vgd6mzTPf4O1hnrchTveaxYPmNArcL7ycDItR95h2y8AT8DMBLrwxf/e3gu 9C2QGDQ3RNXZ40PVu8fOgKB4tVPMlcweKE7N2EnQu8f8ZbJg== Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id 310c8234 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Sun, 7 Jun 2020 19:25:27 +0000 (UTC) From: Tobias Geerinckx-Rice To: Oleg Pykhalov Subject: Re: [bug#41752] [PATCH] gnu: Add bash-hosts. References: <20200607182410.4594-1-go.wigust@gmail.com> In-reply-to: <20200607182410.4594-1-go.wigust@gmail.com> Date: Sun, 07 Jun 2020 21:25:18 +0200 Message-ID: <87d06a8yqp.fsf@nckx> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41752 Cc: 41752@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Oleg, Oleg Pykhalov =E5=86=99=E9=81=93=EF=BC=9A > * gnu/packages/admin.scm (bash-hosts): New variable. Thanks! The package should be called just =E2=80=98hosts=E2=80=99. > +(define-public bash-hosts > + (package > + (name "bash-hosts") > + (version "3.5.1") > + (source (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/xwmx/hosts.git") > + (commit version))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 > +=20 > "0q02n28sng0757cgkkc7r45krs07j993k6sgyyp27n8v0l8q6fv4")))) > + (build-system trivial-build-system) > + (inputs > + `(("bash" ,bash))) Like all non-trivial shell scripts it assumes coreutils are=20 present. It also hard-depends on ncurses (for tput), gawk, sed, &=20 grep. You can substitute* these as well, or use wrap-script=20 (which requires adding guile-3.0) since =E2=80=98performance=E2=80=99 proba= bly=20 doesn't matter here. But read on. Keeping optional dependencies (like sudo) up to the user is good. > + (arguments > + `(#:modules ((guix build utils)) > + #:builder > + (begin > + (use-modules (guix build utils)) > + (copy-recursively (assoc-ref %build-inputs "source")=20 > ".") > + (substitute* "hosts" > + (("/usr/bin/env bash") > + (string-append (assoc-ref %build-inputs "bash") > + "/bin/bash"))) > + (install-file "hosts" (string-append %output "/bin")) We should copy LICENSE and README to /share/doc/,name-,version=20 too. > + (let ((bash-completion (string-append %output > +=20 > "/etc/bash_completion.d"))) > + (mkdir-p bash-completion) > + (copy-file "etc/hosts-completion.bash" > + (string-append bash-completion=20 > "/hosts"))) > + #t))) > + (home-page "https://github.com/xwmx/hosts/") > + (synopsis "Command line hosts file editor in a single=20 > portable script") I don't think =E2=80=98in a single portable script=E2=80=99 (like =E2=80=98= Free=E2=80=99 or=20 =E2=80=98cross-platform=E2=80=99 or =E2=80=98now contains Rust!=E2=80=99) a= dds value here. Write=20 @file{hosts} for clarity. > + (description "@code{hosts} is a command line program @code{hosts} should be either @command{hosts} or simply =E2=80=98Hosts=E2= =80=99.=20 I favour the latter, at least for this occurrence. > for managing hosts file entries. You can use @file{/etc/hosts} mark-up here too to make up for it. > @code{hosts} works with existing hosts files and entries, Nitpick: every sentence starting with =E2=80=98Hosts=E2=80=99 sounds odd to= me.=20 This could start with =E2=80=98It=E2=80=99. > +making it easier to add, remove, comment, and search hosts file=20 > entries using > +simple, memorable commands. @code{hosts} is designed to be=20 > lightweight, easy > +to use, and contained in a single, portable script that can be=20 > curled into any > +environment.") Users will have to invoke it as =E2=80=98sh ./hosts=E2=80=99 to skip the pa= tched=20 shebang, but it would work. If we patch or wrap it to include=20 store patch for all dependencies it won't be true at all. If this feature matters to you, I think you could do something=20 like (substitute* "hosts" (("#!/usr/bin/env bash") (string-append "#! "(assoc-ref %build-inputs "bash") "/bin/bash\n" ;; Just a rough example. "PATH=3D\"" (getenv "PATH") ":$PATH\""))) To avoid a separate .hosts-real file and keep the script working=20 both in pure environments and when scp'd to random hosts. But Guix packages in general don't care about being self-contained=20 like this. Maybe it's not worth supporting; one can always curl=20 the unguixed original instead? > + (license license:expat))) I've opened a bug report about the unclear licencing:=20 . Kind regards, T G-R --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQT12iAyS4c9C3o4dnINsP+IT1VteQUCXt0/HgAKCRANsP+IT1Vt eYOxAPwK4G1Bn7K0qA5dvaoReEuj/pmhSwizpnGzToFx+unzwQEAlzPfO03h2rhg yiHjRPSyA8q9EZ2qbqZ+8eVIdUen0gM= =VGJw -----END PGP SIGNATURE----- --=-=-=--