From: Ryan Prior via Guix-patches via <guix-patches@gnu.org>
To: 45601@debbugs.gnu.org
Subject: [bug#45601] [PATCH 6/6] gnu: vlang: Fix v tools.
Date: Fri, 01 Jan 2021 19:27:34 +0000 [thread overview]
Message-ID: <20210101192713.23655-6-rprior@protonmail.com> (raw)
In-Reply-To: <20210101192713.23655-1-rprior@protonmail.com>
---
gnu/local.mk | 1 +
.../vlang-accommodate-timestamps.patch | 50 +++++++++++++++++++
gnu/packages/vlang.scm | 7 +++
3 files changed, 58 insertions(+)
create mode 100644 gnu/packages/patches/vlang-accommodate-timestamps.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 2402b1e349..168c499976 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1702,6 +1702,7 @@ dist_patch_DATA = \
%D%/packages/patches/vinagre-newer-freerdp.patch \
%D%/packages/patches/vinagre-newer-rdp-parameters.patch \
%D%/packages/patches/virglrenderer-CVE-2017-6386.patch \
+ %D%/packages/patches/vlang-accommodate-timestamps.patch \
%D%/packages/patches/vorbis-tools-CVE-2014-9638+CVE-2014-9639.patch \
%D%/packages/patches/vorbis-tools-CVE-2014-9640.patch \
%D%/packages/patches/vorbis-tools-CVE-2015-6749.patch \
diff --git a/gnu/packages/patches/vlang-accommodate-timestamps.patch b/gnu/packages/patches/vlang-accommodate-timestamps.patch
new file mode 100644
index 0000000000..02171ac6cf
--- /dev/null
+++ b/gnu/packages/patches/vlang-accommodate-timestamps.patch
@@ -0,0 +1,50 @@
+From 64e7c548843c7938fcfa6b697108d28aa26f4d69 Mon Sep 17 00:00:00 2001
+From: Ryan Prior <rprior@protonmail.com>
+Date: Thu, 31 Dec 2020 02:31:38 -0600
+Subject: [PATCH] v.util: accomodate reproducible build environments like guix,
+ by not recompiling cmd/tools when mtime < 1024 (#7702)
+
+---
+ vlib/v/util/util.v | 16 ++++++++++++++--
+ 1 file changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/vlib/v/util/util.v b/vlib/v/util/util.v
+index 811b71585..1ed32bacf 100644
+--- a/vlib/v/util/util.v
++++ b/vlib/v/util/util.v
+@@ -179,7 +179,10 @@ pub fn should_recompile_tool(vexe string, tool_source string) bool {
+ if !os.exists(tool_exe) {
+ should_compile = true
+ } else {
+- if os.file_last_mod_unix(tool_exe) <= os.file_last_mod_unix(vexe) {
++ mtime_vexe := os.file_last_mod_unix(vexe)
++ mtime_tool_exe := os.file_last_mod_unix(tool_exe)
++ mtime_tool_source := os.file_last_mod_unix(tool_source)
++ if mtime_tool_exe <= mtime_vexe {
+ // v was recompiled, maybe after v up ...
+ // rebuild the tool too just in case
+ should_compile = true
+@@ -192,10 +195,19 @@ pub fn should_recompile_tool(vexe string, tool_source string) bool {
+ should_compile = false
+ }
+ }
+- if os.file_last_mod_unix(tool_exe) <= os.file_last_mod_unix(tool_source) {
++ if mtime_tool_exe <= mtime_tool_source {
+ // the user changed the source code of the tool, or git updated it:
+ should_compile = true
+ }
++ // GNU Guix and possibly other environments, have bit for bit reproducibility in mind,
++ // including filesystem attributes like modification times, so they set the modification
++ // times of executables to a small number like 0, 1 etc. In this case, we should not
++ // recompile even if other heuristics say that we should. Users in such environments,
++ // have to explicitly do: `v cmd/tools/vfmt.v`, and/or install v from source, and not
++ // use the system packaged one, if they desire to develop v itself.
++ if mtime_vexe < 1024 && mtime_tool_exe < 1024 {
++ should_compile = false
++ }
+ }
+ return should_compile
+ }
+--
+2.29.2
+
diff --git a/gnu/packages/vlang.scm b/gnu/packages/vlang.scm
index 92d178a3e1..3bdbf36f9d 100644
--- a/gnu/packages/vlang.scm
+++ b/gnu/packages/vlang.scm
@@ -30,6 +30,7 @@
#:use-module (gnu packages version-control)
#:use-module (gnu packages javascript)
#:use-module (gnu packages xorg)
+ #:use-module (gnu packages)
#:use-module (guix build-system gnu)
#:use-module (guix git-download)
#:use-module ((guix licenses) #:prefix license:)
@@ -61,6 +62,12 @@
(sha256
(base32 "1x2sf2j6xl11kjvv0i0anjqwsfb1la11xr7yhdnbix9808442wm2"))
(modules '((guix build utils)))
+ ;; This patch is already accepted upstream but is required for version
+ ;; 0.2. The package will build without it, but it will fail to run any v
+ ;; tools afterwards because of how Guix changes modified timestamps in
+ ;; the package files.
+ (patches (search-patches
+ "vlang-accommodate-timestamps.patch"))
(snippet
'(begin
;; Eventually remove the whole thirdparty directory.
--
2.29.2
next prev parent reply other threads:[~2021-01-01 19:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-01 19:23 [bug#45601] [PATCH 0/6] vlang 0.2 update Ryan Prior via Guix-patches via
2021-01-01 19:27 ` [bug#45601] [PATCH 1/6] gnu: Add wyhash Ryan Prior via Guix-patches via
2021-01-01 19:27 ` [bug#45601] [PATCH 2/6] gnu: vlang: Update to 0.2 Ryan Prior via Guix-patches via
2021-01-01 19:27 ` [bug#45601] [PATCH 3/6] gnu: vlang: Use system tiny-bignum Ryan Prior via Guix-patches via
2021-01-01 19:27 ` [bug#45601] [PATCH 4/6] gnu: vlang: Use system cJSON Ryan Prior via Guix-patches via
2021-01-01 19:27 ` [bug#45601] [PATCH 5/6] gnu: vlang: Use system wyhash Ryan Prior via Guix-patches via
2021-01-01 19:27 ` Ryan Prior via Guix-patches via [this message]
2021-01-01 20:46 ` [bug#45601] [PATCH 1/6] gnu: Add wyhash Leo Famulari
2021-01-01 21:19 ` [bug#45601] [PATCH] " Ryan Prior via Guix-patches via
2021-01-04 2:07 ` Leo Famulari
2021-01-03 0:09 ` [bug#45601] [PATCH] gnu: vlang: Update to 0.2 Ryan Prior via Guix-patches via
2021-01-04 1:46 ` [bug#45601] [PATCH 0/2] Another vlang dependency plucked out (re: bug#45601) Ryan Prior via Guix-patches via
2021-01-04 1:46 ` [bug#45601] [PATCH 1/2] gnu: Add picoev Ryan Prior via Guix-patches via
2021-01-04 1:46 ` [bug#45601] [PATCH 2/2] gnu: vlang: Use system picoenv Ryan Prior via Guix-patches via
2021-01-04 2:57 ` [bug#45601] [PATCH] gnu: Add wyhash Ryan Prior via Guix-patches via
2021-01-04 3:07 ` [bug#45601] [PATCH 0/1] Updated picoev patch based on feedback Ryan Prior via Guix-patches via
2021-01-04 3:07 ` [bug#45601] [PATCH 1/1] gnu: Add picoev Ryan Prior via Guix-patches via
2021-02-05 13:30 ` Christopher Baines
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210101192713.23655-6-rprior@protonmail.com \
--to=guix-patches@gnu.org \
--cc=45601@debbugs.gnu.org \
--cc=rprior@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).