GNU bug report logs -
#56642
[PATCH] gnu: Make libphonenumber reproducible.
Previous Next
Reported by: Antero Mejr <antero <at> mailbox.org>
Date: Tue, 19 Jul 2022 15:29:01 UTC
Severity: normal
Tags: patch
Done: Jonathan Brielmaier <jonathan.brielmaier <at> web.de>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 56642 in the body.
You can then email your comments to 56642 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#56642
; Package
guix-patches
.
(Tue, 19 Jul 2022 15:29:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Antero Mejr <antero <at> mailbox.org>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Tue, 19 Jul 2022 15:29:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/telephony.scm (libphonenumber): New variable.
* gnu/packages/messaging.scm (libphonenumber): Delete variable (moved).
---
Moved libphonenumber because it's a telephony package, plus it will avoid
circular deps for other telephony packages than depend on it (like pn).
Used substitute* instead of a patch to make libphonenumber reproducible
because it's a 2-line change, I can do it using a patch if preferred.
gnu/packages/messaging.scm | 32 -----------------------------
gnu/packages/telephony.scm | 42 ++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 32 deletions(-)
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index b68a798715..f08df1a5e4 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -2772,38 +2772,6 @@ (define-public purple-lurch
(home-page "https://github.com/gkdr/lurch")
(license license:gpl3+)))
-(define-public libphonenumber
- (package
- (name "libphonenumber")
- (version "8.11.3")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/google/libphonenumber")
- (commit (string-append "v" version))))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "06y3mh1d1mks6d0ynxp3980g712nkf8l5nyljpybsk326b246hg9"))))
- (arguments
- `(#:test-target "tests"
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'change-directory
- (lambda _ (chdir "cpp"))))))
- (build-system cmake-build-system)
- (native-inputs
- (list googletest pkg-config))
- (inputs
- (list boost protobuf icu4c))
- (synopsis "Library for parsing and using phone numbers")
- (description
- "This package provides a C++ library for parsing, formatting, and
-validating international phone numbers.")
- (home-page "https://github.com/google/libphonenumber")
- (license license:asl2.0)))
-
-
(define-public chatty
(package
(name "chatty")
diff --git a/gnu/packages/telephony.scm b/gnu/packages/telephony.scm
index e3071d9b75..410d3d8591 100644
--- a/gnu/packages/telephony.scm
+++ b/gnu/packages/telephony.scm
@@ -22,6 +22,7 @@
;;; Copyright © 2021 LibreMiami <packaging-guix <at> libremiami.org>
;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
;;; Copyright © 2021 Demis Balbach <db <at> minikn.xyz>
+;;; Copyright © 2022 Antero Mejr <antero <at> mailbox.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -63,6 +64,7 @@ (define-module (gnu packages telephony)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gnupg)
#:use-module (gnu packages gtk)
+ #:use-module (gnu packages icu4c)
#:use-module (gnu packages image)
#:use-module (gnu packages libcanberra)
#:use-module (gnu packages linphone)
@@ -893,3 +895,43 @@ (define-public libtgvoip
telephony functionality into custom Telegram clients.")
(home-page "https://github.com/zevlg/libtgvoip")
(license license:unlicense)))
+
+(define-public libphonenumber
+ (package
+ (name "libphonenumber")
+ (version "8.11.3")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/google/libphonenumber")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "06y3mh1d1mks6d0ynxp3980g712nkf8l5nyljpybsk326b246hg9"))))
+ (arguments
+ (list #:test-target "tests"
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'make-reproducible
+ (lambda _
+ (substitute*
+ "tools/cpp/src/cpp-build/generate_geocoding_data.cc"
+ (("return errno == 0;") "
+std::sort(entries->begin(), entries->end());
+ return errno == 0;")
+ (("DirEntryKinds kind\\(\\) const \\{ return kind_; \\}") "
+DirEntryKinds kind() const { return kind_; }
+bool operator<(const DirEntry& d) { return name_ < d.name(); }"))))
+ (add-after 'make-reproducible 'change-directory
+ (lambda _
+ (chdir "cpp"))))))
+ (build-system cmake-build-system)
+ (native-inputs (list googletest pkg-config))
+ (inputs (list boost protobuf icu4c))
+ (synopsis "Library for parsing and using phone numbers")
+ (description
+ "This package provides a C++ library for parsing, formatting, and
+validating international phone numbers.")
+ (home-page "https://github.com/google/libphonenumber")
+ (license license:asl2.0)))
--
2.36.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#56642
; Package
guix-patches
.
(Tue, 19 Jul 2022 22:07:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 56642 <at> debbugs.gnu.org (full text, mbox):
Hi Antero,
to be honest: I would prefer a proper patch. It's only a few-liner, but
this C++ code inside the package definition looks a bit weird to my eyes.
Did you already report this bug to upstream?
~Jonathan
Information forwarded
to
guix-patches <at> gnu.org
:
bug#56642
; Package
guix-patches
.
(Wed, 20 Jul 2022 00:38:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 56642 <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/messaging.scm (libphonenumber): Add patch.
* gnu/packages/patches/libphonenumber-reproducible-build.patch: New
file.
---
I didn't report upstream because they don't have an issue tracker and
PRs require signing the Google CLA. If someone willing to sign the CLA
wants to submit the patch, please go ahead. However, updating libphonenumber
to 8.12.X breaks evolution-data-server.
gnu/packages/messaging.scm | 3 ++-
.../libphonenumber-reproducible-build.patch | 20 +++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 gnu/packages/patches/libphonenumber-reproducible-build.patch
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index b68a798715..c75b504ec5 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -2782,6 +2782,8 @@ (define-public libphonenumber
(url "https://github.com/google/libphonenumber")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
+ (patches (search-patches
+ "libphonenumber-reproducible-build.patch"))
(sha256
(base32
"06y3mh1d1mks6d0ynxp3980g712nkf8l5nyljpybsk326b246hg9"))))
@@ -2803,7 +2805,6 @@ (define-public libphonenumber
(home-page "https://github.com/google/libphonenumber")
(license license:asl2.0)))
-
(define-public chatty
(package
(name "chatty")
diff --git a/gnu/packages/patches/libphonenumber-reproducible-build.patch b/gnu/packages/patches/libphonenumber-reproducible-build.patch
new file mode 100644
index 0000000000..6f68fe41a0
--- /dev/null
+++ b/gnu/packages/patches/libphonenumber-reproducible-build.patch
@@ -0,0 +1,20 @@
+diff --git a/tools/cpp/src/cpp-build/generate_geocoding_data.cc b/tools/cpp/src/cpp-build/generate_geocoding_data.cc
+index 021cf5c8..5948e140 100644
+--- a/tools/cpp/src/cpp-build/generate_geocoding_data.cc
++++ b/tools/cpp/src/cpp-build/generate_geocoding_data.cc
+@@ -88,6 +88,7 @@ class DirEntry {
+
+ const std::string& name() const { return name_; }
+ DirEntryKinds kind() const { return kind_; }
++ bool operator<(const DirEntry& d) { return name_ < d.name(); }
+
+ private:
+ std::string name_;
+@@ -115,6 +116,7 @@ bool ListDirectory(const string& path, vector<DirEntry>* entries) {
+ errno = 0;
+ entry = readdir(dir);
+ if (entry == NULL) {
++ std::sort(entries->begin(), entries->end());
+ return errno == 0;
+ }
+ if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) {
--
2.36.1
Reply sent
to
Jonathan Brielmaier <jonathan.brielmaier <at> web.de>
:
You have taken responsibility.
(Wed, 27 Jul 2022 14:59:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Antero Mejr <antero <at> mailbox.org>
:
bug acknowledged by developer.
(Wed, 27 Jul 2022 14:59:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 56642-done <at> debbugs.gnu.org (full text, mbox):
On 20.07.22 02:36, Antero Mejr wrote:
> * gnu/packages/messaging.scm (libphonenumber): Add patch.
> * gnu/packages/patches/libphonenumber-reproducible-build.patch: New
> file.
> ---
> I didn't report upstream because they don't have an issue tracker and
> PRs require signing the Google CLA. If someone willing to sign the CLA
> wants to submit the patch, please go ahead. However, updating libphonenumber
> to 8.12.X breaks evolution-data-server.
Hi Antero,
I pushed the change now as ecb91c993dcce7e6c3faa0d156013dac42380cc6. I
registered the patch at gnu/local.mk and added your comment ontop of the
patch. As that's what our linter makes happy :)
~Jonathan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 25 Aug 2022 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 300 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.