03f2f3c09109b1a044b595b4e6d38bdcb618a42c
[bin.git] / build-devmock
1 #!/bin/sh
2 set -eux
3 MOCK="mock -r ${OS:-default}"
4
5 $MOCK --clean
6
7 # install cockpit's build deps and other development tools
8 $MOCK -i $(sed -n '/^BuildRequires:/ {s/^.*: //; s/>=.*$//; s/%{.*}//; p}' ~/upstream/cockpit/tools/cockpit.spec) \
9     npm fontconfig git valgrind chromium-headless \
10     libvirt-daemon-kvm libvirt-client python3-libvirt \
11     virt-viewer libappstream-glib \
12     expect python3-pycodestyle python3-pyflakes \
13     fedpkg /usr/bin/oc /usr/bin/genisoimage \
14     man-pages socat wget genisoimage vim-enhanced \
15     ansible standard-test-roles rsync waiverdb-cli
16
17 # interactive shell sessions work as user martin, not builder
18 $MOCK --unpriv --copyin /dev/stdin /builddir/.bashrc <<EOF
19 export HOME=/home/martin
20 export TERM=xterm
21 cd
22
23 # Source global definitions
24 if [ -f /etc/bashrc ]; then
25         . /etc/bashrc
26 fi
27 . ~/.bashrc
28 EOF
29
30 # make mock compatible with ostree's /home → /var/home structure
31 $MOCK --chroot -- ln -sf /home /var/home
32
33 # install rhpkg
34 $MOCK -i ~martin/Dokumente/Arbeit/RedHat/redhat-internal-cert-install-0.1-7.el7.csb.noarch.rpm
35 $MOCK --chroot -- 'echo >> /etc/dnf/dnf.conf; curl --location https://download.devel.redhat.com/rel-eng/RCMTOOLS/rcm-tools-fedora.repo >> /etc/dnf/dnf.conf; dnf install -y rhpkg'
36
37 # set up waiverdb
38 mock --chroot -- 'printf "[waiverdb]\nauth_method=Kerberos\nresultsdb_api_url=https://resultsdb-api.engineering.redhat.com/api/v2.0\napi_url=https://waiverdb.engineering.redhat.com/api/v1.0\nkrb_principal=HTTP/waiverdb.engineering.redhat.com@REDHAT.COM\n" > /etc/waiverdb/client.conf'
39 mock --chroot -- 'sed -i "/\[libdefaults\]/ s/$/\n    dns_canonicalize_hostname = false/" /etc/krb5.conf'
40
41 # ssh looks at passwd, not $HOME
42 $MOCK --chroot --unpriv -- rm -rf /builddir/.ssh
43 $MOCK --chroot --unpriv -- ln -s /home/martin/.ssh /builddir/.ssh
44 $MOCK --chroot --unpriv -- ln -s /home/martin/upstream /builddir/upstream