From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id SPPWM1Q/3V6zNQAA0tVLHw (envelope-from ) for ; Sun, 07 Jun 2020 19:26:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id IMKdL1Q/3V7aBgAAbx9fmQ (envelope-from ) for ; Sun, 07 Jun 2020 19:26:12 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 544BF94036C for ; Sun, 7 Jun 2020 19:26:12 +0000 (UTC) Received: from localhost ([::1]:49614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ji0vr-0008GI-8D for larch@yhetil.org; Sun, 07 Jun 2020 15:26:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58124) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ji0vj-0008Fp-GO for guix-patches@gnu.org; Sun, 07 Jun 2020 15:26:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43395) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ji0vj-00010Q-7B for guix-patches@gnu.org; Sun, 07 Jun 2020 15:26:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ji0vj-0000YA-3r for guix-patches@gnu.org; Sun, 07 Jun 2020 15:26:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41752] [PATCH] gnu: Add bash-hosts. Resent-From: Tobias Geerinckx-Rice Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 07 Jun 2020 19:26:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41752 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Oleg Pykhalov Cc: 41752@debbugs.gnu.org Received: via spool by 41752-submit@debbugs.gnu.org id=B41752.15915579252032 (code B ref 41752); Sun, 07 Jun 2020 19:26:03 +0000 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) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" Reply-to: Tobias Geerinckx-Rice , Tobias Geerinckx-Rice via Guix-patches From: Tobias Geerinckx-Rice via Guix-patches via X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=tobias.gr header.s=2018 header.b=cL3FXWnJ; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -1.61 X-TUID: Wc6BrjuxOL6m --=-=-= 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----- --=-=-=--