By doing the tarball using the parent directory ('pahole') and then
replacing ^pahole/ with dwarves-${version} we avoid tar replacing the
symlink destination, i.e. before we were getting:
$ ls -la dwarves-1.22/lib/include/
total 8
drwxr-xr-x. 2 acme acme 4096 Aug 12 15:54 .
drwxr-xr-x. 4 acme acme 4096 Aug 12 15:54 ..
lrwxrwxrwx. 1 acme acme 23 Jun 18 17:56 bpf -> dwarves-1.22/../bpf/src
$
Now we get:
$ v=1.$(($(git tag | sort -V | tail -1 | cut -d. -f2) + 1)) ; tar cvfJ ~/rpmbuild/SOURCES/dwarves-${v}.tar.xz --transform "s,^pahole/,dwarves-${v}/," `sed s%^%../pahole/%g MANIFEST`
$ tar tvf ~/rpmbuild/SOURCES/dwarves-1.22.tar.xz | tail -3
-rwxr-xr-x acme/acme 1132 2021-06-14 15:51 dwarves-1.22/lib/bpf/travis-ci/vmtest/run_vmtest.sh
-rw-r--r-- acme/acme 2904227 2021-06-14 15:51 dwarves-1.22/lib/bpf/travis-ci/vmtest/vmlinux.h
lrwxrwxrwx acme/acme 0 2021-08-11 08:55 dwarves-1.22/lib/include/bpf -> ../bpf/src
$
And building from the resulting tarball succeeds.
See the references in the threads and bug reportgs in the Link tags
below for more details.
Link: https://lore.kernel.org/dwarves/YRVxNEPEspmuHcKr@kernel.org/
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=775247
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>