Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile49
-rw-r--r--ctxt.BuildTags2
-rw-r--r--go.mod1
-rw-r--r--go.sum3
4 files changed, 48 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index cf9c95a43..5a34c1c70 100644
--- a/Makefile
+++ b/Makefile
@@ -56,6 +56,7 @@ GOLANGCI_LINT_VERSION ?= 1.27.0
PROTOC_VERSION ?= 3.6.1
PROTOC_GEN_GO_VERSION ?= 1.3.2
GIT_VERSION ?= v2.27.0
+LIBGIT2_VERSION ?= v1.0.1
# Dependency downloads
ifeq (${OS},Darwin)
@@ -89,6 +90,29 @@ ifeq (${GIT_BUILD_OPTIONS},)
GIT_BUILD_OPTIONS += NO_R_TO_GCC_LINKER=YesPlease
endif
+# libgit2 target
+LIBGIT2_REPO_URL ?= https://gitlab.com/libgit2/libgit2
+LIBGIT2_SOURCE_DIR ?= ${BUILD_DIR}/src/libgit2
+LIBGIT2_BUILD_DIR ?= ${LIBGIT2_SOURCE_DIR}/build
+LIBGIT2_INSTALL_DIR ?= ${BUILD_DIR}/libgit2
+
+ifeq (${LIBGIT2_BUILD_OPTIONS},)
+ LIBGIT2_BUILD_OPTIONS += -DTHREADSAFE=ON
+ LIBGIT2_BUILD_OPTIONS += -DBUILD_CLAR=OFF
+ LIBGIT2_BUILD_OPTIONS += -DBUILD_SHARED_LIBS=OFF
+ LIBGIT2_BUILD_OPTIONS += -DCMAKE_C_FLAGS=-fPIC
+ LIBGIT2_BUILD_OPTIONS += -DCMAKE_BUILD_TYPE=Release
+ LIBGIT2_BUILD_OPTIONS += -DCMAKE_INSTALL_PREFIX=${LIBGIT2_INSTALL_DIR}
+ LIBGIT2_BUILD_OPTIONS += -DCMAKE_INSTALL_LIBDIR=lib
+ LIBGIT2_BUILD_OPTIONS += -DENABLE_TRACE=OFF
+ LIBGIT2_BUILD_OPTIONS += -DUSE_SSH=OFF
+ LIBGIT2_BUILD_OPTIONS += -DUSE_HTTPS=OFF
+ LIBGIT2_BUILD_OPTIONS += -DUSE_NTLMCLIENT=OFF
+ LIBGIT2_BUILD_OPTIONS += -DUSE_BUNDLED_ZLIB=ON
+ LIBGIT2_BUILD_OPTIONS += -DUSE_HTTP_PARSER=builtin
+ LIBGIT2_BUILD_OPTIONS += -DREGEX_BACKEND=builtin
+endif
+
# These variables control test options and artifacts
TEST_OPTIONS ?=
TEST_REPORT_DIR ?= ${BUILD_DIR}/reports
@@ -110,9 +134,10 @@ find_go_sources = $(shell find ${SOURCE_DIR} -type d \( -name ruby -o -name ven
find_go_packages = $(dir $(call find_go_sources, 's|[^/]*\.go||'))
unexport GOROOT
-export GOBIN = ${BUILD_DIR}/bin
-export GOPROXY ?= https://proxy.golang.org
-export PATH := ${BUILD_DIR}/bin:${PATH}
+export GOBIN = ${BUILD_DIR}/bin
+export GOPROXY ?= https://proxy.golang.org
+export PATH := ${BUILD_DIR}/bin:${PATH}
+export PKG_CONFIG_PATH := ${LIBGIT2_INSTALL_DIR}/lib/pkgconfig
.NOTPARALLEL:
@@ -121,7 +146,7 @@ all: INSTALL_DEST_DIR = ${SOURCE_DIR}
all: install
.PHONY: build
-build: ${SOURCE_DIR}/.ruby-bundle
+build: ${SOURCE_DIR}/.ruby-bundle libgit2
go install ${GO_LDFLAGS} $(addprefix ${GITALY_PACKAGE}/cmd/, $(call find_commands))
.PHONY: install
@@ -168,7 +193,7 @@ prepare-tests: ${GITLAB_SHELL_DIR}/config.yml ${TEST_REPO} ${TEST_REPO_GIT} ${SO
test: test-go rspec rspec-gitlab-shell
.PHONY: test-go
-test-go: prepare-tests ${GO_JUNIT_REPORT}
+test-go: prepare-tests ${GO_JUNIT_REPORT} libgit2
${Q}mkdir -p ${TEST_REPORT_DIR}
${Q}echo 0>${TEST_EXIT}
${Q}go test ${TEST_OPTIONS} -v -ldflags='${GO_TEST_LDFLAGS}' -count=1 $(call find_go_packages) 2>&1 | tee ${TEST_OUTPUT} || echo $$? >${TEST_EXIT}
@@ -207,7 +232,7 @@ check-mod-tidy:
${Q}${SOURCE_DIR}/_support/check-mod-tidy
.PHONY: lint
-lint: ${GOLANGCI_LINT}
+lint: ${GOLANGCI_LINT} libgit2
${Q}${GOLANGCI_LINT} cache clean && ${GOLANGCI_LINT} run --out-format tab --config ${SOURCE_DIR}/.golangci.yml
.PHONY: check-formatting
@@ -250,7 +275,7 @@ rubocop: ${SOURCE_DIR}/.ruby-bundle
${Q}cd ${GITALY_RUBY_DIR} && bundle exec rubocop --parallel
.PHONY: cover
-cover: prepare-tests
+cover: prepare-tests libgit2
${Q}echo "NOTE: make cover does not exit 1 on failure, don't use it to check for tests success!"
${Q}mkdir -p "${COVERAGE_DIR}"
${Q}rm -f "${COVERAGE_DIR}/all.merged" "${COVERAGE_DIR}/all.html"
@@ -311,6 +336,9 @@ build-git:
${Q}mkdir -p ${GIT_INSTALL_DIR}
${MAKE} -C ${GIT_SOURCE_DIR} -j$(shell nproc) prefix=${GIT_PREFIX} ${GIT_BUILD_OPTIONS} install
+.PHONY: libgit2
+libgit2: ${LIBGIT2_INSTALL_DIR}/lib/libgit2.a
+
# This file is used by Omnibus and CNG to skip the "bundle install"
# step. Both Omnibus and CNG assume it is in the Gitaly root, not in
# _build. Hence the '../' in front.
@@ -352,6 +380,13 @@ ${BUILD_DIR}/git_full_bins.tgz: | ${BUILD_DIR}
${Q}printf '${GIT_BINARIES_HASH} $@.tmp' | shasum -a256 -c -
${Q}mv $@.tmp $@
+${LIBGIT2_INSTALL_DIR}/lib/libgit2.a:
+ ${Q}rm -rf ${LIBGIT2_SOURCE_DIR}
+ git clone --depth 1 --branch ${LIBGIT2_VERSION} --quiet ${LIBGIT2_REPO_URL} ${LIBGIT2_SOURCE_DIR}
+ ${Q}mkdir -p ${LIBGIT2_BUILD_DIR}
+ ${Q}cd ${LIBGIT2_BUILD_DIR} && cmake ${LIBGIT2_SOURCE_DIR} ${LIBGIT2_BUILD_OPTIONS}
+ ${Q}cmake --build ${LIBGIT2_BUILD_DIR} --target install
+
${GOIMPORTS}: ${BUILD_DIR}/go.mod | ${BUILD_DIR}/bin
${Q}cd ${BUILD_DIR} && go get golang.org/x/tools/cmd/goimports@2538eef75904eff384a2551359968e40c207d9d2
diff --git a/ctxt.BuildTags b/ctxt.BuildTags
index defa606e9..6deb1ea8a 100644
--- a/ctxt.BuildTags
+++ b/ctxt.BuildTags
@@ -1,3 +1,5 @@
continuous_profiler_stackdriver
+static
+system_libgit2
tracer_static
tracer_static_jaeger
diff --git a/go.mod b/go.mod
index c9581053b..dfc6b0e6a 100644
--- a/go.mod
+++ b/go.mod
@@ -11,6 +11,7 @@ require (
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/kelseyhightower/envconfig v1.3.0
github.com/lib/pq v1.2.0
+ github.com/libgit2/git2go/v30 v30.0.5
github.com/olekukonko/tablewriter v0.0.2
github.com/otiai10/curr v1.0.0 // indirect
github.com/prometheus/client_golang v1.0.0
diff --git a/go.sum b/go.sum
index c91a01b46..5c96bf646 100644
--- a/go.sum
+++ b/go.sum
@@ -199,7 +199,10 @@ github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvf
github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
+github.com/libgit2/git2go v0.0.0-20190104134018-ecaeb7a21d47 h1:HDt7WT3kpXSHq4mlOuLzgXH9LeOK1qlhyFdKIAzxxeM=
github.com/libgit2/git2go v0.0.0-20190104134018-ecaeb7a21d47/go.mod h1:4bKN42efkbNYMZlvDfxGDxzl066GhpvIircZDsm8Y+Y=
+github.com/libgit2/git2go/v30 v30.0.5 h1:gxKqXOslpvYDZNC62f8GV34TAk0qw4wZ++IdYw8V9I4=
+github.com/libgit2/git2go/v30 v30.0.5/go.mod h1:YReiQ7xhMoyAL4ISYFLZt+OGqn6xtLqvTC1xJ9oAH7Y=
github.com/lightstep/lightstep-tracer-go v0.15.6 h1:D0GGa7afJ7GcQvu5as6ssLEEKYXvRgKI5d5cevtz8r4=
github.com/lightstep/lightstep-tracer-go v0.15.6/go.mod h1:6AMpwZpsyCFwSovxzM78e+AsYxE8sGwiM6C3TytaWeI=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=