forked from SUSE-Cloud/automation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepochecker
executable file
·78 lines (63 loc) · 3.05 KB
/
repochecker
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
#!/bin/bash
# repochecker tries to solve runtime dependencies for a given repository. It's
# used for the openSUSE/SLE Cloud packages to check the dependencies for the
# different repositories. Use it for instance with:
#
# REPCHECK_DIST_VERSION=13.2 REPCHECK_DIST_NAME=openSUSE \
# REPCHECK_PROJECT="Cloud:OpenStack:Kilo:Staging" repochecker
set -e
: ${REPCHECK_CACHE_DIR:=${XDG_CACHE_HOME:="$HOME/.cache/repochecker"}}
# project to check
: ${REPCHECK_PROJECT:="Cloud:OpenStack:Master"}
# openSUSE or SLE
: ${REPCHECK_DIST_NAME:="openSUSE"}
# i.e. 13.2 , Tumbleweed, 11_SP3, 12
: ${REPCHECK_DIST_VERSION:="13.2"}
: ${REPCHECK_INSTCHECK_EXCLUDES:="-kmp-"}
# buildservice instance used for $REPCHECK_PROJECT.
# use "ibs" for SUSE internal buildservice. Otherwise leave blank
: ${REPCHECK_BS_INSTANCE:=""}
D="${REPCHECK_CACHE_DIR}/${REPCHECK_DIST_NAME}/${REPCHECK_DIST_VERSION}/${REPCHECK_PROJECT}/"
zypper="zypper --gpg-auto-import-keys -n --root $D"
mkdir -p $D
if [[ $REPCHECK_DIST_NAME == "openSUSE" ]]; then
if [[ $REPCHECK_DIST_VERSION == "Tumbleweed" ]]; then
# Tumbleweed needs to be lower case
dv=${REPCHECK_DIST_VERSION,,}
$zypper ar -f http://download.opensuse.org/${dv}/repo/oss/ Base || true
else
$zypper ar -f http://download.opensuse.org/distribution/${REPCHECK_DIST_VERSION}/repo/oss/ Base || true
$zypper ar -f http://download.opensuse.org/update/${REPCHECK_DIST_VERSION}/${REPCHECK_DIST_NAME}:${REPCHECK_DIST_VERSION}:Update.repo || true
fi
fi
if [[ $REPCHECK_DIST_NAME == "SLE" ]]; then
if [[ $REPCHECK_DIST_VERSION == 12* ]]; then
$zypper ar -f "http://smt-internal.opensuse.org/repo/\$RCE/SUSE/Updates/SLE-SERVER/${REPCHECK_DIST_VERSION}/x86_64/update/" Updates || true
$zypper ar -f "http://smt-internal.opensuse.org/repo/\$RCE/SUSE/Products/SLE-SERVER/${REPCHECK_DIST_VERSION}/x86_64/product" Base || true
fi
if [[ $REPCHECK_DIST_VERSION == 11* ]]; then
v=${REPCHECK_DIST_VERSION//_/-}
$zypper ar -f "http://smt-internal.opensuse.org/repo/\$RCE/SLES${v}-Pool/sle-11-x86_64/" Base || true
$zypper ar -f "http://smt-internal.opensuse.org/repo/\$RCE/SLES${v}-Updates/sle-11-x86_64/" Updates || true
fi
fi
# project repos
if [[ $REPCHECK_BS_INSTANCE == "ibs" ]]; then
repo_url="http://download.suse.de/ibs"
else
repo_url="http://download.opensuse.org/repositories"
fi
p=${REPCHECK_PROJECT//:/:\/}
$zypper ar -f ${repo_url}/${p}/${REPCHECK_DIST_NAME}_${REPCHECK_DIST_VERSION}/${REPCHECK_PROJECT}.repo || true
# if it's a staging repo, also add the non-staging one
if [[ "$REPCHECK_PROJECT" == *:Staging ]]; then
pro_nonstaging=${REPCHECK_PROJECT//:Staging/}
p=${pro_nonstaging//:/:\/}
$zypper ar -f ${repo_url}/${p}/${REPCHECK_DIST_NAME}_${REPCHECK_DIST_VERSION}/${pro_nonstaging}.repo || true
fi
$zypper ref
# check package installations
pro_alias=${REPCHECK_PROJECT//:/_}
installcheck x86_64 --withobsoletes --exclude ${REPCHECK_INSTCHECK_EXCLUDES} \
$D/var/cache/zypp/raw/${pro_alias}/repodata/*primary.xml.gz \
--nocheck $D/var/cache/zypp/solv/*/solv