[PATCH 0/3] Fix usbguard's warning about 'catch'.

  • Done
  • quality assurance status badge
Details
2 participants
  • Brice Waegeneire
  • Ludovic Courtès
Owner
unassigned
Submitted by
Brice Waegeneire
Severity
normal
B
B
Brice Waegeneire wrote on 1 May 2020 15:06
(address . guix-patches@gnu.org)
20200501130604.4180-1-brice@waegenei.re
This patch fix the issue in usbguard reported by Ludo[0] about warnings from
'catch' using a wrong include path, usguard now use a packaged 'pegtl'
dependency instead of the bundled one.


Brice Waegeneire (3):
gnu: Add pegtl.
gnu: usbguard: Use packaged 'pegtl'.
gnu: usbguard: Fix warning about 'catch'.

gnu/packages/cpp.scm | 22 ++++++++++++++++++++++
gnu/packages/hardware.scm | 29 ++++++++++++++++++-----------
2 files changed, 40 insertions(+), 11 deletions(-)

--
2.26.0
B
B
Brice Waegeneire wrote on 1 May 2020 15:09
[PATCH 1/3] gnu: Add pegtl.
(address . 40996@debbugs.gnu.org)
20200501130930.5888-1-brice@waegenei.re
* gnu/packages/cpp.scm (pegtl): New variable.
---
gnu/packages/cpp.scm | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)

Toggle diff (39 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 2248ebfc4b..cdc1c0e0f4 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -9,6 +9,7 @@
;;; Copyright © 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
;;; Copyright © 2020 Roel Janssen <roel@gnu.org>
;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -485,3 +486,24 @@ point and then, after each tween step, plugging back the result.")
augment the C++ standard library. The Abseil library code is collected from
Google's C++ code base.")
(license license:asl2.0)))
+
+(define-public pegtl
+ (package
+ (name "pegtl")
+ (version "2.8.3")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/taocpp/PEGTL.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "17crgjfdx55imi2dqnz6xpvsxq07390yfgkz5nd2g77ydkvq9db3"))))
+ (build-system cmake-build-system)
+ (home-page "https://github.com/taocpp/PEGTL")
+ (synopsis "Parsing Expression Grammar Template Library")
+ (description "The Parsing Expression Grammar Template Library (PEGTL) is
+a zero-dependency C++ header-only parser combinator library for creating
+parsers according to a Parsing Expression Grammar (PEG).")
+ (license license:expat)))
--
2.26.0
B
B
Brice Waegeneire wrote on 1 May 2020 15:09
[PATCH 2/3] gnu: usbguard: Use packaged 'pegtl'.
(address . 40996@debbugs.gnu.org)
20200501130930.5888-2-brice@waegenei.re
* gnu/packages/hardware.scm (usbguard)[arguments]: Remove configure flag
'--with-bundled-pegtl'.
[inputs]: Add 'pegtl'
---
gnu/packages/hardware.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Toggle diff (30 lines)
diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index ce3f396d0a..74fd282191 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -24,6 +24,7 @@
#:use-module (gnu packages bash)
#:use-module (gnu packages compression)
#:use-module (gnu packages check)
+ #:use-module (gnu packages cpp)
#:use-module (gnu packages crypto)
#:use-module (gnu packages documentation)
#:use-module (gnu packages gcc)
@@ -429,7 +430,6 @@ applications.")
#:configure-flags
(list
"--localstatedir=/var"
- "--with-bundled-pegtl"
"--enable-systemd=no"
"--with-ldap"
"--with-dbus"
@@ -442,6 +442,7 @@ applications.")
("libcap-ng" ,libcap-ng)
("libseccomp" ,libseccomp)
("libsodium" ,libsodium)
+ ("pegtl" ,pegtl)
("polkit" ,polkit)
("protobuf" ,protobuf)
("libqb" ,libqb)))
--
2.26.0
B
B
Brice Waegeneire wrote on 1 May 2020 15:09
[PATCH 3/3] gnu: usbguard: Fix warning about 'catch'.
(address . 40996@debbugs.gnu.org)
20200501130930.5888-3-brice@waegenei.re
* gnu/packages/hardware.scm (usgbuard)[source]: Get it from git.
[arguments]: Rename phase 'patch-makefile' to 'patch-build-scripts',
adjust it for the source from git and fix 'catch' path.
[native-inputs]: Add 'libtool'.
---
gnu/packages/hardware.scm | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)

