On Tuesday, 21 May 2019 10:43:04 CEST Brian (bex) Exelbierd wrote:
Hi,
I have submitted the first of my dependency review requests here:
https://bugzilla.redhat.com/show_bug.cgi?id=1712280
Feedback is greatly appreciated so I can clean anything up on the next
set of dependencies.
I am working on the main application packaging for gocryptfs
(
https://github.com/rfjakob/gocryptfs/) and have hit a few questions:
1. The upstream provides specific source tarballs for each version
here,
https://github.com/rfjakob/gocryptfs/releases - I am planning to
use these as opposed to the gomacros to determine a git tag to pull.
Is there a reason not to do this?
Use gocryptfs_vX.Y_src.tar.gz, otherwise the usual source does not contain the
VERSION file.
2. The upstream build script sets up some values to be included in
the
executables version string. I presume this helps with debugging. I
am told that the Go SIG would prefer to see the macros used for
building rather than the upstream build script. This is fine, except
I am not sure how to handle these values. Specifically, they are:
GITVERSION=$(cat VERSION)
GITVERSIONFUSE=$(rpm -q golang-github-hanwen-fuse-devel --queryformat
'%{version}')
BUILDDATE=$(date +%Y-%m-%d)
These can be set, presumably, somehow in the spec file (i haven't
tested my ideas here yet).
They are passed to `go build` as part of the ldflags, specifically as:
"-X main.GitVersion=$GITVERSION -X main.GitVersionFuse=$GITVERSIONFUSE
-X main.BuildDate=$BUILDDATE" prepended to any existing ldflags
How do you pass this information with the macros?
Just export your LDFLAGS.
For example in micro I have:
export LDFLAGS="-X main.Version=%{version} \
-X main.CommitHash=%{shortcommit} \
-X 'main.CompileDate=%{compiledate}'"
This will be picked up by %gobuild