pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_alternatives Update to 1.1:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ec317225ed11
branches:  trunk
changeset: 488197:ec317225ed11
user:      jmmv <jmmv%pkgsrc.org@localhost>
date:      Tue Jan 25 16:27:37 2005 +0000

description:
Update to 1.1:

- Add the destroy action, used to remove the alternatives database as well
  as any known wrappers.

- Use the rebuild/destroy actions at install/deinstall time respectively
  so that this package can be installed at any time and pick up automatically
  available alternatives from PKG_DBDIR.

Per suggestion from reed@ in tech-pkg@.

diffstat:

 pkgtools/pkg_alternatives/DEINSTALL                 |   8 ++++
 pkgtools/pkg_alternatives/INSTALL                   |   8 ++++
 pkgtools/pkg_alternatives/Makefile                  |   8 +++-
 pkgtools/pkg_alternatives/files/pkg_alternatives.8  |  12 +++++-
 pkgtools/pkg_alternatives/files/pkg_alternatives.sh |  39 +++++++++++++++++++-
 5 files changed, 70 insertions(+), 5 deletions(-)

diffs (143 lines):

diff -r 1c4ac3c5789c -r ec317225ed11 pkgtools/pkg_alternatives/DEINSTALL
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/pkg_alternatives/DEINSTALL       Tue Jan 25 16:27:37 2005 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: DEINSTALL,v 1.1 2005/01/25 16:27:37 jmmv Exp $
+#
+
+case ${STAGE} in
+       DEINSTALL)
+               @PKG_ALTERNATIVES@ -s destroy
+               ;;
+esac
diff -r 1c4ac3c5789c -r ec317225ed11 pkgtools/pkg_alternatives/INSTALL
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/pkg_alternatives/INSTALL Tue Jan 25 16:27:37 2005 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: INSTALL,v 1.1 2005/01/25 16:27:37 jmmv Exp $
+#
+
+case ${STAGE} in
+       POST-INSTALL)
+               @PKG_ALTERNATIVES@ -s rebuild
+               ;;
+esac
diff -r 1c4ac3c5789c -r ec317225ed11 pkgtools/pkg_alternatives/Makefile
--- a/pkgtools/pkg_alternatives/Makefile        Tue Jan 25 16:20:56 2005 +0000
+++ b/pkgtools/pkg_alternatives/Makefile        Tue Jan 25 16:27:37 2005 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.1.1.1 2005/01/25 13:00:46 jmmv Exp $
+# $NetBSD: Makefile,v 1.2 2005/01/25 16:27:37 jmmv Exp $
 #
 
-DISTNAME=      pkg_alternatives-1.0
+DISTNAME=      pkg_alternatives-1.1
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
 DISTFILES=     # empty
@@ -21,6 +21,10 @@
 DATADIR=               ${PREFIX}/share/pkg_alternatives
 DBDIR=                 ${PREFIX}/libdata/pkg_alternatives
 
+DEINSTALL_EXTRA_TMPL+= ${.CURDIR}/DEINSTALL
+INSTALL_EXTRA_TMPL+=   ${.CURDIR}/INSTALL
+FILES_SUBST+=          PKG_ALTERNATIVES=${PREFIX}/sbin/pkg_alternatives
+
 MAKE_DIRS=             ${DBDIR}
 MAKE_DIRS+=            ${PKG_SYSCONFDIR}
 
diff -r 1c4ac3c5789c -r ec317225ed11 pkgtools/pkg_alternatives/files/pkg_alternatives.8
--- a/pkgtools/pkg_alternatives/files/pkg_alternatives.8        Tue Jan 25 16:20:56 2005 +0000
+++ b/pkgtools/pkg_alternatives/files/pkg_alternatives.8        Tue Jan 25 16:27:37 2005 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_alternatives.8,v 1.1.1.1 2005/01/25 13:00:46 jmmv Exp $
+.\" $NetBSD: pkg_alternatives.8,v 1.2 2005/01/25 16:27:37 jmmv Exp $
 .\"
 .\" pkg_alternatives - Generic wrappers for programs with similar interfaces
 .\" Copyright (c) 2005 Julio M. Merino Vidal <jmmv%NetBSD.org@localhost>
@@ -154,6 +154,13 @@
 package.
 This means that all the affected wrappers are then free to choose whichever
 alternative they prefer.
+.It destroy
+Removes the alternative database, found in
+.Pa @DBDIR@ ,
+and all its associated wrappers and manual pages.
+This action is intended to be used by the
+.Nm
+package.
 .It list
 Lists which of the installed packages provide alternatives.
 Any of the packages shown by this command can then be fed back to the
@@ -175,6 +182,9 @@
 file in them, and, for each of those, the
 .Sq register
 action is called with the appropriate file name.
+This action is intended to be used by the
+.Nm
+package or in case of database corruption.
 .It register Ar package wrapper alternative arguments
 Registers a new
 .Ar alternative
diff -r 1c4ac3c5789c -r ec317225ed11 pkgtools/pkg_alternatives/files/pkg_alternatives.sh
--- a/pkgtools/pkg_alternatives/files/pkg_alternatives.sh       Tue Jan 25 16:20:56 2005 +0000
+++ b/pkgtools/pkg_alternatives/files/pkg_alternatives.sh       Tue Jan 25 16:27:37 2005 +0000
@@ -1,6 +1,6 @@
 #!@SH@
 #
-# $NetBSD: pkg_alternatives.sh,v 1.1.1.1 2005/01/25 13:00:46 jmmv Exp $
+# $NetBSD: pkg_alternatives.sh,v 1.2 2005/01/25 16:27:37 jmmv Exp $
 #
 # pkg_alternatives - Generic wrappers for programs with similar interfaces
 # Copyright (c) 2005 Julio M. Merino Vidal <jmmv%NetBSD.org@localhost>
@@ -86,6 +86,41 @@
 
 # -------------------------------------------------------------------------
 
+# action_destroy_package
+#
+# Destroys the alternatives database and removes all installed wrappers.
+#
+action_destroy_package() {
+    validate_args list ${#} -eq 0
+
+    wrappers=$(cd ${Db_Dir} ; find . -type f)
+
+    for w in ${wrappers}; do
+        wrapper=$(echo ${w} | sed -e 's|^./||')
+        manpage=$(get_manpage ${wrapper})
+        info "removing wrapper \`${wrapper}'"
+       rm -f ${Prefix}/${wrapper}
+        info "removing manual page \`${manpage}'"
+        rm -f ${manpage}
+    done
+
+    info "removing contents of \`@DBDIR@'"
+    rm -rf @DBDIR@/* 2>/dev/null
+    rmdir_p @DBDIR@
+}
+
+# -------------------------------------------------------------------------
+
+# action_destroy_wrapper
+#
+# Unavailable action.
+#
+action_destroy_wrapper() {
+    err "the \`destroy' action cannot be used in wrapper mode"
+}
+
+# -------------------------------------------------------------------------
+
 # action_list_package
 #
 # Lists all available packages that provide alternatives.
@@ -598,7 +633,7 @@
 
     action=${1}; shift
     case ${action} in
-        auto|list|manual|rebuild|register|status|unregister)
+        auto|destroy|list|manual|rebuild|register|status|unregister)
             action_${action}_${what} "${@}"
             ;;
         *)



Home | Main Index | Thread Index | Old Index