Toggle diff (51 lines)
diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index 74fd282191..de4f82e105 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -389,21 +389,26 @@ applications.")
(name "usbguard")
(version "0.7.6")
(source (origin
- (method url-fetch)
- (uri (string-append
- "https://github.com/USBGuard/usbguard/releases/download/usbguard-"
- version "/usbguard-" version ".tar.gz"))
- (file-name (git-file-name name version))
- (sha256
- (base32 "0gzhs8s4aka86mkcjib36z54si939ki4bmk46p6v8kln1fixad3j"))))
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/USBGuard/usbguard.git")
+ (commit (string-append name "-" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1x8pvlfy3b87iqxh2bjzjd4w26fllwd25c4haz9rqkrvrl27nx38"))))
(build-system gnu-build-system)
(arguments
`(#:phases
(modify-phases %standard-phases
- (add-after 'configure 'patch-makefile
- (lambda _
+ (add-after 'unpack 'patch-build-scripts
+ (lambda* (#:key inputs #:allow-other-keys)
+ (delete-file "autogen.sh") ; Want network access
+ (substitute* "configure.ac"
+ (("/usr/include/catch")
+ (string-append (assoc-ref inputs "catch") "/include")))
;; Do not create log directory.
- (substitute* "Makefile" ((".*/log/usbguard.*") ""))
+ (substitute* "Makefile.am" ((".*/log/usbguard.*") ""))
;; Disable LDAP tests: they use 'sudo'.
(substitute* "src/Tests/Makefile.am"
(("WITH_LDAP") "FALSE"))
@@ -452,6 +457,7 @@ applications.")
("automake" ,automake)
("bash-completion" ,bash-completion)
("gdbus-codegen" ,glib "bin")
+ ("libtool" ,libtool)
("umockdev" ,umockdev)
("xmllint" ,libxml2)
("xsltproc" ,libxslt)
--
2.26.0
L
L
Ludovic Courtès wrote on 4 May 2020 22:13
Re: [bug#40996] [PATCH 1/3] gnu: Add pegtl.
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 40996@debbugs.gnu.org)
87zhanpifu.fsf@gnu.org
Hi!

Brice Waegeneire <brice@waegenei.re> skribis:

Toggle quote (2 lines)
> * gnu/packages/cpp.scm (pegtl): New variable.

[...]

Toggle quote (2 lines)
> +(define-public pegtl
> + (package
^
Indentation is off.

Toggle quote (2 lines)
> + (synopsis "Parsing Expression Grammar Template Library")

I’d remove at least the capital T and L. :-)

Otherwise LGTM!

Ludo’.
L
L
Ludovic Courtès wrote on 4 May 2020 22:13
Re: [bug#40996] [PATCH 2/3] gnu: usbguard: Use packaged 'pegtl'.
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 40996@debbugs.gnu.org)
87v9lbpife.fsf@gnu.org
Brice Waegeneire <brice@waegenei.re> skribis:

Toggle quote (4 lines)
> * gnu/packages/hardware.scm (usbguard)[arguments]: Remove configure flag
> '--with-bundled-pegtl'.
> [inputs]: Add 'pegtl'

LGTM!
L
L
Ludovic Courtès wrote on 4 May 2020 22:17
Re: [bug#40996] [PATCH 3/3] gnu: usbguard: Fix warning about 'catch'.
(name . Brice Waegeneire)(address . brice@waegenei.re)(address . 40996@debbugs.gnu.org)
87pnbjpi97.fsf@gnu.org
Brice Waegeneire <brice@waegenei.re> skribis:

Toggle quote (5 lines)
> * gnu/packages/hardware.scm (usgbuard)[source]: Get it from git.
> [arguments]: Rename phase 'patch-makefile' to 'patch-build-scripts',
> adjust it for the source from git and fix 'catch' path.
> [native-inputs]: Add 'libtool'.

[...]

Toggle quote (10 lines)
> (source (origin
> - (method url-fetch)
> - (uri (string-append
> - "https://github.com/USBGuard/usbguard/releases/download/usbguard-"
> - version "/usbguard-" version ".tar.gz"))
> - (file-name (git-file-name name version))
> - (sha256
> - (base32 "0gzhs8s4aka86mkcjib36z54si939ki4bmk46p6v8kln1fixad3j"))))
> + (method git-fetch)

In this particular case, perhaps you can keep using the tarball, and then…

[...]

Toggle quote (5 lines)
> + (delete-file "autogen.sh") ; Want network access
> + (substitute* "configure.ac"
> + (("/usr/include/catch")
> + (string-append (assoc-ref inputs "catch") "/include")))

… modify ‘configure’ directly, since it’s a simple and unambiguous
change. That avoids the extra autotools dependencies (actually Autoconf
and Automake were unnecessary before, no?).

Anyway, one way or another, it’s a worthy change, so go for it!

Ludo’.
B
B
Brice Waegeneire wrote on 7 May 2020 11:33
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 40996-done@debbugs.gnu.org)
c31533f70cda131c8fb895a810a562b0@waegenei.re
On 2020-05-04 20:17, Ludovic Courtès wrote:
Toggle quote (24 lines)
> Brice Waegeneire <brice@waegenei.re> skribis:
>
>> * gnu/packages/hardware.scm (usgbuard)[source]: Get it from git.
>> [arguments]: Rename phase 'patch-makefile' to 'patch-build-scripts',
>> adjust it for the source from git and fix 'catch' path.
>> [native-inputs]: Add 'libtool'.
>
> [...]
>
>> (source (origin
>> - (method url-fetch)
>> - (uri (string-append
>> -
>> "https://github.com/USBGuard/usbguard/releases/download/usbguard-"
>> - version "/usbguard-" version ".tar.gz"))
>> - (file-name (git-file-name name version))
>> - (sha256
>> - (base32
>> "0gzhs8s4aka86mkcjib36z54si939ki4bmk46p6v8kln1fixad3j"))))
>> + (method git-fetch)
>
> In this particular case, perhaps you can keep using the tarball, and
> then…

This part has been dropped.

Toggle quote (13 lines)
> [...]
>
>> + (delete-file "autogen.sh") ; Want network access
>> + (substitute* "configure.ac"
>> + (("/usr/include/catch")
>> + (string-append (assoc-ref inputs "catch")
>> "/include")))
>
> … modify ‘configure’ directly, since it’s a simple and unambiguous
> change. That avoids the extra autotools dependencies (actually
> Autoconf
> and Automake were unnecessary before, no?).

Autotools dependencies were needed because I was patching Makefile.am
files,
but it's not the case anymore by modifying Makefile.in instead.

Toggle quote (2 lines)
> Anyway, one way or another, it’s a worthy change, so go for it!

Pushed as f96ddb60962703eaae5433399905b9d81a99ea13.

- Brice
Closed
?