GNU bug report logs - #41752
[PATCH] gnu: Add bash-hosts.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Oleg Pykhalov <go.wigust@HIDDEN>; Keywords: patch; dated Sun, 7 Jun 2020 18:25:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 41752 <at> debbugs.gnu.org:


Received: (at 41752) by debbugs.gnu.org; 7 Jun 2020 19:25:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 15:25:25 2020
Received: from localhost ([127.0.0.1]:54930 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ji0v6-0000Wi-Tb
	for submit <at> 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 <me@HIDDEN>) id 1ji0v4-0000WP-7o
 for 41752 <at> 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@HIDDEN; 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 <me@HIDDEN>
To: Oleg Pykhalov <go.wigust@HIDDEN>
Subject: Re: [bug#41752] [PATCH] gnu: Add bash-hosts.
References: <20200607182410.4594-1-go.wigust@HIDDEN>
In-reply-to: <20200607182410.4594-1-go.wigust@HIDDEN>
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 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
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
<https://github.com/xwmx/hosts/issues/10>.

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-----
--=-=-=--




Information forwarded to guix-patches@HIDDEN:
bug#41752; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Jun 2020 18:24:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 07 14:24:42 2020
Received: from localhost ([127.0.0.1]:54857 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jhzy9-0005Hg-Cr
	for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 14:24:42 -0400
Received: from lists.gnu.org ([209.51.188.17]:39194)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <go.wigust@HIDDEN>) id 1jhzy7-0005HY-6B
 for submit <at> debbugs.gnu.org; Sun, 07 Jun 2020 14:24:27 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:52942)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <go.wigust@HIDDEN>)
 id 1jhzy6-0006IO-V9
 for guix-patches@HIDDEN; Sun, 07 Jun 2020 14:24:26 -0400
Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]:36199)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <go.wigust@HIDDEN>)
 id 1jhzy6-0007TV-5Y
 for guix-patches@HIDDEN; Sun, 07 Jun 2020 14:24:26 -0400
Received: by mail-lj1-x244.google.com with SMTP id a25so17708336ljp.3
 for <guix-patches@HIDDEN>; Sun, 07 Jun 2020 11:24:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=D+xxJeXiaEXlxNmIIr32vL8T0oOPh6+8KJTNbYdxbFI=;
 b=BOLaftroxs6Vu51f1IdeP4DjXzQMlcW/dJJYzApyl+HEf/pw6bLyRZX+alvzb7b4Hm
 8aGwFvmz2Lp16BrUNoaEREYNJe6knKTts3Y3sVU8yMGWP+zLoyxshPTK0cffwI3j+p40
 mfjlZ5lE6llp7aeH2of8ZfyZfSoxU6yLF+RL+LBmtS/Iqq8nQs6aHLfhhc4B41ulv3Lk
 U3gmnuZzrHxfZxba0fnHREBTmJOOG+yUM5+VIrxnhOrUzemOJ/Hv+rMSVS7KpqgfsVhR
 C2ftemc2Yc03oLa6hIXFFRniCwSZ43xo/XXwjE4vbU/GeqReQIfon+vrnoGZk1tw+M7r
 //VQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=D+xxJeXiaEXlxNmIIr32vL8T0oOPh6+8KJTNbYdxbFI=;
 b=hstCK50iaG23C84CWfkWqV9nB5SI0lBAsqgWhKsgaNV7Pdk0bYS47zf+gOYkk4UPsM
 YkUdcUBaazlq6Kax4KMZfwLoqU7OIxLnN4G+exmaxjvcscekHoHOHHSs9+14tFVsl1yH
 Tp+G9dE75LOh2ip2Ccbw2589blPwmn9OHiEMQlVkgNalpA91g+v3V+73h8mxRpmdSShu
 NrVZFEXpNJ7gSFJd3ZUtrNOawxIG0QlypcHyvD9nDM1hiI7LP5a26uNba0mw/THy+Jr3
 AIwwxaYIa5RbJlux9Cz3SuoXgMyeuy0x13IkND9HOJVg9kyZBipNb76QckXvM+uCTkD4
 EMbQ==
X-Gm-Message-State: AOAM5313g6tmvYxnPk2x5dXFh9ZcyxA9hv9fU9baOZcW4kZJ23qEZxAH
 bHHBsViHh62Vjvp9rbgpmHtW6xcy
X-Google-Smtp-Source: ABdhPJwRhZ4w6Vjo7vid3jkbpIQwGl8/BBccbT+u6is7mursOGoQFqVF7f1PBIAIU/6+rjUqvXd3CA==
X-Received: by 2002:a2e:7f10:: with SMTP id a16mr5109832ljd.69.1591554264366; 
 Sun, 07 Jun 2020 11:24:24 -0700 (PDT)
Received: from localhost.localdomain (92-100-136-169.dynamic.avangarddsl.ru.
 [92.100.136.169])
 by smtp.gmail.com with ESMTPSA id l14sm258267lja.2.2020.06.07.11.24.23
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 07 Jun 2020 11:24:23 -0700 (PDT)
From: Oleg Pykhalov <go.wigust@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] gnu: Add bash-hosts.
Date: Sun,  7 Jun 2020 21:24:10 +0300
Message-Id: <20200607182410.4594-1-go.wigust@HIDDEN>
X-Mailer: git-send-email 2.26.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2a00:1450:4864:20::244;
 envelope-from=go.wigust@HIDDEN; helo=mail-lj1-x244.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
 That's all we know.
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001,
 URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
Cc: Oleg Pykhalov <go.wigust@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

* gnu/packages/admin.scm (bash-hosts): New variable.
---
 gnu/packages/admin.scm | 43 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm
index bb93f7efb1..dd0ada0422 100644
--- a/gnu/packages/admin.scm
+++ b/gnu/packages/admin.scm
@@ -3841,3 +3841,46 @@ It supports mounting local filesystems of any kind the normal mount utility
 supports.  It can also mount encrypted LUKS volumes using the password
 supplied by the user when logging in.")
     (license (list license:gpl2+ license:lgpl2.1+))))
+
+(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
+                "0q02n28sng0757cgkkc7r45krs07j993k6sgyyp27n8v0l8q6fv4"))))
+    (build-system trivial-build-system)
+    (inputs
+     `(("bash" ,bash)))
+    (arguments
+     `(#:modules ((guix build utils))
+       #:builder
+       (begin
+         (use-modules (guix build utils))
+         (copy-recursively (assoc-ref %build-inputs "source") ".")
+         (substitute* "hosts"
+           (("/usr/bin/env bash")
+            (string-append (assoc-ref %build-inputs "bash")
+                           "/bin/bash")))
+         (install-file "hosts" (string-append %output "/bin"))
+         (let ((bash-completion (string-append %output
+                                               "/etc/bash_completion.d")))
+           (mkdir-p bash-completion)
+           (copy-file "etc/hosts-completion.bash"
+                      (string-append bash-completion "/hosts")))
+         #t)))
+    (home-page "https://github.com/xwmx/hosts/")
+    (synopsis "Command line hosts file editor in a single portable script")
+    (description "@code{hosts} is a command line program for managing hosts
+file entries.  @code{hosts} works with existing hosts files and entries,
+making it easier to add, remove, comment, and search hosts file entries using
+simple, memorable commands.  @code{hosts} is designed to be lightweight, easy
+to use, and contained in a single, portable script that can be curled into any
+environment.")
+    (license license:expat)))
-- 
2.26.2





Acknowledgement sent to Oleg Pykhalov <go.wigust@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#41752; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 7 Jun 2020 19:30:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.