Accepting request 900295 from home:cyphar:lxc
- Build lxd-agent and lxd-p2c statically to match upstream LXD build scripts (and to make VMs work properly -- lxd-agent is injected into the VM). - Update lxd-rpmlintrc to match this. OBS-URL: https://build.opensuse.org/request/show/900295 OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/lxd?expand=0&rev=95
This commit is contained in:
parent
dfb66de8b3
commit
9eba910f92
@ -2,3 +2,7 @@
|
|||||||
# our shared libraries are internal and aren't meant to be used outside LXD.
|
# our shared libraries are internal and aren't meant to be used outside LXD.
|
||||||
# This error only appears in old SLE versions.
|
# This error only appears in old SLE versions.
|
||||||
addFilter ("^lxd.* E: invalid-filepath-dependency .* /usr/lib(32|64)?/lxd/")
|
addFilter ("^lxd.* E: invalid-filepath-dependency .* /usr/lib(32|64)?/lxd/")
|
||||||
|
|
||||||
|
# We need lxd-agent and lxd-p2c to be statically linked.
|
||||||
|
addFilter ("^lxd.*: W: statically-linked-binary /usr/bin/lxd-(agent|p2c)")
|
||||||
|
addFilter ("^lxd.*: W: position-independent-executable-suggested /usr/bin/lxd-(agent|p2c)")
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jun 8 02:25:02 UTC 2021 - Aleksa Sarai <asarai@suse.com>
|
||||||
|
|
||||||
|
- Build lxd-agent and lxd-p2c statically to match upstream LXD build scripts
|
||||||
|
(and to make VMs work properly -- lxd-agent is injected into the VM).
|
||||||
|
- Update lxd-rpmlintrc to match this.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Sun Jun 6 07:03:53 UTC 2021 - Aleksa Sarai <asarai@suse.com>
|
Sun Jun 6 07:03:53 UTC 2021 - Aleksa Sarai <asarai@suse.com>
|
||||||
|
|
||||||
|
44
lxd.spec
44
lxd.spec
@ -196,12 +196,34 @@ do
|
|||||||
then
|
then
|
||||||
binary="lxd-$binary"
|
binary="lxd-$binary"
|
||||||
fi
|
fi
|
||||||
|
case "$binary" in
|
||||||
|
lxd-agent)
|
||||||
|
build_static=1
|
||||||
|
build_tags="agent,netgo"
|
||||||
|
;;
|
||||||
|
lxd-p2c)
|
||||||
|
build_static=1
|
||||||
|
build_tags="netgo"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
build_static=
|
||||||
|
build_tags="libsqlite3"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
(
|
(
|
||||||
# We need to link against our particular dylib deps.
|
# We need to link against our particular dylib deps.
|
||||||
export \
|
export \
|
||||||
CGO_CFLAGS="-I $INSTALL_INCLUDEDIR" \
|
CGO_CFLAGS="-I $INSTALL_INCLUDEDIR" \
|
||||||
CGO_LDFLAGS="-L $INSTALL_LIBDIR" ||:
|
CGO_LDFLAGS="-L $INSTALL_LIBDIR" ||:
|
||||||
go build -buildmode=pie -tags "libsqlite3" -o "bin/$binary" "$mainpkg"
|
|
||||||
|
if [ -n "$build_static" ]
|
||||||
|
then
|
||||||
|
CGO_ENABLED=0 go build -ldflags "-extldflags -static" \
|
||||||
|
-tags "$build_tags" -o "bin/$binary" "$mainpkg"
|
||||||
|
else
|
||||||
|
go build -buildmode=pie \
|
||||||
|
-tags "$build_tags" -o "bin/$binary" "$mainpkg"
|
||||||
|
fi
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -253,6 +275,16 @@ done
|
|||||||
# chain-loading problems.
|
# chain-loading problems.
|
||||||
for target in bin/* "$INSTALL_LIBDIR"/lib*.so
|
for target in bin/* "$INSTALL_LIBDIR"/lib*.so
|
||||||
do
|
do
|
||||||
|
case "$(basename "$target")" in
|
||||||
|
lxd-agent|lxd-p2c)
|
||||||
|
# Cannot patch static binaries, and the patching isn't necessary
|
||||||
|
# for them anyway.
|
||||||
|
continue
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Drop RPATH in case it got included during builds.
|
# Drop RPATH in case it got included during builds.
|
||||||
patchelf --remove-rpath "$target"
|
patchelf --remove-rpath "$target"
|
||||||
# And now replace all the possible DT_NEEDEDs to absolute paths.
|
# And now replace all the possible DT_NEEDEDs to absolute paths.
|
||||||
@ -272,10 +304,18 @@ mkdir man
|
|||||||
pushd bin/
|
pushd bin/
|
||||||
for bin in *
|
for bin in *
|
||||||
do
|
do
|
||||||
# Ensure that all our binaries are dynamic. boo#1138769
|
# Ensure that all our binaries are dynamic (except for lxd-p2c and
|
||||||
|
# lxd-agent, which must be static). boo#1138769
|
||||||
|
case "$(basename $bin)" in
|
||||||
|
lxd-agent|lxd-p2c)
|
||||||
|
file "$bin" | grep 'statically linked'
|
||||||
|
;;
|
||||||
|
*)
|
||||||
file "$bin" | grep 'dynamically linked'
|
file "$bin" | grep 'dynamically linked'
|
||||||
# Check what they are linked against.
|
# Check what they are linked against.
|
||||||
ldd "$bin"
|
ldd "$bin"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
done
|
done
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user