summaryrefslogtreecommitdiff
path: root/usr.sbin/sysmerge
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2011-04-21 15:54:25 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2011-04-21 15:54:25 +0000
commit7b31c26dd8a637cf40ee6f2c9ab2e460d905d3d9 (patch)
tree1118c38ddd01296f2a0e2323a59b66412319f18e /usr.sbin/sysmerge
parent75b72345e279c79d30c6ab7a75d8c0ec9aa6e159 (diff)
Better detection of obsolete files (naddy@ reported a false positive).
help from and ok naddy@
Diffstat (limited to 'usr.sbin/sysmerge')
-rw-r--r--usr.sbin/sysmerge/sysmerge.sh9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/sysmerge/sysmerge.sh b/usr.sbin/sysmerge/sysmerge.sh
index 55b90e59208..e58de6fdcd4 100644
--- a/usr.sbin/sysmerge/sysmerge.sh
+++ b/usr.sbin/sysmerge/sysmerge.sh
@@ -1,6 +1,6 @@
#!/bin/ksh -
#
-# $OpenBSD: sysmerge.sh,v 1.68 2011/04/20 09:37:35 ajacoutot Exp $
+# $OpenBSD: sysmerge.sh,v 1.69 2011/04/21 15:54:24 ajacoutot Exp $
#
# Copyright (c) 1998-2003 Douglas Barton <DougB@FreeBSD.org>
# Copyright (c) 2008, 2009, 2010 Antoine Jacoutot <ajacoutot@openbsd.org>
@@ -130,10 +130,11 @@ do_populate() {
fi
# check for obsolete files
- awk '{ print $3 }' ${DESTDIR}/${DBDIR}/${i} > ${WRKDIR}/new
- awk '{ print $3 }' ${WRKDIR}/${i} > ${WRKDIR}/old
+ awk '{ print $3 }' ${DESTDIR}/${DBDIR}/${i} | sed 's/^./X/;s/$/X/' > ${WRKDIR}/new
+ awk '{ print $3 }' ${WRKDIR}/${i} | sed 's/^./X/;s/$/X/' > ${WRKDIR}/old
if [ -n "`diff -q ${WRKDIR}/old ${WRKDIR}/new`" ]; then
- local _obs="${_obs} `diff -C 0 ${WRKDIR}/new ${WRKDIR}/old | sed -n -e 's,^- .,,gp'`"
+ local _diff=`grep -v -F ${WRKDIR}/old ${WRKDIR}/new | sed 's/^X//;s/X$//'`
+ _obs="${_diff} ${_obs}"
set -A OBSOLETE_FILES -- ${_obs}
fi
rm ${WRKDIR}/new ${WRKDIR}/old