summaryrefslogtreecommitdiffstats
path: root/Tools/portbuild/scripts/prunebad
blob: ddcc709bb099c46b3c872e4ce75a0a1b7d7a93d2 (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
#!/bin/sh

# configurable variables
pb=/var/portbuild

if [ $# -ne 2 ]; then
    echo "prunebad <arch> <branch>"
    exit 1
fi

arch=$1
branch=$2
shift 2

. ${pb}/${arch}/portbuild.conf
. ${pb}/scripts/buildenv

buildenv ${pb} ${arch} ${branch}

cd ${pb}/${arch}/${branch}

if [ -f .packagelock ]; then exit; fi
touch .packagelock

cd packages/All
if [ ! -f .packagestamp ]; then
    newfiles=$(find . -name \*${PKGSUFFIX})
else
    newfiles=$(find . -name \*${PKGSUFFIX} -newer ../../.packagestamp)
fi
touch ../../.packagestamp
echo Checking $newfiles

mkdir -p ${pb}/${arch}/${branch}/bad
echo "checking packages"
for i in ${newfiles}; do
  if ! ${PKGZIPCMD} -t $i; then
    echo "Warning: package $i is bad, moving to ${pb}/${arch}/${branch}/bad"
    # the latest link will be left behind...
    mv $i ${pb}/${arch}/${branch}/bad
    rm ../*/$i
  fi
done
cd ../..
rm .packagelock
OpenPOWER on IntegriCloud