# HG changeset patch # User Georges Racinet <georges.racinet@octobus.net> # Date 1682323459 -7200 # Mon Apr 24 10:04:19 2023 +0200 # Node ID 0a957277827854c05820ba29d60c22168fa2fedf # Parent c33ec057cfe2ce895ac8be03efbe6c65a8977e6b RHGitaly: Makefile for dev setup and packaging This freezes in particular the Mercurial sources revision, expressed in the new `rust/mercurial.rev` file. There is no longer need for the the `ci/prepare-rhgitaly` script and its associated revision variable. Run `make -C rust help` for more details. diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,8 +8,7 @@ BASE_IMAGES_TAG: $CI_COMMIT_HG_BRANCH BASE_IMAGES_COLLECTION: registry.heptapod.net:443/heptapod/ci-images BASE_IMAGES_MERCURIAL: $BASE_IMAGES_COLLECTION/mercurial - # good enough for now, will have to depend on branch at some point: - MERCURIAL_RUST_DEP_REVISION: default + MERCURIAL_SHARE_FROM: /opt/mercurial/hg CARGO_HOME: ${CI_PROJECT_DIR}/cargo_home @@ -68,7 +67,7 @@ cache: policy: pull-push script: - - ci/prepare-rhgitaly + - make -C rust dev-dependencies - cargo test --manifest-path rust/Cargo.toml - rust/lint artifacts: @@ -95,7 +94,7 @@ variables: GITALY_INSTALL_DIR: /opt/gitlab/gitaly script: - - ci/prepare-rhgitaly + - make -C rust dev-dependencies # prebuilding RHGitaly to avoid doing it from tests # (output is interesting and we avoid timeout issues) - . /root/.cargo/env diff --git a/ci/prepare-rhgitaly b/ci/prepare-rhgitaly deleted file mode 100755 --- a/ci/prepare-rhgitaly +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -# Mercurial dependency. Thanks to the share from -# the base image, the pull should be small -MERCURIAL_RUST_DEP=rust/dependencies/mercurial -hg share --noupdate /opt/mercurial/hg ${MERCURIAL_RUST_DEP} -hg -R ${MERCURIAL_RUST_DEP} pull -r ${MERCURIAL_RUST_DEP_REVISION} \ - https://foss.heptapod.net/mercurial/mercurial-devel -hg -R ${MERCURIAL_RUST_DEP} update -r ${MERCURIAL_RUST_DEP_REVISION} diff --git a/rust/Makefile b/rust/Makefile new file mode 100644 --- /dev/null +++ b/rust/Makefile @@ -0,0 +1,30 @@ +all: help + +MERCURIAL_SOURCE_REPO = dependencies/mercurial +MERCURIAL_SOURCE_REV := $(shell cat mercurial.rev) +MERCURIAL_SOURCE_REMOTE ?= https://foss.heptapod.net/mercurial/mercurial-devel + +.PHONY: help +help: + @echo "Makefile for RHGitaly development setup and packaging" + @echo "" + @echo "Available commands: " + @echo " make dev-dependencies: prepare development dependencies" + @echo " (hg-core, various resources)" + @echo + @echo "Interesting variables: " + @echo " MERCURIAL_SHARE_FROM: if set, Mercurial sources repository" + @echo " will be created (if needed) with" + @echo " 'hg share' from this given path." + +.PHONY: dev-dependencies +dev-dependencies: dependencies/mercurial/.hg + hg -R $(MERCURIAL_SOURCE_REPO) pull -r $(MERCURIAL_SOURCE_REV) $(MERCURIAL_SOURCE_REMOTE) + hg -R $(MERCURIAL_SOURCE_REPO) update --config commands.update.check=abort $(MERCURIAL_SOURCE_REV) + +dependencies/mercurial/.hg: +ifdef MERCURIAL_SHARE_FROM + hg share --noupdate $(MERCURIAL_SHARE_FROM) $(MERCURIAL_SOURCE_REPO) +else + hg clone --noupdate $(MERCURIAL_SOURCE_REMOTE) $(MERCURIAL_SOURCE_REPO) +endif diff --git a/rust/mercurial.rev b/rust/mercurial.rev new file mode 100644 --- /dev/null +++ b/rust/mercurial.rev @@ -0,0 +1,1 @@ +59fda8516774ee9e47d2a88e5b6c9f42ab611b1c