A few more minor tweaks.
authorSteve Youngs <steve@sxemacs.org>
Wed, 12 Mar 2014 08:03:54 +0000 (18:03 +1000)
committerSteve Youngs <steve@sxemacs.org>
Wed, 12 Mar 2014 08:03:54 +0000 (18:03 +1000)
* etc/pkgusr/skel-package/build (update_commands): Just use
update-pkg-project.

* etc/pkgusr/handy_funcs (find_pkg_deps): Removed.  Wasn't all
that handy.

* etc/pkgusr/handy_funcs (build-update): Copy the new build script
into ${HOME}/build-YYYYmmdd if SXEmacs isn't installed to allow
for manual update.

* usr/bin/forall_direntries_from (IGNORE_READDIR_RACE): For use
primarily in the uninstall script.

* usr/lib/pkgusr/uninstall_package (run): The -ignore_readdir_race
option can't be used here directly.  It is now in
forall_direntries_from and activated via env varibable set in this
script.

Signed-off-by: Steve Youngs <steve@sxemacs.org>
etc/pkgusr/handy_funcs
etc/pkgusr/skel-package/build
lisp/pkgusr.el
usr/bin/forall_direntries_from
usr/lib/pkgusr/uninstall_package

index ea59623..7f90d79 100644 (file)
@@ -71,7 +71,7 @@ verrlog()
 instg()
 {
     local arg=$1
-    if [ -z "$arg"]; then
+    if [ -z "$arg" ]; then
        arg=err
     fi
     grep --color '^\*\*\*' ${HOME}/install.${arg}
@@ -171,22 +171,6 @@ vtar()
     tar ${opts} ${fname}|less
 }
 
-# Used primarily in the build script to update deps.
-find_pkg_deps()
-{
-    local arg=$1
-
-    [ -z "$arg" ] && arg=$(whoami)
-
-    for file in $(forall_direntries_from $arg -type f -executable -readable); do
-       (readelf -d $file ; ldd $file ) |
-           awk '/NEEDED/ { lib=substr($5,2,length($5)-2); LIBS[lib]=$5 } \
-                    /.*=>/ {if ( $1 in LIBS ) LIBS[$1]=$3 } END \
-                    { for (lib in LIBS) print LIBS[lib] }' |
-           xargs stat --printf "%U:%G\n"
-    done|sort -u|tr -s '\n' ' '
-}
-
 ## Check if there is a newer build script, maybe update.
 #  NOTE: Updating needs SXEmacs.  It'll work in XEmacs and Emacs too,
 #  but you'll need to change build-update() accordingly.
@@ -194,6 +178,11 @@ build-update()
 {
     if [ -x $(type -p sxemacs) ]; then
        sxemacs -l /etc/pkgusr/bld-update.el
+    else
+       echo *** Sorry, you do not have SXEmacs installed.
+       echo *** Copying the new build script to ~/build-$(date +%Y%m%d)
+       cp -v /etc/pkgusr/skel-package/build \
+           ${HOME}/build-$(date +%Y%m%d)
     fi
 }
 
index b42ffeb..5ed0488 100755 (executable)
@@ -35,7 +35,7 @@
 
 ## Version info.
 ourname=${0##*/}
-VERSION=1.4
+VERSION=1.5
 COPYRIGHT="Copyright (C) 2007 - 2014 Steve Youngs <steve@steveyoungs.com>"
 version_str="${ourname}: ${VERSION}\n${COPYRIGHT}"
 
@@ -114,12 +114,7 @@ test_pipe()
 
 update_commands()
 { :
-    sed -i s/"\(Last_Updated: \).*$"/"\1$(date +%c)"/g ${HOME}/.project
-    sed -i s/"\(Deps: \).*$"/"\1$(find_pkg_deps)"/ ${HOME}/.project
-    awk '/^CONTENTS:/ { print; exit; } {print}' ${HOME}/.project > ${HOME}/.projtmp
-    echo "--------" >> ${HOME}/.projtmp
-    list_package $(whoami) >> ${HOME}/.projtmp
-    mv ${HOME}/.projtmp ${HOME}/.project
+    update-pkg-project $(whoami)
 }
 
 run_configure()
index 01c3c4f..e975c86 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author:     Steve Youngs <steve@sxemacs.org>
 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
 ;; Created:    <2007-07-13>
-;; Time-stamp: <Sunday Feb  3, 2013 12:17:39 steve>
+;; Time-stamp: <Wednesday Mar 12, 2014 17:01:00 steve>
 ;; Homepage:   N/A
 ;; Keywords:   utils package-management
 
@@ -93,7 +93,7 @@
 
 (defconst pkgusr-url-regexp
   (concat
-   #r"\(\(https?\|ftp\|gopher\|telnet\|wais\)://\|file:/\|s?news:\|mailto:\)"
+   #r"\(\(https?\|ftp\|rsync\|s\(cp\|sh\)\|git\)://\|file:/\|s?news:\|mailto:\)"
    "[^]\t\n \"'()<>[^`{}]*[^]\t\n \"'()<>[^`{}.,;]+")
   "A regular expression matching URLs.")
 
index 2b336e7..7963334 100755 (executable)
@@ -124,6 +124,12 @@ do
 done
 y[${#y[@]}]=')'
 
+# The uninstall_package script sets this to `-ignore_readdir_race' so
+# that find doesn't print errors when things it is searching for
+# disappear.
+# IGNORE_READDIR_RACE='-ignore_readdir_race'
+IGNORE_READDIR_RACE=
+
 # In the following find command, the part
 # -not ( ( "${y[@]}" -prune ) -or "${y[@]}" )
 # is responsible for preventing the files that match prune_prefixes from
@@ -131,6 +137,6 @@ y[${#y[@]}]=')'
 # -prune has no effect and is always false when -depth is used.
 # The -true before "$@" ensures that -depth can be passed as only parameter.
 
-find "${fs_to_scan[@]}" -xdev $NOLEAF \
+find "${fs_to_scan[@]}" -xdev $NOLEAF $IGNORE_READDIR_RACE \
     -not \( \( "${y[@]}" -prune \) -or "${y[@]}" \) \
     -and \( "${ugmatcher[@]}" \) -and \( -true "$@" \)
index cfa852d..c674e39 100755 (executable)
@@ -57,10 +57,10 @@ dry_run()
 run()
 {
        # Delete anything that isn't a directory
-       forall_direntries_from ${pkg} -ignore_readdir_race \
+       forall_direntries_from ${pkg} \
                -not -type d -exec rm -vf {} 2>>/tmp/${pkg}.err \;
        # Remove any empty directories, but ONLY empty directories
-       forall_direntries_from ${pkg} -ignore_readdir_race \
+       forall_direntries_from ${pkg} \
                -type d -empty -exec rmdir -v {} 2>>/tmp/${pkg}.err \;
 
        leftovers=$(forall_direntries_from ${pkg})
@@ -81,7 +81,7 @@ run()
 }
 
 case $1 in
-        now) run ;;
+        now) IGNORE_READDIR_RACE='-ignore_readdir_race'; run ;;
        -h|--help|--usage|help|usage) usage ;;
         *) dry_run|less ;;
 esac