Are there any other features you still need?

See attached, against current cygport cvs.

cygport-cvs-topdir.patch:

    lib/cvs.cygclass (cvs_fetch): allow cygports to specify
    a "-d ${CVS_DIR}" argument by defining the CVS_DIR variable.
    Otherwise, the module directory name is used, as previously.
    This is useful if the desired source code is not a top-level
    module in the cvs repository (e.g. libgeotiff).

cygport-postinst-hook.patch:

    bin/cygport.in (__src_prep): (__src_postinst_hook_exec):
    call unstable function src_postinst_hook if it is defined.
    This can be useful if, for instance, the default docdir
    usr/share/doc/${PN}-${PV} is not appropriate, and should
    be "corrected" prior to packaging. See the rxvt-unicode-X
    cygport for an example.

    (main command parsing case statement) [postinst*]: call
    __src_postinst_hook_exec after __src_postinst.
    (main command parsing case statement) [inst*]: call
    __src_postinst_hook_exec after __src_postinst.
    (main command parsing case statement) [almostall, all]:
    ditto, as part of __stage Installing.

cygport-custom-cmds.patch:

  Adds new command line options:

  custom-show  display a list of all functions callable via customN-*
  customN-*    where * is the name of an function declared by cygport,
       and N is a digit, 0..9, that indicates the number
       of additional arguments to remove from the command line,
       and pass to the target function as its arguments.  That is,
         custom0-__show_help
       will call __show_help() with no arguments, while
         custom1-error "an error message"
       will call error() with "an error message" as its argument.
       Try experimenting with:
         customN-custom_dummy <arg1> <arg2> ... <argN>

  Used in conjunction with the (separable) testsuites in the cvs
  cygport.

    cygport.in (custom_dummy): public N-ary function that prints
    all N arguments to stdout. Used for demonstration purposes.
    (__custom_dummy_core): private support function for
    custom_dummy.  N-ary function that simply all N arguments
    to stdout.
    (__show_help): add documentation for custom-show and customN-*
    commands.
    (main command parsing case statement) [custom-show]: add new
    command. Shows all public functions available in the current
    cygport that can be called using the customN-* command.
    (main command parsing case statement) [customN-*]: add new
    command(s).

--
Chuck


Index: bin/cygport.in
===================================================================
RCS file: /cvsroot/cygwin-ports/cygport/bin/cygport.in,v
retrieving revision 1.106
diff -u -r1.106 cygport.in
--- bin/cygport.in      23 Apr 2008 14:43:48 -0000      1.106
+++ bin/cygport.in      27 Apr 2008 01:29:28 -0000
@@ -134,6 +134,17 @@
                  finish       delete the working directory
                  almostall    run all of the above, excluding finish
                  all          run all of the above, including finish
+                 custom-show  display a list of all functions callable via 
customN-*
+                 customN-*    where * is the name of an function declared by 
cygport,
+                              and N is a digit, 0..9, that indicates the number
+                              of additional arguments to remove from the 
command line,
+                              and pass to the target function as its 
arguments.  That is,
+                                custom0-__show_help
+                              will call __show_help() with no arguments, while
+                                custom1-error "an error message"
+                              will call error() with "an error message" as its 
argument.
+                              Try experimenting with:
+                                customN-custom_dummy <arg1> <arg2> ... <argN>
 
                See ${_privdocdir}/README for further instructions.
 
@@ -1573,10 +1584,14 @@
 #      DESCRIPTION
 #      HOMEPAGE
 #
+# public:
+#      custom_dummy
+#
 # private:
 #      __list_deps
 #      __list_files
 #      __show_info
+#      __custom_dummy_core
 #
 
################################################################################
 
@@ -1623,9 +1638,27 @@
        )
 }
 
+__custom_dummy_core() {
+       local -i my_c=0
+       local -i my_argc=$#
+
+       while (( my_c < my_argc ))
+       do
+               my_c+=1
+               echo "${my_c}: $1"
+               shift
+       done
+}
+
+custom_dummy() {
+       inform "custom_dummy called with $# args"
+       __custom_dummy_core "$@"
+}
+
 # protect functions
+export -f custom_dummy
 readonly -f __list_files __list_deps __show_info
-
+readonly -f custom_dummy __custom_dummy_core
 
 
################################################################################
 #
@@ -2173,6 +2206,7 @@
        error "When defining PKG_NAMES, the first package should be ${PN}.";
 fi
 
+
 
################################################################################
 #
 # End of functions
@@ -2180,6 +2214,10 @@
 
################################################################################
 
 declare -i arg_n=2
+declare -i custom_arg_n
+declare -i custom_argc
+declare -a custom_args
+declare -x custom_cmd
 
 while (( arg_n < argc ))
 do
@@ -2256,6 +2294,46 @@
                        __finish;
                        _status=$?;
                        ;;
+               custom-show)
+                       for fnc in $(set | sed -n '/()/s/()//p')
+                       do
+                               if test "$(type -t ${fnc})" == "function"
+                               then
+                                       echo " ${fnc}"
+                               fi
+                       done
+                       ;;
+               custom0-* | custom1-* | custom2-* | custom3-* | custom4-* | \
+               custom5-* | custom6-* | custom7-* | custom8-* | custom9-* )
+                       custom_argc=${argv[${arg_n}]:6:1}
+                       custom_cmd=${argv[${arg_n}]:8}
+                       if [ -z "${custom_cmd}" ]
+                       then
+                               error "${argv[${arg_n}]}* command has no target 
following the 'custom${custom_argc}-'"
+                       fi
+
+                       # consume arguments
+                       custom_arg_n=0
+                       while (( custom_arg_n < custom_argc )) && (( arg_n+1 < 
argc ))
+                       do
+                               arg_n+=1
+                               custom_args[${custom_arg_n}]="${argv[${arg_n}]}"
+                               custom_arg_n+=1
+                       done
+                       if (( custom_arg_n < custom_argc ))
+                       then
+                               error "custom${custom_argc} command 
${custom_cmd}: not enough arguments"
+                       fi
+                       
+                       if test "$(type -t ${custom_cmd})" == "function"
+                       then
+                               __stage ${custom_cmd} && eval "${custom_cmd} 
[EMAIL PROTECTED]"
+                               _status=$?;
+                       else
+                               error "${custom_cmd} is not a shell function"
+                       fi
+                       unset custom_args
+                       ;;
                help)
                        __show_help;
                        exit 0;
Index: lib/cvs.cygclass
===================================================================
RCS file: /cvsroot/cygwin-ports/cygport/lib/cvs.cygclass,v
retrieving revision 1.11
diff -u -r1.11 cvs.cygclass
--- lib/cvs.cygclass    11 Mar 2008 03:47:36 -0000      1.11
+++ lib/cvs.cygclass    27 Apr 2008 01:16:26 -0000
@@ -40,6 +40,7 @@
 cvs_fetch() {
        local cvs_branch
        local cvs_date
+       local cvs_topdir
 
        check_prog_req cvs
 
@@ -53,10 +54,17 @@
                cvs_date="-D ${CVS_DATE}"
        fi
 
+       cvs_topdir="${CVS_MODULE}"
+       if defined CVS_DIR
+       then
+               cvs_dir="-d ${CVS_DIR}"
+               cvs_topdir="${CVS_DIR}"
+       fi
+
        # T likely doesn't exist at this point, so create it first
        mkdir -p ${T}
        cd ${T}
-       verbose cvs -d ${CVS_URI} checkout ${cvs_branch} ${cvs_date} 
${CVS_MODULE}
+       verbose cvs -d ${CVS_URI} checkout ${cvs_branch} ${cvs_date} ${cvs_dir} 
${CVS_MODULE}
 
-       tar jcf ${top}/${cvs_tarball} --exclude=CVS --exclude=.cvsignore 
${CVS_MODULE}
+       tar jcf ${top}/${cvs_tarball} --exclude=CVS --exclude=.cvsignore 
${cvs_topdir}
 }
Index: bin/cygport.in
===================================================================
RCS file: /cvsroot/cygwin-ports/cygport/bin/cygport.in,v
retrieving revision 1.106
diff -u -r1.106 cygport.in
--- bin/cygport.in      23 Apr 2008 14:43:48 -0000      1.106
+++ bin/cygport.in      27 Apr 2008 01:22:43 -0000
@@ -1179,6 +1179,7 @@
 # mutable:
 #      USE_DESTDIR
 #      src_install
+#      src_postinst_hook
 #
 # public:
 #      cyginstall
@@ -1193,6 +1194,7 @@
 #      _exeinto_dir
 #      _insinto_dir
 #      __prepinstalldirs
+#      __src_postinst_hook_exec
 #
 
################################################################################
 
@@ -1296,6 +1298,20 @@
        esac
 }
 
+# src_postinst_hook is an optional function that may be
+# defined to modify the cygport 'install' sequence. If defined,
+# it is called after the automatic "postinst" function. This 
+# can be useful if, for instance, the default docdir:
+#    usr/share/doc/${PN}-${PV}
+# is not appropriate, and should be "corrected" prior to 
+# packaging. See the rxvt-unicode-X cygport for an example.
+__src_postinst_hook_exec() {
+       if __check_function src_postinst_hook
+       then
+               __check_unstable src_postinst_hook
+       fi
+}
+
 # provides a default src_install
 # will be overridden by cygclasses or cygports as necessary
 src_install() {
@@ -2209,11 +2225,11 @@
                        ;;
                inst*)
                        __stage Installing;
-                       (__prepinstalldirs && src_install && __src_postinst) 
2>&1 | tee ${installlog};
+                       (__prepinstalldirs && src_install && __src_postinst && 
__src_postinst_hook_exec) 2>&1 | tee ${installlog};
                        _status=$?;
                        ;;
                postinst*)
-                       __src_postinst;
+                       __src_postinst && __src_postinst_hook_exec;
                        _status=$?;
                        ;;
                list)
@@ -2244,14 +2260,14 @@
                almostall)
                        __stage Preparing && __src_prep && \
                        __stage Compiling && src_compile 2>&1 | tee 
${compilelog} && \
-                       __stage Installing && (__prepinstalldirs && src_install 
&& __src_postinst) 2>&1 | tee ${installlog} && \
+                       __stage Installing && (__prepinstalldirs && src_install 
&& __src_postinst && __src_postinst_hook_exec) 2>&1 | tee ${installlog} && \
                        __stage Packaging && (__pkg_binpkg && __pkg_pkgcheck && 
__pkg_srcpkg && __pkg_dist) 2>&1 | tee ${pkglog}
                        _status=$?;
                        ;;
                all)
                        __stage Preparing && __src_prep && \
                        __stage Compiling && src_compile 2>&1 | tee 
${compilelog} && \
-                       __stage Installing && (__prepinstalldirs && src_install 
&& __src_postinst) 2>&1 | tee ${installlog} && \
+                       __stage Installing && (__prepinstalldirs && src_install 
&& __src_postinst && __src_postinst_hook_exec) 2>&1 | tee ${installlog} && \
                        __stage Packaging && (__pkg_binpkg && __pkg_pkgcheck && 
__pkg_srcpkg && __pkg_dist) 2>&1 | tee ${pkglog} && \
                        __finish;
                        _status=$?;

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to