From d493431d4dfc76b689a30df271e866fb428991ca Mon Sep 17 00:00:00 2001 From: evermind Date: Thu, 7 Aug 2008 11:02:21 +0000 Subject: [PATCH] check for dups helper script git-svn-id: svn://svn.tuxfamily.org/svnroot/proaudio/proaudio/trunk/overlays/proaudio@1275 d5c9a09b-2911-0410-9af3-a98ebd2cfc69 --- check_for_dups | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 check_for_dups diff --git a/check_for_dups b/check_for_dups new file mode 100755 index 00000000..69594424 --- /dev/null +++ b/check_for_dups @@ -0,0 +1,58 @@ +#!/bin/bash +# LICENCE GPL v2 (c) proaudio team +DUP_FILES="dup_files" +DUP_DEL_FILES="dup_deleted_files" +DUP_EDIT_FILES="dup_edited_files" +DUP_KEEP_FILES="dup_why_keep_files" + +DIFF_FILE="portage_vs_proaudio.diff" +echo "This script is meant to determine if a ebuild is already in the" +echo "portage tree. The script has two modes. The standard mode is interactive:" +echo "In this mode you first get a diff between the dup ebuilds, after" +echo "that you should decide if this ebuild should be marked as deletable," +echo "or if you want to edit it or comment why to keep this ebuild." +echo "Basically three files are created which lists the ebuilds according to" +echo "your decisions:" +echo "The files would be \"$DUP_DEL_FILES\" \"$DUP_KEEP_FILES\" \"$DUP_DEL_FILES\"" +echo +echo "If you want to edit a ebuild. vim is launched opening the overlay version" +echo "the portage's version and also a diff between them" +echo +echo "--> to enable this mode just press ENTER" +echo +echo "The second mode activated with [2]" +echo "just generates a list \"$DUP_FILES\" with duped ebuilds" +echo "which mode you'd like to use? [ENTER] or [2] ([CTRL-C] to exit)" +read MODE + +if [ "${#PORTAGE_TREE}" == "0" ];then + PORTAGE_TREE=/usr/portage +fi +for i in */*/*.ebuild;do + if [ -e "${PORTAGE_TREE}/${i}" ] ;then + if [ "${MODE}" == "2" ];then + echo $i >> $DUP_FILES + else + diff -u "${PORTAGE_TREE}/${i}" "$i"|less + echo "$i" + echo "What to do with this file?" + echo "[d]elete, [e]dit or argue why to [k]eep" + read ACTION + if [ "${ACTION}" == "d" ];then + echo "will delete" + #rm -f $i{i} + echo $i >> $DUP_DEL_FILES + elif [ "${ACTION}" == "e" ];then + diff -u "${PORTAGE_TREE}/${i}" "$i" > "$DIFF_FILE" + vim -o "$i" "${PORTAGE_TREE}/${i}" "$DIFF_FILE" + echo "why did you edit this ebuild? (eg for ChangeLog)" + read edit + echo -e "$i\t$edit" >> $DUP_EDIT_FILES + else + echo "why keep this ebuild?" + read keep + echo -e "$i\t$keep" >> $DUP_KEEP_FILES + fi + fi + fi +done