mirror of
https://github.com/sbopkg/sbopkg
synced 2024-12-29 10:24:11 +01:00
Implement renames tracking using a configuration directory.
Modify the renames tracking so that, instead of a single file, all the files of a renames.d directory are used (just like udev and modprobe do). This has several advantages: - no more need to "mv sbopkg-renames.new sbopkg-renames" - it's now easier to add custom renames that automatically "survive" version upgrades and, last but not least, this is believed to be the correct way to handle these things. Many thanks are due to Robby Workman for proposing this change and to Chess Griffin for implementing it.
This commit is contained in:
parent
91db815094
commit
3078f984fa
5 changed files with 34 additions and 6 deletions
|
@ -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.
|
||||
+--------------------------+
|
||||
|
|
|
@ -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:
|
||||
|
|
23
src/usr/doc/README-renames.d
Normal file
23
src/usr/doc/README-renames.d
Normal file
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue