Refactor vendor directory merging with gitaly

This commit is contained in:
Pirate Praveen 2023-07-09 18:47:43 +05:30
parent 6780c9291c
commit 09a3d48e67
No known key found for this signature in database
GPG key ID: 8F53E0193B294B75

46
debian/rules vendored
View file

@ -2,6 +2,8 @@
include /usr/share/dpkg/pkg-info.mk
BUILDDIR := _build/src/gitlab.com/gitlab-org/gitlab
VENDORDIR := ${BUILDDIR}/vendor
SYSTEMGOCODE := /usr/share/gocode/src
%:
dh $@ --buildsystem=ruby --with=ruby --package=gitlab
@ -14,38 +16,22 @@ override_dh_auto_configure-indep:
override_dh_auto_configure-arch:
dh_auto_configure -O--package=gitlab-workhorse -O--buildsystem=golang \
-O--with=golang -O--builddirectory=_build -O--sourcedirectory=workhorse
mkdir -p _build/src/gitlab.com/gitlab-org/gitlab
cp -r workhorse _build/src/gitlab.com/gitlab-org/gitlab
if [ -d ${BUILDDIR}/vendor ]; then ${RM} -rf ${BUILDDIR}/vendor; fi
if [ -d ${BUILDDIR}/workhorse-vendor ]; then mv ${BUILDDIR}/workhorse-vendor \
${BUILDDIR}/vendor; fi
# we don't need gitlab's (ruby) vendor directory
rm -rf ${VENDORDIR}
# workhorse-vendor is meant for workhorse, but should be renamed
mv ${BUILDDIR}/workhorse-vendor ${VENDORDIR}
# merge vendor from gitaly with vendor in build directory using simbolic links
cp -arsn ${SYSTEMGOCODE}/gitlab.com/gitlab-org/gitaly/v16/vendor/* \
${VENDORDIR}/
# import paths in vendor needs version as directory (go.mod is ignored)
mkdir -p ${VENDORDIR}/github.com/cespare/xxhash/v2
mkdir -p ${VENDORDIR}/github.com/oklog/ulid/v2
cp -arsn ${SYSTEMGOCODE}/github.com/cespare/xxhash/* ${VENDORDIR}/github.com/cespare/xxhash/v2
cp -arsn ${SYSTEMGOCODE}/github.com/oklog/ulid/* ${VENDORDIR}/github.com/oklog/ulid/v2
# only go files gets copied, but we need files like gitlab-logo.png
cp -rf workhorse ${BUILDDIR}
# Remove non-existent symlink
find ${BUILDDIR} -name test.git -delete
# temporary step till protobuf 1.5 vs 1.3 is resolved
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/prometheus ${BUILDDIR}/vendor/github.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/matttproud ${BUILDDIR}/vendor/github.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/googleapis/gax-go ${BUILDDIR}/vendor/github.com/googleapis
mkdir -p ${BUILDDIR}/vendor/google.golang.org
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/google.golang.org/api ${BUILDDIR}/vendor/google.golang.org
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/google.golang.org/genproto ${BUILDDIR}/vendor/google.golang.org
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/go.opencensus.io ${BUILDDIR}/vendor
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/gitlab.com/gitlab-org/labkit ${BUILDDIR}/vendor/gitlab.com/gitlab-org
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/golang/groupcache ${BUILDDIR}/vendor/github.com/golang
mkdir -p ${BUILDDIR}/vendor/github.com/cespare/xxhash
ln -s /usr/share/gocode/src/github.com/cespare/xxhash ${BUILDDIR}/vendor/github.com/cespare/xxhash/v2
mkdir -p ${BUILDDIR}/vendor/github.com/oklog/ulid
ln -s /usr/share/gocode/src/github.com/oklog/ulid ${BUILDDIR}/vendor/github.com/oklog/ulid/v2
mkdir -p ${BUILDDIR}/vendor/cloud.google.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/cloud.google.com/go ${BUILDDIR}/vendor/cloud.google.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/gocloud.dev ${BUILDDIR}/vendor
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/aws ${BUILDDIR}/vendor/github.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/Azure ${BUILDDIR}/vendor/github.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/AzureAD ${BUILDDIR}/vendor/github.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/uber ${BUILDDIR}/vendor/github.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/lightstep ${BUILDDIR}/vendor/github.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/shirou ${BUILDDIR}/vendor/github.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/tklauser ${BUILDDIR}/vendor/github.com
ln -s /usr/share/gocode/src/gitlab.com/gitlab-org/gitaly/v16/vendor/github.com/golang-jwt/jwt/v5 ${BUILDDIR}/vendor/github.com/golang-jwt/jwt
override_dh_auto_build-indep:
dh_auto_build -O--package=gitlab -O--buildsystem=ruby -O--with=ruby