CI: add script for importing packages
This commit is contained in:
parent
f49fc5f548
commit
6d59a497e7
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
variables:
|
variables:
|
||||||
## Please update `scripts/version.sh` accordingly
|
## Please update `scripts/version.sh` accordingly
|
||||||
build_deps_image_version: dea9fc16442f36e71caa459f9675928d6b14a800
|
build_deps_image_version: 63f06ab145e22aef4cc55b5b9557756d4c868843
|
||||||
build_deps_image_name: registry.gitlab.com/tezos/opam-repository
|
build_deps_image_name: registry.gitlab.com/tezos/opam-repository
|
||||||
public_docker_image_name: docker.io/${CI_PROJECT_PATH}
|
public_docker_image_name: docker.io/${CI_PROJECT_PATH}
|
||||||
|
|
||||||
|
@ -11,8 +11,21 @@ echo "## Checking installed dependencies..."
|
|||||||
echo
|
echo
|
||||||
|
|
||||||
if ! opam install $packages --deps-only --with-test --show-actions | grep "Nothing to do." > /dev/null 2>&1 ; then
|
if ! opam install $packages --deps-only --with-test --show-actions | grep "Nothing to do." > /dev/null 2>&1 ; then
|
||||||
echo "Failure!"
|
echo
|
||||||
|
echo 'Failure! Missing actions:'
|
||||||
|
echo
|
||||||
opam install $packages --deps-only --with-test --show-actions
|
opam install $packages --deps-only --with-test --show-actions
|
||||||
|
echo
|
||||||
|
echo 'Running `./scripts/update_opam_repo.sh`'
|
||||||
|
echo
|
||||||
|
./scripts/update_opam_repo.sh
|
||||||
|
echo
|
||||||
|
echo 'Result:'
|
||||||
|
echo
|
||||||
|
cat opam_repo.patch
|
||||||
|
echo
|
||||||
|
echo 'Failed! Please run: `./scripts/update_opam_repo.sh` and follow the instructions.'
|
||||||
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
80
scripts/update_opam_repo.sh
Executable file
80
scripts/update_opam_repo.sh
Executable file
@ -0,0 +1,80 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
target="$(pwd)"/opam_repo.patch tmp_dir=$(mktemp -dt tezos_deps_opam.XXXXXXXX)
|
||||||
|
|
||||||
|
cleanup () {
|
||||||
|
set +e
|
||||||
|
echo Cleaning up...
|
||||||
|
rm -rf "$tmp_dir"
|
||||||
|
rm -rf Dockerfile
|
||||||
|
}
|
||||||
|
# trap cleanup EXIT INT
|
||||||
|
|
||||||
|
script_dir="$(cd "$(dirname "$0")" && echo "$(pwd -P)/")"
|
||||||
|
src_dir="$(dirname "$script_dir")"
|
||||||
|
|
||||||
|
. "$script_dir"/version.sh
|
||||||
|
|
||||||
|
opams=$(find "$src_dir/vendors" "$src_dir/src" -name \*.opam -print)
|
||||||
|
|
||||||
|
## Full snapshot of the opam repository
|
||||||
|
git clone "$opam_repository_url" -b full "$tmp_dir"
|
||||||
|
|
||||||
|
## Adding the various tezos packages
|
||||||
|
packages=
|
||||||
|
for opam in $opams; do
|
||||||
|
|
||||||
|
dir=$(dirname $opam)
|
||||||
|
file=$(basename $opam)
|
||||||
|
package=${file%.opam}
|
||||||
|
packages=$packages,$package
|
||||||
|
mkdir -p "$tmp_dir"/packages/$package/$package.dev
|
||||||
|
|
||||||
|
## HACK: For some reason, `opam admin list/filter` do not follow
|
||||||
|
## `--with-test/doc` for 'toplevel' package, only for their
|
||||||
|
## 'dependencies. We want the exact opposite (like for `opam
|
||||||
|
## install`), so we manually remove the tag the most
|
||||||
|
## ugliest-possible way...
|
||||||
|
|
||||||
|
sed -e "s/{ *test *}//" \
|
||||||
|
-e "s/test \& //" \
|
||||||
|
-e "s/\& test//" \
|
||||||
|
-e "s/{ *doc *}//" \
|
||||||
|
-e "s/doc \& //" \
|
||||||
|
-e "s/\& doc//" \
|
||||||
|
$opam > "$tmp_dir"/packages/$package/$package.dev/opam
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
## Filtering unrequired packages
|
||||||
|
cd $tmp_dir
|
||||||
|
opam admin filter --yes \
|
||||||
|
--resolve $packages,ocaml,ocaml-base-compiler,odoc,opam-depext
|
||||||
|
|
||||||
|
## Adding useful compiler variants
|
||||||
|
for variant in afl flambda fp fp+flambda ; do
|
||||||
|
git checkout packages/ocaml-variants/ocaml-variants.$ocaml_version+$variant
|
||||||
|
done
|
||||||
|
|
||||||
|
## Removing the various tezos packages
|
||||||
|
for opam in $opams; do
|
||||||
|
file=$(basename $opam)
|
||||||
|
package=${file%.opam}
|
||||||
|
rm -r "$tmp_dir"/packages/$package
|
||||||
|
done
|
||||||
|
|
||||||
|
## Adding safer hashes
|
||||||
|
opam admin add-hashes sha256 sha512
|
||||||
|
|
||||||
|
## Generating the diff!
|
||||||
|
git reset "$opam_repository_tag"
|
||||||
|
git add packages
|
||||||
|
git diff HEAD -- packages > "$target"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Wrote proposed update in: $target."
|
||||||
|
echo 'Please add this patch to: `https://gitlab.com/tezos/opam-repository`'
|
||||||
|
echo 'And update accordingly the commit hash in: `.gitlab-ci.yml` and `scripts/version.sh`'
|
||||||
|
echo
|
@ -7,6 +7,6 @@ ocaml_version=4.06.1
|
|||||||
opam_version=2.0.0~rc3
|
opam_version=2.0.0~rc3
|
||||||
|
|
||||||
## Please update `.gitlab-ci.yml` accordingly
|
## Please update `.gitlab-ci.yml` accordingly
|
||||||
opam_repository_tag=dea9fc16442f36e71caa459f9675928d6b14a800
|
opam_repository_tag=63f06ab145e22aef4cc55b5b9557756d4c868843
|
||||||
opam_repository_url=https://gitlab.com/tezos/opam-repository.git
|
opam_repository_url=https://gitlab.com/tezos/opam-repository.git
|
||||||
opam_repository=$opam_repository_url\#$opam_repository_tag
|
opam_repository=$opam_repository_url\#$opam_repository_tag
|
||||||
|
Loading…
Reference in New Issue
Block a user