-
Notifications
You must be signed in to change notification settings - Fork 0
/
gather_archives.sh
executable file
·61 lines (54 loc) · 1.82 KB
/
gather_archives.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
#!/bin/sh
CHROOTSUBDIR=mpchroot
dataDir=$(pwd)
if [[ -n "$MPAB_DATA" ]]; then
dataDir=$MPAB_DATA
fi
chrootPath="${dataDir}/${CHROOTSUBDIR}"
OSMajor=`uname -r | sed 's/\..*//'`
# xcodebuild breaks in chroots on 10.6
if [[ $1 = "-n" || $OSMajor -ge 10 ]]; then
chrootPath=""
if [[ $1 = "-n" ]]; then
shift
fi
fi
if [[ -z "$PORTLISTFILE" ]]; then
PORTLISTFILE=portlist
fi
if [[ -z "$PREFIX" ]]; then
PREFIX="/opt/local"
fi
# path where archives should be staged before being uploaded to the master
if [[ -z "$ULPATH" ]]; then
ULPATH="archive_staging"
fi
mkdir -p $ULPATH
if [[ `head -n1 $PORTLISTFILE` == "all" ]]; then
ports=`${PREFIX}/bin/port -q echo all | tr '\n' ' '`
else
ports=`cat $PORTLISTFILE`
fi
# if mpab was killed due to a timeout, logs will still be in the tmp dir
if ! ls logs-* > /dev/null 2>&1 ; then
now=`date '+%Y%m%d-%H%M%S'`
baseDir=$(dirname $0)
mkdir ${baseDir}/logs-${now}
mv ${chrootPath}/var/tmp/portresults/fail ${baseDir}/logs-${now}
mv ${chrootPath}/var/tmp/portresults/success ${baseDir}/logs-${now}
chmod -R a+rX ${baseDir}/logs-${now}
fi
for portname in $ports; do
if ls logs-*/success/${portname}.log > /dev/null 2>&1 ; then
if ./mpexport/base/portmgr/jobs/port_binary_distributable.tcl -v ${portname}; then
portversion=$(${PREFIX}/bin/port info --index --version --line ${portname})
portrevision=$(${PREFIX}/bin/port info --index --revision --line ${portname})
for archive in ${PREFIX}/var/macports/software/${portname}/${portname}-${portversion}_${portrevision}[+.]*; do
aname=$(basename $archive)
echo preparing archive for upload: $aname
mkdir -p ${ULPATH}/${portname}
cp $archive ${ULPATH}/${portname}/
done
fi
fi
done