-
Notifications
You must be signed in to change notification settings - Fork 13
/
mock_wrapper.sh
executable file
·80 lines (68 loc) · 2.66 KB
/
mock_wrapper.sh
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
70
71
72
73
74
75
76
77
78
79
#!/usr/bin/bash
# Usage: ./mock_wrapper.sh <version> <NVR file>
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
set -e
PROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
RELEASEVER=$1
VERNUM=$RELEASEVER
if [ "$RELEASEVER" == "rawhide" ]; then
VERNUM=27
fi
cat > $SCRIPT_DIR/fedora-$RELEASEVER-multiarch.cfg << EOF
config_opts['root'] = 'fedora-$RELEASEVER-srpm'
config_opts['target_arch'] = 'x86_64'
config_opts['legal_host_arches'] = ('x86_64')
config_opts['chroot_setup_cmd'] = 'install bash fedora-release fedpkg gnupg2 git-core redhat-rpm-config rpm-build shadow-utils gawk koji glibc-minimal-langpack rpmdevtools'
config_opts['dist'] = 'fc$VERNUM' # only useful for --resultdir variable subst
config_opts['extra_chroot_dirs'] = [ '/run/lock', ]
config_opts['releasever'] = '$VERNUM'
config_opts['package_manager'] = 'dnf'
config_opts['use_bootstrap_container'] = False
config_opts['rpmbuild_networking'] = True
config_opts['yum.conf'] = """
[main]
keepcache=1
debuglevel=2
reposdir=/dev/null
logfile=/var/log/yum.log
retries=20
obsoletes=1
gpgcheck=0
assumeyes=1
syslog_ident=mock
syslog_device=
install_weak_deps=0
metadata_expire=0
mdpolicy=group:primary
best=1
# repos
[fedora]
name=fedora
metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$RELEASEVER&arch=\$basearch
failovermethod=priority
gpgkey=file:///usr/share/distribution-gpg-keys/fedora/RPM-GPG-KEY-fedora-$VERNUM-primary
gpgcheck=0
[updates]
name=updates
metalink=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$RELEASEVER&arch=\$basearch
failovermethod=priority
gpgkey=file:///usr/share/distribution-gpg-keys/fedora/RPM-GPG-KEY-fedora-$VERNUM-primary
gpgcheck=0
"""
EOF
mock -r $SCRIPT_DIR/fedora-$RELEASEVER-multiarch.cfg init
mock -r $SCRIPT_DIR/fedora-$RELEASEVER-multiarch.cfg --chroot "mkdir -p /opt/srpm/output"
mock -r $SCRIPT_DIR/fedora-$RELEASEVER-multiarch.cfg --copyin $SCRIPT_DIR/recreate_srpm.sh \
/opt/srpm/recreate_srpm.sh
mock -r $SCRIPT_DIR/fedora-$RELEASEVER-multiarch.cfg --copyin $SCRIPT_DIR/get_package_hashes.py \
/opt/srpm/get_package_hashes.py
mock -r $SCRIPT_DIR/fedora-$RELEASEVER-multiarch.cfg --copyin $2 \
/opt/srpm/srpms.txt
mock -r $SCRIPT_DIR/fedora-$RELEASEVER-multiarch.cfg --chroot "mkdir -p /opt/srpm/output"
mock -r $SCRIPT_DIR/fedora-$RELEASEVER-multiarch.cfg --chroot \
"pushd /opt/srpm/output; \
cat /opt/srpm/srpms.txt | xargs --max-procs=$PROCESSORS -I NVR \
/opt/srpm/recreate_srpm.sh NVR \
popd"
rm -Rf ./output
mock -r $SCRIPT_DIR/fedora-$RELEASEVER-multiarch.cfg --copyout /opt/srpm/output ./output