I'm attempting to package
github.com/rjeczalik/notify[1] as an RPM. This package
includes a utility function[2] that determines whether a path is a symlink, and resolves
it to an absolute path. This function clearly has merit, as the package is an abstraction
wrapper around inotify. There are tests around this function that set up symlinks and test
whether or not the function correctly resolves the symlink redirections. These test
functions fail when I build the package[3]. It turns out the abstractions created by
%goprep that set up the _build/src directory hierarchy (including the final symlink in the
tree) are tripping up the tests that are attempting to resolve symlinks. I replaced the
symlink at
_build/src/github.com/rjeczalik/notify with a properly unpacked source
directory and ran go-rpm-integration check by hand, and the tests pass. If
_build/src/github.com/rjeczalik/notify is a symlink, however, the tests are failing.
Is there a proper way to manipulate the %goprep macro or tell it to not create symlinks?
Or, what's the appropriate Fedora RPM go macro way of handling cases like this?
1:
https://github.com/rjeczalik/notify
2:
https://github.com/rjeczalik/notify/blob/135d4685afb9d0fb32e23a065b95cd79...
3:
+ go-rpm-integration check -i
github.com/rjeczalik/notify -b
/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/_build/bin -s
/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/_build -V
0.9.2-1.20210611gite2a77dc.fc35 -C e2a77dcc14cf6732bfa4c361554f27dc696d5d79 -p
/builddir/build/BUILDROOT/golang-github-rjeczalik-notify-0.9.2-1.20210611gite2a77dc.fc35.x86_64
-g /usr/share/gocode -r '.*example.*'
Testing in:
/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/_build/src
PATH:
/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/_build/bin:/builddir/.local/bin:/builddir/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin
GOPATH:
/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/_build:/usr/share/gocode
GO111MODULE: off
command: go test -buildmode pie -compiler gc -ldflags " -X
github.com/rjeczalik/notify/version.commit=e2a77dcc14cf6732bfa4c361554f27... -X
github.com/rjeczalik/notify/version=0.9.2 -extldflags '-Wl,-z,relro -Wl,--as-needed
-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '"
testing:
github.com/rjeczalik/notify
github.com/rjeczalik/notify
--- FAIL: TestCanonicalNoSymlink (0.00s)
util_test.go:25: want
full="/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc6...;
got "/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79"
(i=0)
util_test.go:25: want
full="/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc6...;
got
"/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/testdata"
(i=1)
util_test.go:25: want
full="/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc6...;
got "/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79"
(i=2)
--- FAIL: TestCanonical (0.01s)
util_test.go:25: want
full="/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc6...;
got "/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79"
(i=0)
util_test.go:25: want
full="/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc6...;
got
"/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/testdata"
(i=1)
util_test.go:25: want
full="/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc6...;
got
"/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/notify.go"
(i=2)
util_test.go:25: want
full="/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc6...;
got
"/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/testdata/vfs.txt"
(i=3)
util_test.go:25: want
full="/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc6...;
got
"/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/testdata/vfs.txt"
(i=4)
--- FAIL: TestCanonical_RelativeSymlink (0.00s)
util_unix_test.go:125: want
canonical()=/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc...;
got
/builddir/build/BUILD/notify-e2a77dcc14cf6732bfa4c361554f27dc696d5d79/005632054/a/b/x/y/z/d/e/f
FAIL
exit status 1
FAIL
github.com/rjeczalik/notify 17.491s