[Lunar-commits] r14745 - lunar/trunk/var/lib/lunar/plugins

Auke Kok sofar at lunar-linux.org
Mon May 16 10:40:03 UTC 2005


Author: sofar
Date: 2005-05-16 10:40:02 +0000 (Mon, 16 May 2005)
New Revision: 14745

Modified:
   lunar/trunk/var/lib/lunar/plugins/postbuild-generic.plugin
Log:
Bugfix: split up gather_docs from the plugin, as return values make this pretty impossible. Also the API call to gather_docs changed for plugins, so it was bound to break anyway.


Modified: lunar/trunk/var/lib/lunar/plugins/postbuild-generic.plugin
===================================================================
--- lunar/trunk/var/lib/lunar/plugins/postbuild-generic.plugin	2005-05-16 07:59:35 UTC (rev 14744)
+++ lunar/trunk/var/lib/lunar/plugins/postbuild-generic.plugin	2005-05-16 10:40:02 UTC (rev 14745)
@@ -28,30 +28,42 @@
 gather_docs()
 {
   # function : gather_docs
-  # usage 1  : gather_docs
-  # usage 2  : gather_docs LIST OF FILES
+  # usage    : gather_docs LIST OF FILES
   # purpose  : Installs extra documentation that came with the
   #            module's source package into the module's
   #            document directory (defined as Lunar's base
-  #            document directory plus the module name).  This
-  #            function is called from default_post_install as
-  #            usage 1, which installs a default (read: common)
-  #            set of docs.  If the developer is not happy with
-  #            just those doc s/he can call this function from
-  #            a module script (like BUILD) with a list of
-  #            additional files (usage 2) to install into the
-  #            module's document directory.
-  # pre-conditions : user must have $GARBAGE="on" to have any
-  #                  of this actually happen.
+  #            document directory plus the module name).
   debug_msg "gather_docs ($@)"
 
-  # Bail if the user doesn't want to install any extra documentation
-  if [ "$GARBAGE" != "on" ] ; then
-    return 2
+  DOC_DIR=${DOCUMENT_DIRECTORY}/${MODULE}
+  if [ -d "$SOURCE_DIRECTORY" ] ; then
+    cd $SOURCE_DIRECTORY
+    invoke_installwatch
+    mkdir -p $DOC_DIR
+    # For each parameter that is an existing file
+    for FILE in ${@}; do
+      if [ -e ${FILE} -a -f ${FILE} ] ; then
+        # copy it over to the doc directory creating directories as needed
+        verbose_msg "Installing extra documentation to: ${DOC_DIR}/${FILE}"
+        install -D -m 644 ${FILE} ${DOC_DIR}/${FILE}
+      fi
+    done
+    devoke_installwatch
+	# do not return 2 here: this function is called directly and
+	# must return true (0) here
+	return 0
   fi
+  return 2
+}
 
+
+plugin_postbuild_gather_docs()
+{
+  # pre-conditions : user must have $GARBAGE="on" to have any
+  #                  of this actually happen.
+  debug_msg "plugin_postbuild_gather_docs ($@)"
+
   DOC_DIR=${DOCUMENT_DIRECTORY}/${MODULE}
-  mkdir -p $DOC_DIR
 
   # This is the list of default extra documentation that is to be 
   # installed automatically if the user has $GARBAGE=on.  Any other
@@ -60,32 +72,23 @@
                 *sample* conf SETUP NEWS Change* manual* Manual*"
 
   if [ -d "$SOURCE_DIRECTORY" ] ; then
-  (
-    invoke_installwatch
     cd $SOURCE_DIRECTORY
 
-    # Check if we are being called with parameters or not
-    if [ ${#} -gt 0 ] ; then
-      # For each parameter that is an existing file
-      for FILE in ${@}; do
-        if [ -e ${FILE} -a -f ${FILE} ] ; then
-          # copy it over to the doc directory creating directories as needed
-          verbose_msg "Installing extra documentation to: ${DOC_DIR}/${FILE}"
-          install -D -m 644 ${FILE} ${DOC_DIR}/${FILE}
-        fi
-      done
-    else
-      # No parameters were passed in, install the default docs
-      for FILE in ${DEFAULT_DOCS}; do
-        # copy all of the default docs (prune Makefiles)
-        if [ -e $FILE -a ! -f ${FILE}/Makefile ] ; then
-          verbose_msg "Installing default documentation to: ${DOC_DIR}/${FILE}"
-          cp -a $FILE $DOC_DIR 2> /dev/null
-	fi
-      done
+    # Bail if the user doesn't want to install any extra documentation
+    if [ "$GARBAGE" != "on" ] ; then
+      return 2
     fi
+    invoke_installwatch
+    mkdir -p $DOC_DIR
+    # No parameters were passed in, install the default docs
+    for FILE in ${DEFAULT_DOCS}; do
+      # copy all of the default docs (prune Makefiles)
+      if [ -e $FILE -a ! -f ${FILE}/Makefile ] ; then
+        verbose_msg "Installing default documentation to: ${DOC_DIR}/${FILE}"
+        cp -a $FILE $DOC_DIR 2> /dev/null
+      fi
+    done
     devoke_installwatch
-  )
   fi
   return 2
 }
@@ -104,5 +107,5 @@
 
 
 plugin_register BUILD_POST_BUILD plugin_services_post_build
-plugin_register BUILD_POST_BUILD gather_docs
+plugin_register BUILD_POST_BUILD plugin_postbuild_gather_docs
 plugin_register BUILD_POST_BUILD plugin_archive_module



More information about the Lunar-commits mailing list