Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simdutf: add git patch for 6.1.0 build #978

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions simdutf/6.1.0-git.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
From 4aae0949687f87a77a9841ca3729f68ab0b286dd Mon Sep 17 00:00:00 2001
From: Daniel Lemire <[email protected]>
Date: Thu, 23 Jan 2025 19:49:49 -0500
Subject: [PATCH 1/3] making the amalgamation script more robust

---
singleheader/amalgamate.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/singleheader/amalgamate.py b/singleheader/amalgamate.py
index 5b18ea16..ffa25ac5 100755
--- a/singleheader/amalgamate.py
+++ b/singleheader/amalgamate.py
@@ -233,11 +233,13 @@ def get_timestamp():
stdout=subprocess.PIPE)

if ret.returncode != 0:
- raise ValueError(f"non-zero exit code {ret.returncode}")
+ print(f"git called resulted in non-zero exit code {ret.returncode}")
+ print("timestamp based on current time")
+ return str(datetime.datetime.now())

return ret.stdout.decode('utf-8').strip()
except (UnicodeDecodeError, FileNotFoundError):
- print("git not found, timestamp based on current time")
+ print("UnicodeDecodeError or FileNotFoundError, timestamp based on current time")
return str(datetime.datetime.now())



From 20bc091b3843ae502fae02e5f7e22c1b8f4eb5e2 Mon Sep 17 00:00:00 2001
From: Paul Dreik <[email protected]>
Date: Fri, 24 Jan 2025 06:35:49 +0100
Subject: [PATCH 2/3] run git in the correct directory

this fixes a problem of building outside the git repository,
which my IDE does by default.

like this:
cd /somewhere/else
cmake -B /tmp/outside -S /path/to/simdutf/
---
singleheader/amalgamate.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/singleheader/amalgamate.py b/singleheader/amalgamate.py
index ffa25ac5..36b9981a 100755
--- a/singleheader/amalgamate.py
+++ b/singleheader/amalgamate.py
@@ -229,7 +229,7 @@ def get_timestamp():
# Forcing it to be UTC is difficult, because it needs to be portable
# between gnu date and busybox date.
try:
- ret = subprocess.run(['git', 'show', '-s', '--format=%ci', 'HEAD'],
+ ret = subprocess.run(['git', '-C', SCRIPTPATH, 'show', '-s', '--format=%ci', 'HEAD'],
stdout=subprocess.PIPE)

if ret.returncode != 0:

From 13d280ae8834b84a34515c551b58eca68a5bb68b Mon Sep 17 00:00:00 2001
From: Paul Dreik <[email protected]>
Date: Fri, 24 Jan 2025 06:52:36 +0100
Subject: [PATCH 3/3] prevent amalgamation from picking up timestamp from
parent git repo

---
singleheader/amalgamate.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/singleheader/amalgamate.py b/singleheader/amalgamate.py
index 36b9981a..d600647e 100755
--- a/singleheader/amalgamate.py
+++ b/singleheader/amalgamate.py
@@ -7,6 +7,7 @@
import os.path
import subprocess
import os
+import pathlib
import re
import shutil
import datetime
@@ -229,8 +230,15 @@ def get_timestamp():
# Forcing it to be UTC is difficult, because it needs to be portable
# between gnu date and busybox date.
try:
+ # avoid git going outside simdutf, which could happen when
+ # unpacking a release tarball inside a subdirectory of an unrelated
+ # git repository. that would lead to picking up the timestamp of the
+ # unrelated git repository.
+ parent = pathlib.Path(SCRIPTPATH).absolute().parent
+ GIT_CEILING_DIRECTORIES = str(parent)
ret = subprocess.run(['git', '-C', SCRIPTPATH, 'show', '-s', '--format=%ci', 'HEAD'],
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE,
+ env=dict(os.environ, GIT_CEILING_DIRECTORIES=GIT_CEILING_DIRECTORIES))

if ret.returncode != 0:
print(f"git called resulted in non-zero exit code {ret.returncode}")
Loading