-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen-docker
executable file
·69 lines (54 loc) · 2.4 KB
/
gen-docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env bash
cat > Dockerfile <<"EOF"
FROM ocaml/opam:ubuntu-22.04-opam AS base
RUN sudo apt-get update && sudo apt-get install -y gawk autoconf2.69
RUN sudo apt-get install -y vim
# Clone relocatable
RUN git clone https://github.com/dra27/relocatable.git
WORKDIR relocatable
RUN git submodule update --init ocaml
# Configure Git
WORKDIR ocaml
RUN git config --local user.name 'David Allsopp'
RUN git config --local user.email '[email protected]'
# Ensure the normal merge style is in effect or rerere doesn't appear to work!
RUN git config --local merge.conflictstyle merge
# Enable rerere with ~10 year retention of resolutions
RUN git config --local rerere.enabled true
RUN git config --local gc.rerereResolved 3650
# Speed up reconfiguration stage by sharing config.status
RUN git config --local ocaml.configure-cache ..
# Necessary for some of the more complicated rebasing
RUN git config --local merge.renameLimit 150000
# Check commits created by the script (disable the configure check)
RUN sed -e '/If any/iexit $STATUS' tools/pre-commit-githook > ../.git/modules/ocaml/hooks/pre-commit
RUN chmod +x ../.git/modules/ocaml/hooks/pre-commit
# Sync with upstream
RUN git remote add upstream https://github.com/ocaml/ocaml.git --fetch
RUN git checkout relocatable-locks
EOF
for lock in $(git -C ocaml log --oneline --first-parent --format=%h --reverse origin/relocatable-locks | tail -n +2); do
echo "FROM base AS lock-$lock"
echo "RUN test -n \"\$(git branch relocatable-locks --contains '$lock' 2>/dev/null)\" || git fetch origin && git reset --hard origin/relocatable-locks"
echo "RUN script --return --command '../stack $lock' ../log"
done >> Dockerfile
cat >> Dockerfile <<"EOF"
FROM base AS collect
WORKDIR /home/opam
EOF
for lock in $(git -C ocaml log --oneline --first-parent --format=%h --reverse origin/relocatable-locks | tail -n +2); do
echo "COPY --from=lock-$lock /home/opam/relocatable/log lock-$lock"
done >> Dockerfile
cat >> Dockerfile <<"EOF"
COPY --chmod=755 <<EOF display.sh
#!/bin/sh
EOF
sed_line="'1,/^Backport summary/d;/^Script done on/d'"
for lock in $(git -C ocaml log --oneline --first-parent --format=%h --reverse origin/relocatable-locks | tail -n +2); do
echo "echo \"Lock $lock: \$(git -C relocatable/ocaml log -1 --format=%s $lock)\""
echo "sed -e $sed_line lock-$lock"
sed_line="'1,/^ - Trees differ/d;/^Script done on/d'"
done >> Dockerfile
cat >> Dockerfile <<ZOF
EOF
ZOF