[csw-devel] SF.net SVN: opencsw:[512] gar-wrapper

skayser at users.sourceforge.net skayser at users.sourceforge.net
Fri Aug 19 00:29:22 CEST 2011


Revision: 512
          http://opencsw.svn.sourceforge.net/opencsw/?rev=512&view=rev
Author:   skayser
Date:     2011-08-18 22:29:22 +0000 (Thu, 18 Aug 2011)

Log Message:
-----------
mgar: added show-var command

Modified Paths:
--------------
    gar-wrapper/CHANGES
    gar-wrapper/mgar

Modified: gar-wrapper/CHANGES
===================================================================
--- gar-wrapper/CHANGES	2011-08-14 18:12:33 UTC (rev 511)
+++ gar-wrapper/CHANGES	2011-08-18 22:29:22 UTC (rev 512)
@@ -1,9 +1,11 @@
 Changes since 0.92 (r380):
+* Added package version to "version" command output
+* Added new command "show-var" to display the runtime value of build
+  recipe variables (Maciej Blizinski)
 * Changed "newpkg" command to run relative to the build tree (not $PWD)
   so that it can be run from anywhere
 * Improved error message when running a package specific command in
   a non-package directory
-* Added package version to "version" command
 
 Changes since 0.91 (r360):
 * mgar will now warn and exit on legacy gar/ directories or symlinks

Modified: gar-wrapper/mgar
===================================================================
--- gar-wrapper/mgar	2011-08-14 18:12:33 UTC (rev 511)
+++ gar-wrapper/mgar	2011-08-18 22:29:22 UTC (rev 512)
@@ -33,7 +33,6 @@
 #
 # Todos:
 # * Improve error messages when buildsys can't be found
-# * Enable mgar newpkg from anywhere (relative path to $BUILDTREE)
 # * Enable checkout of a specific revision for build recipe + GAR
 #   (~/opencsw/.buildsys/vX at YYYY, ~/opencsw/foo/trunk at YYYY)
 # * Add template for ~/.garrc (think new users)
@@ -461,6 +460,31 @@
   echo ""
 }
 
+function show_makefile_var() {
+  local __varname=${1:-}
+
+  if [ -z "${__varname}" ]; then
+    echo "ERROR: You need to provide a build recipe variable name" >&2
+    exit 1
+  fi
+
+  local __acked=`read_config_value ACK_SHOWVAR`
+  echo -n "${__varname}: "
+  gmake -I "$BUILDSYS" \
+    -f <( cat Makefile; echo -e "\nshow-var:\n\t at echo \$(${1:-})" ) \
+    show-var
+
+  if [ -z "${__acked}" ]; then
+    echo
+    echo "Beware: show-var doesn't evaluate modulations. So if you make use of"
+    echo "complex recipes, the displayed value might not be the actual value"
+    echo "that will be used during the build. To suppress this warning:"
+    echo
+    echo "  echo ACK_SHOWVAR=1 >> ~/.garrc"
+    echo
+  fi
+}
+
 function usage() {
   cat <<EOM
 Wrapper around the GAR build system. Usage: mgar <action> [options]
@@ -486,6 +510,7 @@
   commit -m <msg>     Commit build recipe (prefixes msg with package path)
   show-srcdir         Show the location of the extracted package source
   show-stagedir       Show the location of the package staging directory
+  show-var <varname>  Show the runtime value of a build recipe variable
   find-file <name>    Find a file within the extracted package source
   edit-file <name>    Edit a file within the extracted package source
 
@@ -571,6 +596,7 @@
                    ;;
       show-srcdir) echo `get_srcdir`;;
     show-stagedir) echo `get_stagedir`;;
+         show-var) shift; show_makefile_var ${1:-};;
            up-pkg) echo "Updating current package directory + build system"
                    svn up --ignore-externals; svn up $BUILDSYS;;
                 *) gmake -I "$BUILDSYS" "$@"


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list