From b9dde2b9f84c916cd5b862d4f1a1f886a70c6479 Mon Sep 17 00:00:00 2001 From: Kris Kennaway Date: Sat, 26 Jul 2008 14:14:35 +0000 Subject: * Catch up to build ID directory changes * Optimize by copying old packages using cpio -dumpl (i.e. create hardlink instead of copying the file). --- Tools/portbuild/scripts/keeprestr | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'Tools') diff --git a/Tools/portbuild/scripts/keeprestr b/Tools/portbuild/scripts/keeprestr index 01b487ab1e7c..22b72cac76f2 100755 --- a/Tools/portbuild/scripts/keeprestr +++ b/Tools/portbuild/scripts/keeprestr @@ -1,11 +1,32 @@ -#!/bin/sh +#!/bin/sh -x + +usage () { + echo "usage: keeprestr arch branch buildid" + exit 1 +} + +if [ $# -ne 3 ]; then + usage +fi arch=$1 branch=$2 +buildid=$3 + +pb=/var/portbuild + +. ${pb}/scripts/buildenv + +buildid=$(resolve ${pb} ${arch} ${branch} ${buildid}) +if [ -z "${buildid}" ]; then + echo "Invalid build ID ${buildid}" + exit 1 +fi -cd /var/portbuild/${arch}/${branch} +builddir=${pb}/${arch}/${branch}/builds/${buildid} +cd ${builddir} rm -rf bak/restricted mkdir -p bak/restricted -tar cvf - `tr ';' '\n' < restricted.sh | grep "/bin/rm -f" | awk '{print $3}' | grep packages/ | sed -e "s,/var/portbuild/${arch}/${branch}/,," -e 's,)$,,' ` | tar xfCP - bak/restricted/ +(tr ';' '\n' < restricted.sh | grep "/bin/rm -f" | awk '{print $3}' | grep packages/ | sed -e "s,${builddir}/,," -e 's,)$,,' | xargs ls -1 2>/dev/null) | cpio -dumpl bak/restricted/ -- cgit v1.2.3