Last active
February 7, 2022 04:37
-
-
Save moyix/07e8aec5fcbc2c529102944a173add8c to your computer and use it in GitHub Desktop.
Misc infrastructure scripts for my Debian build attempts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -x | |
NAME="$1" | |
sudo apt-get -y update | |
echo "Building $NAME" | |
python3 /scripts/list_dsc.py check "$NAME" || exit 1 | |
cd /fastdata/debian_allsrc/build/ | |
eval $(python3 /scripts/list_dsc.py list "$NAME") | |
python3 /scripts/list_dsc.py urls "$NAME" | wget -i - | |
dpkg-source -x "$DSC" | |
cd "${PKG}-${VER}" | |
sudo -E apt-get -y build-dep "$PKG" | |
DEB_BUILD_OPTIONS="nodoc notest nocheck" timeout -v 6h bear --output "/fastdata/debian_allsrc/json/${PKG}-${VER}_compile_commands.json" -- dpkg-buildpackage -rfakeroot | |
echo "Return value from dpkg-buildpackage: $?" | |
cd /fastdata/debian_allsrc/build/ | |
mv "${PKG}-${VER}" /data/research/debbuild_artifacts/ | |
eval $(python3 /scripts/list_dsc.py clean "$NAME") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export DOCKER_HOST=unix:///var/run/docker-nvme.sock | |
docker build -t debbuild . | |
zcat {main,non-free,contrib}/Sources.gz | \ | |
grep '^Package:' | sed 's/Package: //' | sort -u | \ | |
parallel --progress \ | |
docker run --init --rm -v /data:/data -v /fastdata:/fastdata debbuild {} '&>' /fastdata/buildlogs/{}.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:unstable | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN sed -i 's/main/main contrib non-free/' /etc/apt/sources.list | |
RUN echo "deb-src http://deb.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list | |
RUN apt-get -y update | |
RUN apt-get -y install build-essential bear | |
RUN useradd -ms /bin/bash builder | |
RUN apt-get -y install sudo | |
RUN adduser builder sudo | |
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | |
COPY builddep.txt /tmp/ | |
# RUN cat /tmp/builddep.txt | xargs apt-get -y install | |
RUN apt-get -y install strace python3 python3-debian wget | |
RUN mkdir /scripts | |
COPY build.sh /scripts/ | |
COPY build_latest.sh /scripts/ | |
COPY build_nobear.sh /scripts/ | |
COPY build_debug.sh /scripts/ | |
COPY gen_asm.py /scripts | |
COPY list_dsc.py /scripts | |
RUN chmod +x /scripts/build*.sh | |
USER builder | |
WORKDIR /home/builder | |
ENTRYPOINT ["/scripts/build.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Inject exit(0) into a few processes that are known troublemakers if they run longer than 100 seconds | |
while true; do | |
ps -e -o pid,etimes,comm,cmd | \ | |
grep -E '(erl_child_setup|xvfb-run)' | \ | |
grep -Ev '(Xvfb|wrapper|grep)' | awk '$2 > 100' | \ | |
while read pid etime comm cmd; do | |
echo "Killing $pid ($comm) which has been running for $etime seconds" | |
killbutmakeitlooklikeanaccident.sh "$pid" | |
rm -f core | |
done | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment