From 6fbc0a0042035ebae326493c1af0396ad610279b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 12 Aug 2010 23:01:43 +0200 Subject: [PATCH] Grep for removed package references before removal. Use 'grep' to catch references to removed packages within other Sunrise ebuilds (*DEPEND) and package.mask. --- sunrise-commit | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/sunrise-commit b/sunrise-commit index 31bd285..a377ef2 100755 --- a/sunrise-commit +++ b/sunrise-commit @@ -145,11 +145,11 @@ find_ebuilds() { # Replace with the filtered version SC_CHANGE_LIST=${SC_REMOVED_PACKAGE_LIST} - local root sdir - root=${category:+../} + local sdir + SC_ROOT=${category:+../} for sdir in eclass licenses profiles; do - check_for_changes ${root}${sdir} >/dev/null && SC_CHANGE_LIST="${SC_CHANGE_LIST} ${root}${sdir}" + check_for_changes ${SC_ROOT}${sdir} >/dev/null && SC_CHANGE_LIST="${SC_CHANGE_LIST} ${SC_ROOT}${sdir}" done SC_SCENARIO=package-removal sayv "We're removing ${SC_CP}." @@ -444,6 +444,22 @@ main() { package-removal) vcs_status ${SC_CHANGE_LIST} echo + + local pkg regex + regex= + for pkg in ${SC_REMOVED_PACKAGE_LIST}; do + regex="${regex:+${regex}\|}${pkg}" + done + + say "${GREEN}Grepping for package references...${RESET}" + # -n is for line numbers, -C would be non-POSIX + if grep -n "${regex}" ${SC_ROOT}*/*/*.ebuild ${SC_ROOT}profiles/package.mask; then + echo + [ -n "${force}" ] || die 'Please remove the removed package references or use --force.' + else + echo + fi + say "Ready to commit ${WHITE}$(echo ${SC_REMOVED_PACKAGE_LIST} | wc -w)${RESET} package removal(s), with commit message:" say "${BGREEN}${SC_CP}: ${commitmsg}${RESET}" confirm @@ -453,8 +469,6 @@ main() { vcs_update ${SC_CHANGE_LIST} fi - # XXX: a consistency check on *DEPENDs, package.mask - vcs_commit "${noprepend-${SC_CP}: }${commitmsg}" ${SC_CHANGE_LIST} ;; esac