Commit 37226100 authored by Mehdi Bouaziz's avatar Mehdi Bouaziz Committed by Romain

CI: sort opam packages

- It's much easier to review and rebase changes when things are sorted. There was a bug in the sorting.
- Also print the comment on the section being auto-generated directly from the script to avoid it being manually erased (happened to me by mistake during a rebase)

I checked that `.gitlab-ci.yml` contain the same packages as before:
```
sort .gitlab-ci.yml > gitlab-ci.sorted
git show origin/master:.gitlab-ci.yml | sort > gitlab-ci.master.sorted
diff gitlab-ci.sorted gitlab-ci.master.sorted
```
only reveals the extra added blank line.
parent e2f83dbd
Pipeline #107573635 passed with stages
This diff is collapsed.
......@@ -11,21 +11,26 @@ src_dir="$(dirname "$script_dir")"
tmp=$(mktemp)
packages=$(echo $packages | sed -e 's/ /\n/' | sort)
packages=$(echo "$packages" | sort)
sed -z 's/^\(.*##BEGIN_OPAM##\n\).*\(\n##END_OPAM##.*\)$/\1/' "$src_dir/.gitlab-ci.yml" > $tmp
(
sed -z 's/^\(.*##BEGIN_OPAM##\n\).*\(\n##END_OPAM##.*\)$/\1/' "$src_dir/.gitlab-ci.yml"
for package in $packages; do
cat >> $tmp <<EOF
echo "# this section is updated using the script $(basename $script_dir)/$(basename $0)"
echo
for package in $packages; do
cat <<EOF
opam:$package:
<<: *opam_definition
variables:
package: $package
EOF
done
done
sed -z 's/^\(.*##BEGIN_OPAM##\n\).*\(\n##END_OPAM##.*\)$/\2/' "$src_dir/.gitlab-ci.yml" >> $tmp
sed -z 's/^\(.*##BEGIN_OPAM##\n\).*\(\n##END_OPAM##.*\)$/\2/' "$src_dir/.gitlab-ci.yml"
) > $tmp
mv $tmp "$src_dir/.gitlab-ci.yml"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment