blob: a7b286ac69901b4649f44fd3986591ff751cff91 (
plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/bin/bash
# distributed by cfengine
# this takes about 1.5mins to run the first time. <45s thereafter
# if the lv is really small (2G), the default inode ratio is too large.
# eg. mkfs.ext2 -i 4096 /dev/vg/var_mastermirror-staging
# WARNING: Do NOT use CVS -D without resolving bug 183926 first, or bug 401633 happens.
export CVSROOT="/var/cvsroot"
export GITROOT="/var/gitroot"
CVS="/usr/bin/cvs -Q -T /mnt/cvstmp"
CVS_UP="${CVS} up -A -P -C -d"
CVS_CO="${CVS} -d ${CVSROOT} co -A -P"
GIT="/usr/bin/git"
GIT_CL="${GIT} clone -q"
GIT_PL="${GIT} pull -q --ff-only --no-stat --no-rebase"
WGET="/usr/bin/wget --timeout=2 -q"
STAGING_DIR="/var/tmp/mastermirror-staging"
STAGING_CHANGELOG_DIR="/var/tmp/mastermirror-staging/changelogs"
HERDS_XML_URI=https://api.gentoo.org/packages/herds.xml
# TODO: we should probably be checking out to a directory and only rsyncing
# that on success of all checkouts.
# sanity checking
if ! grep -sq ${STAGING_DIR} /proc/mounts; then
echo "lv not mounted" >&2
exit 1
fi
# repo/gentoo (formerly CVS gentoo-x86)
if [[ ! -d ${STAGING_DIR}/gentoo-x86 ]] ; then
# not checked out yet, run initial co
${GIT_CL} file://${GITROOT}/repo/gentoo.git/ ${STAGING_DIR}/gentoo-x86
else
cd ${STAGING_DIR}/gentoo-x86
${GIT_PL}
fi
# gentoo-news
if [[ ! -d ${STAGING_DIR}/gentoo-news ]]; then
# not checked out yet, run initial co
cd ${STAGING_DIR}
${GIT_CL} file://${GITROOT}/data/gentoo-news.git/ gentoo-news
else
cd ${STAGING_DIR}/gentoo-news
${GIT_PL}
fi
# herds.xml
if [[ ! -d ${STAGING_DIR}/herds ]]; then
mkdir -p ${STAGING_DIR}/herds
fi
cd ${STAGING_DIR}/herds
f=herds.xml
${WGET} -q "${HERDS_XML_URI}" -O ${f}.tmp && mv -f ${f}{.tmp,} || rm -f ${f}.tmp
# dtd
if [[ ! -d ${STAGING_DIR}/dtd ]]; then
# not checked out yet, run initial co
cd ${STAGING_DIR}
${GIT_CL} file://${GITROOT}/data/dtd.git/ dtd
else
cd ${STAGING_DIR}/dtd
${GIT_PL}
fi
# glsa
if [[ ! -d ${STAGING_DIR}/glsa ]]; then
# not checked out yet, run initial co
cd ${STAGING_DIR}
${GIT_CL} file://${GITROOT}/data/glsa.git/ glsa
else
cd ${STAGING_DIR}/glsa
${GIT_PL}
fi
# changelogs
if [[ ! -d ${STAGING_CHANGELOG_DIR} ]]; then
# not checked out yet, run initial co
${GIT_CL} file://${GITROOT}/data/gentoo-changelogs.git/ ${STAGING_CHANGELOG_DIR}
else
cd ${STAGING_CHANGELOG_DIR}
${GIT_PL}
fi
|