[packages/caddy: 2/2] workaround for X flags unable to contain spaces
glen
glen at pld-linux.org
Sun May 22 13:19:38 CEST 2016
commit 7d444fc4e83aa3c7c62c6be440144af0f8870751
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sun May 22 14:19:19 2016 +0300
workaround for X flags unable to contain spaces
build-date.patch | 17 +++++++++++++++++
caddy.spec | 7 +++++--
2 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/caddy.spec b/caddy.spec
index 61b4c1e..c97a0f0 100644
--- a/caddy.spec
+++ b/caddy.spec
@@ -11,6 +11,7 @@ License: Apache v2.0
Group: Networking/Daemons/HTTP
Source0: https://github.com/mholt/caddy/archive/v%{version}/%{name}-%{version}.tar.gz
# Source0-md5: 2d08bf70a7ad4255513bf1e0df174e98
+Patch0: build-date.patch
URL: https://caddyserver.com/
BuildRequires: golang >= 1.6
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -33,18 +34,20 @@ cryptographic assets for you.
%prep
%setup -q
+%patch0 -p1
GOPATH=$(pwd)/vendor
install -d $GOPATH/src/github.com/mholt
ln -s ../../../.. $GOPATH/src/github.com/mholt/caddy
+date=$(date -u +"%%a %%b %%d %%H:%%M:%%S %%Z %%Y")
+%{__sed} -i -e "/buildDate/ s/(unknown)/$date/" main.go
+
%build
export GOPATH=$(pwd)/vendor
# command extraced by running "build.bash" from git tree
-date=$(date -u +"%%a %%b %%d %%H:%%M:%%S %%Z %%Y")
LDFLAGS="\
--X main.buildDate=$date \
-X main.gitTag= \
-X main.gitNearestTag=v%{version} \
-X main.gitCommit= \
diff --git a/build-date.patch b/build-date.patch
new file mode 100644
index 0000000..b18d344
--- /dev/null
+++ b/build-date.patch
@@ -0,0 +1,17 @@
+unable to pass -X main.buildDate as ldflags if it contains space
+
+likely go link command lacks proper argument passing that it loses spaces
+
+so patch the source directly
+
+--- caddy-0.8.3/main.go~ 2016-04-26 18:28:05.000000000 +0300
++++ caddy-0.8.3/main.go 2016-05-22 14:13:18.927407255 +0300
+@@ -233,7 +233,7 @@
+ appVersion = "(untracked dev build)" // inferred at startup
+ devBuild = true // inferred at startup
+
+- buildDate string // date -u
++ buildDate = "(unknown)" // date -u
+ gitTag string // git describe --exact-match HEAD 2> /dev/null
+ gitNearestTag string // git describe --abbrev=0 --tags HEAD
+ gitCommit string // git rev-parse HEAD
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/caddy.git/commitdiff/7d444fc4e83aa3c7c62c6be440144af0f8870751
More information about the pld-cvs-commit
mailing list