From 76e6c5ddb17a06253bc05976bd015bdb3ed5cecd Mon Sep 17 00:00:00 2001 From: slakmagik Date: Thu, 10 Mar 2011 04:17:52 +0000 Subject: [PATCH] make README symlinks; modify build-related files A cluster of changes related to creating symlinks in the /etc/{renames,repos}.d directories that point to the corresponding README in sbopkg's docdir and then generally updating most build-related files and getting it all documented. * 50-default: renamed to 50-default.renames * NEWS: note symlink docs and rename issues * README-renames: update to reflect new default filename and the fact that the files must end in '.renames'. * sbopkg.conf.5, sbopkg.8: update to reflect the new renames stuff (and the earlier repo file/dir-related changes I forgot to document there). * sbopkg: get_new_name(), get_old_name(): have grep only look through *.renames files and not, say, symlinks to READMEs. * doinst.sh: bring into alignment with the current SBo template. * tools/sbopkg.SlackBuild: make links from README-repos and README-renames to READMEs in the corresponding /etc/sbopkg/*.d directories. * tools/slack-desc: bring into alignment with the current SBo template. * tools/sspm: update address, add printe() and use it. --- .../{50-default => 50-default.renames} | 0 src/usr/doc/NEWS | 6 ++++ src/usr/doc/README-renames | 18 +++++----- src/usr/man/man5/sbopkg.conf.5 | 15 ++++----- src/usr/man/man8/sbopkg.8 | 13 ++++---- src/usr/sbin/sbopkg | 6 ++-- tools/doinst.sh | 11 ++----- tools/sbopkg.SlackBuild | 3 ++ tools/slack-desc | 16 ++++----- tools/sspm | 33 +++++++++---------- 10 files changed, 61 insertions(+), 60 deletions(-) rename src/etc/sbopkg/renames.d/{50-default => 50-default.renames} (100%) diff --git a/src/etc/sbopkg/renames.d/50-default b/src/etc/sbopkg/renames.d/50-default.renames similarity index 100% rename from src/etc/sbopkg/renames.d/50-default rename to src/etc/sbopkg/renames.d/50-default.renames diff --git a/src/usr/doc/NEWS b/src/usr/doc/NEWS index 77815d1..ce8a077 100644 --- a/src/usr/doc/NEWS +++ b/src/usr/doc/NEWS @@ -34,6 +34,12 @@ sbopkg xxxVERSIONxxx (xxxDATExxx) block in README describing all the plain text documents, added a note about making corrections to THANKS, etc. + * Note also that symlinks are now made from README-repos and + README-renames to READMEs in the corresponding /etc/sbopkg/*.d + directories. NOTE that renames files must now end in .rename + so, if you have custom files in renames.d, you'll need to + rename them. + * The 'Choose a repository' dialog widget is now titled 'Repository Selection' and the widget text was revised. Also, the menu itself used to say 'BRANCH (REPO) DESCRIPTION' and diff --git a/src/usr/doc/README-renames b/src/usr/doc/README-renames index fad5d22..cd6db1c 100644 --- a/src/usr/doc/README-renames +++ b/src/usr/doc/README-renames @@ -1,28 +1,28 @@ README-renames Packages which are renamed in a repository are handled by adding them to -a rename file and placing that file in the /etc/sbopkg/renames.d -directory. +a file whose name ends in '.renames' which is stored in the +/etc/sbopkg/renames.d directory. Renames are written, one per line, in the following format: oldname=newname -The default file that is installed with sbopkg is '50-default'. This -file is kept in sync with the SBo repository and 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 default file that is installed with sbopkg is '50-default.renames'. +This file is kept in sync with the SBo repository and 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 +and list your renamed files in those local files. The files are loaded in alphanumeric order (like the files in, e.g., /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 +$ cat /etc/sbopkg/renames.d/10-local.renames foo=bar will override anything in a higher-numbered file, including anything in -50-default, such as: +50-default.renames, such as: $ cat /etc/sbopkg/renames.d/50-default foo=baz diff --git a/src/usr/man/man5/sbopkg.conf.5 b/src/usr/man/man5/sbopkg.conf.5 index da62ce8..6830c1d 100644 --- a/src/usr/man/man5/sbopkg.conf.5 +++ b/src/usr/man/man5/sbopkg.conf.5 @@ -281,7 +281,7 @@ Note: all of the variables are affected by the repository files maintained in .I /etc/sbopkg/repos.d. Please see the -.I README-repos.d +.I README-repos document in the .B sbopkg documentation directory. @@ -550,21 +550,20 @@ File to specify configuration options. .I ~/.sbopkg.conf File to override system configuration options. .TP -.I /etc/sbopkg/renames.d/50-default -Default file that lists software in the SBo repository that has been -renamed. +.I /etc/sbopkg/renames.d/*.renames +Files that list software in the SBo repository that has been renamed. See the -.I README-renames.d +.I README-renames document in the .B sbopkg documentation directory for more information. .TP -.I /etc/sbopkg/repos.d/{40-sbo.repo,50-sb64.repo,60-local.repo} -Three default files for various types of +.I /etc/sbopkg/repos.d/*.repo +Files for various types of .B sbopkg repositories. See the -.I README-repos.d +.I README-repos document in the .B sbopkg documentation directory for more information. diff --git a/src/usr/man/man8/sbopkg.8 b/src/usr/man/man8/sbopkg.8 index 2f0c5f9..1b76e55 100644 --- a/src/usr/man/man8/sbopkg.8 +++ b/src/usr/man/man8/sbopkg.8 @@ -473,21 +473,20 @@ Default system-wide file to specify configuration options. .I ~/.sbopkg.conf File to override system configuration options. .TP -.I /etc/sbopkg/renames.d/50-default -Default file that lists software in the SBo repositories that has been -renamed. +.I /etc/sbopkg/renames.d/*.renames +Files that list software in the SBo repositories that has been renamed. See the -.I README-renames.d +.I README-renames document in the .B sbopkg documentation directory for more information. .TP -.I /etc/sbopkg/repos.d/{40-sbo.repo,50-sb64.repo,60-local.repo} -Three default files for various types of +.I /etc/sbopkg/repos.d/*.repo +Files for various types of .B sbopkg repositories. See the -.I README-repos.d +.I README-repos document in the .B sbopkg documentation directory for more information. diff --git a/src/usr/sbin/sbopkg b/src/usr/sbin/sbopkg index 51cdbdb..0a7e857 100755 --- a/src/usr/sbin/sbopkg +++ b/src/usr/sbin/sbopkg @@ -644,7 +644,9 @@ get_new_name() { local NEW_NAME_VAR="$1" local OLD_NAME="$2" - local CANDIDATE=$(grep -hr "^$OLD_NAME=" $SBOPKG_RENAMES_D | head -n1) + local CANDIDATE=$( + grep -h "^$OLD_NAME=" $SBOPKG_RENAMES_D/*.renames | head -n1 + ) if [[ -z "$CANDIDATE" ]]; then # No rename occurred @@ -666,7 +668,7 @@ get_old_name() { local NEW_NAME="$2" local CANDIDATE INSTALLED local SUBSTITUTIONS=$( - grep -hr "=$NEW_NAME\$" $SBOPKG_RENAMES_D | cut -d= -f1 + grep -h "=$NEW_NAME\$" $SBOPKG_RENAMES_D/*.renames | cut -d= -f1 ) # By default, the old name is the new name diff --git a/tools/doinst.sh b/tools/doinst.sh index fc80019..bf503ad 100644 --- a/tools/doinst.sh +++ b/tools/doinst.sh @@ -1,16 +1,11 @@ -#!/bin/sh -# -# $Id$ -# -# Sbopkg doinst.sh - config() { NEW="$1" - OLD="`dirname $NEW`/`basename $NEW .new`" + OLD="$(dirname $NEW)/$(basename $NEW .new)" # If there's no config file by that name, mv it over: if [ ! -r $OLD ]; then mv $NEW $OLD - elif [ "`cat $OLD | md5sum`" = "`cat $NEW | md5sum`" ]; then # toss the redundant copy + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + # toss the redundant copy rm $NEW fi # Otherwise, we leave the .new copy for the admin to consider... diff --git a/tools/sbopkg.SlackBuild b/tools/sbopkg.SlackBuild index 8b42d54..c0fa9a2 100644 --- a/tools/sbopkg.SlackBuild +++ b/tools/sbopkg.SlackBuild @@ -47,6 +47,9 @@ find $PKG/usr/man -type f -exec gzip -9 {} \; mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a usr/doc/* $PKG/usr/doc/$PRGNAM-$VERSION +ln -s /usr/doc/$PRGNAM-$VERSION/README-repos $PKG/etc/$PRGNAM/repos.d/README +ln -s /usr/doc/$PRGNAM-$VERSION/README-renames \ + $PKG/etc/$PRGNAM/renames.d/README cp -a $CWD/sbopkg.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION chown root:root $PKG/usr/doc/$PRGNAM-$VERSION/sbopkg.SlackBuild diff --git a/tools/slack-desc b/tools/slack-desc index 47dd617..2d074dc 100644 --- a/tools/slack-desc +++ b/tools/slack-desc @@ -1,19 +1,19 @@ -# $Id: slack-desc 110 2008-03-23 03:50:27Z chess $ -# -## HOW TO EDIT THIS FILE: +# HOW TO EDIT THIS FILE: # The "handy ruler" below makes it easier to edit a package description. Line # up the first '|' above the ':' following the base package name, and the '|' # on the right side marks the last column you can put a character in. You must # make exactly 11 lines for the formatting to be correct. It's also -# customary to leave one space after the ':'. +# customary to leave one space after the ':' except on otherwise blank lines. |-----handy-ruler------------------------------------------------------| sbopkg: sbopkg (SlackBuilds.org Package Browser) sbopkg: -sbopkg: Sbopkg is a command-line and dialog-based tool to -sbopkg: interact with the SlackBuilds.org repository, a -sbopkg: collection of third-party SlackBuild scripts to -sbopkg: build Slackware packages. +sbopkg: Sbopkg is a command-line and dialog-based tool to interact with the +sbopkg: SlackBuilds.org repository, a collection of third-party SlackBuild +sbopkg: scripts to build Slackware packages. sbopkg: sbopkg: Homepage: http://www.sbopkg.org sbopkg: +sbopkg: +sbopkg: +sbopkg: diff --git a/tools/sspm b/tools/sspm index 5ba1e62..430c880 100644 --- a/tools/sspm +++ b/tools/sspm @@ -1,6 +1,6 @@ #!/bin/bash # $Id$ -# Written by slakmagik (usual symbols in spaces) +# Written by slakmagik # Released under the WTFPL script=${0##*/} @@ -25,6 +25,11 @@ EOF exit } +printe() { + printf "$script: $@" | tr -s ' ' | fmt -sw78 >&2 + exit 1 +} + if (( $# == 0 )); then build="yes" inst="yes" @@ -46,19 +51,15 @@ done # Make sure we are root. if (( $(id -u) != 0 )); then - echo "$script: $script must be run by the root user." 1>&2 - exit 1 + printe "$script must be run by the root user." fi if [[ $sync == yes ]]; then if [[ -w $repo ]] || [[ ! -e $repo && -w ${repo%/*} ]]; then - svn checkout $remote_repo $repo || - { echo "$script: checkout failed" 1>&2; exit 1; } + svn checkout $remote_repo $repo || printe "checkout failed" else - printf "$script: $repo is not writable.\n" 1>&2 - printf "Change your privileges or the value of the \"repo\" " 1>&2 - printf "variable.\n" 1>&2 - exit 1 + printe "$repo is not writable.\nChange your privileges or the \ + value of the \"repo\" variable.\n" fi fi @@ -71,23 +72,19 @@ if [[ $build == yes || $inst == yes ]]; then if [ -r $svn_script ]; then export VERSION=svn$(svnversion $repo) else - echo "$script: unable to find $svn_script." 1>&2 - echo "Please check your repository." 1>&2 - exit 1 + printe "unable to find $svn_script.\nPlease check your repository." fi if [[ $OUTPUT =~ "$repo/(sbopkg-$VERSION|root-tools)" ]]; then - printf "$script: the OUTPUT variable is set to a path that will " 1>&2 - printf "be removed.\n" 1>&2 - printf "Please alter the value of the variable.\n" 1>&2 - exit 1 + printe "the OUTPUT variable is set to a path that will be \ + removed.\nPlease alter the value of the variable.\n" fi output_pkg=$OUTPUT/sbopkg-$VERSION-noarch-1_cng.tgz if [[ $build == yes ]]; then cd $repo if [ -d sbopkg-$VERSION ] || [ -d root-tools ]; then - echo "$script: director(y|ies) exist" 1>&2; exit 1 + printe "director(y|ies) exist(s)" fi cp -r src sbopkg-$VERSION cp -r tools root-tools @@ -104,7 +101,7 @@ if [[ $build == yes || $inst == yes ]]; then if [ -r $output_pkg ]; then upgradepkg --install-new --reinstall $output_pkg else - echo "$script: $output_pkg not found." 1>&2; exit 1 + printe "$output_pkg not found." fi fi fi