Skip to content

Commit

Permalink
remove golang a files
Browse files Browse the repository at this point in the history
  • Loading branch information
jaxesn committed Oct 31, 2023
1 parent 68481df commit 82bc1f5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
11 changes: 8 additions & 3 deletions builder-base/scripts/install_ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,15 @@ function instal_ansible() {
cp -rf /usr/include/python3.9 ${NEWROOT}/usr/include
cp /usr/lib/pkgconfig/python-3.9*.pc ${NEWROOT}/usr/lib/pkgconfig
cp -rf /usr/lib/python3.9 ${NEWROOT}/usr/lib
cp --preserve=links /usr/lib/libpython3* ${NEWROOT}/usr/lib

ls -al /usr/lib/libpython3*
# for some reason the /usr/lib/libpython3.9.so file should be a symlink libpython3.9.so.1.0
# but this got lost somewhere, probably during minimal image build, so its a full copy
# manually recreating the symlink to avoid having a duplicated file
cp /usr/lib/libpython3.so /usr/lib/libpython3.9.so.1.0 ${NEWROOT}/usr/lib
ln -s ./libpython3.9.so.1.0 ${NEWROOT}/usr/lib/libpython3.9.so

# the static lib of python is not needed in our use case and it is quite big
rm /usr/lib/python3.9/config-3.9-*-linux-gnu/libpython3.9.a
rm ${NEWROOT}/usr/lib/python3.9/config-3.9-*-linux-gnu/libpython3.9.a
fi

chmod 755 ${NEWROOT}/usr/lib/python3.9/site-packages
Expand Down
11 changes: 3 additions & 8 deletions builder-base/scripts/install_go_licenses.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,9 @@ function install_go_licenses() {
# installing go-licenses has to happen after we have set the main go
# to symlink to the one in /root/sdk to ensure go-licenses gets built
# with GOROOT pointed to /root/sdk/go... instead of /usr/local/go so it
# is able to properly packages from the standard Go library
# We currently use 1.19, 1.17 or 1.16, so installing for all
if [ "${GOLANG_MAJOR_VERSION}" = "go1.16" ]; then
GO111MODULE=on GOBIN=${NEWROOT}/${GOPATH}/${GOLANG_MAJOR_VERSION}/bin go install github.com/jaxesn/go-licenses@4497a2a38565e4e6ad095ea8117c25ecd622d0cc
else
GO111MODULE=on GOBIN=${NEWROOT}/${GOPATH}/${GOLANG_MAJOR_VERSION}/bin go install github.com/jaxesn/go-licenses@6800d77c11d0ef8628e7eda908b1d1149383ca48
fi

# is able to properly packages from the standard Go library
CGO_ENABLED=0 GO111MODULE=on GOBIN=${NEWROOT}/${GOPATH}/${GOLANG_MAJOR_VERSION}/bin go install github.com/jaxesn/go-licenses@6800d77c11d0ef8628e7eda908b1d1149383ca48

# symlink to go/bin and depending on which go-licenses vs is added last to
# the final image, will take precedent and be the default
# similiar to the strategy with golang
Expand Down
6 changes: 5 additions & 1 deletion builder-base/scripts/install_golang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ function build::go::extract() {
version=$(echo "$golang_version" | grep -o "[0-9].*")
ln -s /root/sdk/go${version}/bin/go ${GOPATH}/bin/$golang_version

# newer versions of golang stopped shipping the compiled .a lib files
# removing from old versions since we do not need these during our builds
find /root/sdk/go${version}/pkg -type f -name "*.a" -delete

rm -rf /tmp/go-extracted /tmp/golang-*.rpm
}

Expand All @@ -94,4 +98,4 @@ mkdir -p ${NEWROOT}/root
mv /root/sdk ${NEWROOT}/root
mv ${GOPATH} ${NEWROOT}/${GOPATH}

time upx --best --no-lzma ${NEWROOT}/root/sdk/go${VERSION%-*}/bin/go ${NEWROOT}/root/sdk/go${VERSION%-*}/pkg/tool/linux_$TARGETARCH/{compile,pprof,trace}
time upx --best --no-lzma ${NEWROOT}/root/sdk/go${VERSION%-*}/bin/go ${NEWROOT}/root/sdk/go${VERSION%-*}/pkg/tool/linux_$TARGETARCH/{addr2line,asm,cgo,compile,cover,doc,link,objdump,pprof,trace,vet}
2 changes: 1 addition & 1 deletion builder-base/scripts/install_linuxkit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source $SCRIPT_ROOT/common_vars.sh
function install_linuxkit() {
# linuxkit is used by tinkerbell/hook for building an operating system installation environment (osie)
# We need a higher version of linuxkit hence we do go install of a particular commit
GO111MODULE=on GOBIN=${GOPATH}/go1.19/bin ${GOPATH}/go1.19/bin/go install github.com/linuxkit/linuxkit/src/cmd/linuxkit@$LINUXKIT_VERSION
CGO_ENABLED=0 GO111MODULE=on GOBIN=${GOPATH}/go1.19/bin ${GOPATH}/go1.19/bin/go install github.com/linuxkit/linuxkit/src/cmd/linuxkit@$LINUXKIT_VERSION

mv ${GOPATH}/go1.19/bin/linuxkit ${USR_BIN}/linuxkit

Expand Down

0 comments on commit 82bc1f5

Please sign in to comment.