diff --git a/ChangeLog-current.txt b/ChangeLog-current.txt index cbb755a..2a6e6b6 100644 --- a/ChangeLog-current.txt +++ b/ChangeLog-current.txt @@ -43,4 +43,7 @@ enhancements: * Implement configurable repository support, and use it to support git-based repositories. The Slamd64Builds repository is now listed, for the joy of all the Slamd64 users out there. + * Move sbopkg-renames to new /etc/sbopkg/renames.d/50-default to manage + multiple renames files. Thanks to Robby Workman for the suggestion. Add + new document README-renames.d that explains how this works. +--------------------------+ diff --git a/src/etc/sbopkg/sbopkg-renames.new b/src/etc/sbopkg/renames.d/50-default similarity index 100% rename from src/etc/sbopkg/sbopkg-renames.new rename to src/etc/sbopkg/renames.d/50-default diff --git a/src/usr/doc/HACKING b/src/usr/doc/HACKING index 9cf1bd7..90668f2 100644 --- a/src/usr/doc/HACKING +++ b/src/usr/doc/HACKING @@ -1,3 +1,5 @@ +# $Id$ + We welcome contributions to sbopkg. If you have a bug report or a feature request, please go to the project's Google Code site and use the 'Issue Tracker' so your bug report/feature request does not get lost: diff --git a/src/usr/doc/README-renames.d b/src/usr/doc/README-renames.d new file mode 100644 index 0000000..594fe87 --- /dev/null +++ b/src/usr/doc/README-renames.d @@ -0,0 +1,23 @@ +# $Id$ + +The /etc/sbopkg/renames.d directory is the directory that holds files +associated with renamed software in the SlackBuilds.org repository. The +default file that is installed with sbopkg is '50-default'. This file will be +overwritten each time sbopkg is upgraded, so do not make local edits to it. +Instead, create other files with a higher or lower number than 50-default and +list your renamed files in those local files. The files are loaded in +alphabetical order (like the files in /etc/fonts/conf.d) so 'priority' +is determined from low number to high and the first match wins, so: + +$ cat /etc/sbopkg/renames.d/10-local +foo=bar + +will override anything in a higher-numbered file, including anything in +50-default, such as: + +$ cat /etc/sbopkg/renames.d/50-default +foo=baz + +Renames are written in the following format: + +oldname=newname diff --git a/src/usr/sbin/sbopkg b/src/usr/sbin/sbopkg index 1df9137..24a8c74 100755 --- a/src/usr/sbin/sbopkg +++ b/src/usr/sbin/sbopkg @@ -79,8 +79,8 @@ config_check() { local MISSING VAR - if [[ ! -e $SBOPKG_RENAMES ]]; then - echo "$SCRIPT: No $SBOPKG_RENAMES was found." 1>&2 + if [[ ! -e $SBOPKG_RENAMES_D ]]; then + echo "$SCRIPT: No $SBOPKG_RENAMES_D was found." 1>&2 echo "Please correct this error and run $SCRIPT again." 1>&2 exit 1 fi @@ -437,7 +437,7 @@ get_new_name() { local NEW_NAME_VAR="$1" local OLD_NAME="$2" - local CANDIDATE=$(grep "^$OLD_NAME=" $SBOPKG_RENAMES) + local CANDIDATE=$(grep -hr "^$OLD_NAME=" $SBOPKG_RENAMES_D | head -n1) if [[ -z "$CANDIDATE" ]]; then # No rename occurred @@ -458,7 +458,7 @@ get_old_name() { local OLD_NAME_VAR="$1" local NEW_NAME="$2" local CANDIDATE INSTALLED - local SUBSTITUTIONS=$(grep "=$NEW_NAME\$" $SBOPKG_RENAMES | cut -d= -f1) + local SUBSTITUTIONS=$(grep -hr "=$NEW_NAME\$" $SBOPKG_RENAMES_D | cut -d= -f1) # By default, the old name is the new name eval $OLD_NAME_VAR=$NEW_NAME @@ -3311,7 +3311,7 @@ unset LAST_USER_QUEUE_ON_DISK # The name of the last loaded/saved user queue unset BUILDPKGS # TODO unset INSTALLPKGS # TODO unset BUILDOPTIONS # TODO -unset SBOPKG_RENAMES # File tracking package renames inside SBo +unset SBOPKG_RENAMES_D # Directory containing files tracking package renames # SBOPKG_CONF # Configuration file unset LOCALREPO # Directory containing all repository mirrors unset CWD # sbopkg starting directory @@ -3326,7 +3326,7 @@ unset RSYNC SEARCH UPDATE VERSION CUSTOMVER SCRIPT=${0##*/} SBOPKG_CONF=${SBOPKG_CONF:-/etc/sbopkg/sbopkg.conf} -SBOPKG_RENAMES=${SBOPKG_RENAMES:-/etc/sbopkg/sbopkg-renames} +SBOPKG_RENAMES_D=${SBOPKG_RENAMES_D:-/etc/sbopkg/renames.d} CWD=$(pwd) SBOVER=svn_r$(cut -d' ' -f2 <<< "\$Revision\$") DIAG=1