Skip to content

Commit

Permalink
Update preview_new_release.sh according to the last version of tezos (#…
Browse files Browse the repository at this point in the history
…2255)

- simplifying the procedure for formatting the tezos codebase (scripts/lint.sh is more rational)
- using `mkdir -p` instead of `--parents` because it raised an error on macOS
- factorizing the commenting/uncommenting of the `version = x` line in .ocamlformat files
- infer looks like it's not able to run dune fmt (no dune file), this project is already tested in test_branch.sh (with no fix) anyway
  • Loading branch information
gpetiot authored Feb 23, 2023
1 parent 1ad4bdb commit 75be514
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
28 changes: 17 additions & 11 deletions tools/preview_new_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ function usage()
echo "usage: $0 -u <GITHUB_USERNAME> -y <GITLAB_USERNAME> -v <RELEASE> [-p <PREFIX>]"
}

function comment_version()
{
version=$1
file=$2
sed -i --follow-symlinks -e "s/^version\(.*\)/#version = $version/" $file
}

function uncomment_version()
{
version=$1
file=$2
sed -i --follow-symlinks -e "s/^#version\(.*\)/version = $version/" $file
}

while getopts ":u:y:v:p:" opt; do
case "$opt" in
u)
Expand Down Expand Up @@ -68,7 +82,7 @@ preview_dir=$prefix/$preview_branch;
log_dir=$preview_dir/logs;

rm -rf $preview_dir &> /dev/null || true;
mkdir --parents $log_dir;
mkdir -p $log_dir;

dirname=`dirname $0`;

Expand Down Expand Up @@ -97,13 +111,9 @@ while read line; do
cd $dir;
git remote add upstream $upstream;
git checkout -b $preview_branch --quiet;

sed -i --follow-symlinks -e "s/^version\(.*\)/#version = $version/" .ocamlformat;
comment_version $version .ocamlformat;

if [ "$namespace/$dir" == "tezos/tezos" ]; then
sed -i --follow-symlinks -e "s/^version\(.*\)/#version = $version/" devtools/git-gas-diff/.ocamlformat;
sed -i --follow-symlinks -e "s/^version\(.*\)/#version = $version/" scripts/lint.sh;
git commit --all -m "Update .ocamlformat files";
bash scripts/lint.sh --update-ocamlformat;
fi;

Expand All @@ -115,14 +125,10 @@ while read line; do

$dune build @fmt &> $log_dir/$dir.log || true;
$dune promote &> /dev/null;
sed -i --follow-symlinks -e "s/^#version\(.*\)/version = $version/" .ocamlformat;

uncomment_version $version .ocamlformat;
git commit --all -m "Preview: upgrade to ocamlformat $version";

if [ "$namespace/$dir" == "tezos/tezos" ]; then
sed -i --follow-symlinks -e "s/^#version\(.*\)/version = $version/" devtools/git-gas-diff/.ocamlformat;
sed -i --follow-symlinks -e "s/^#version\(.*\)/version = $version/" scripts/lint.sh;
git commit --all -m "Update .ocamlformat files";
bash scripts/lint.sh --update-ocamlformat;
fi;
done < $dirname/projects.data;
1 change: 0 additions & 1 deletion tools/projects.data
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
github,facebook,flow
github,facebook,infer
github,mirage,alcotest
github,mirage,decompress
github,mirage,digestif
Expand Down

0 comments on commit 75be514

Please sign in to comment.