[hipl-commit] [trunk] Rev 4423: Eliminate gen-python-starter.sh indirection.

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: hipl-commit@xxxxxxxxxxxxx
  • Date: Wed, 28 Apr 2010 15:55:56 +0300

Committer: Diego Biurrun <diego@xxxxxxxxxx>
Date: 28/04/2010 at 15:55:56
Revision: 4423
Revision-id: diego@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Branch nick: trunk

Log:
  Eliminate gen-python-starter.sh indirection.
  
  Instead of using gen-python-starter.sh to generate shell scripts and adjust
  paths in those shell scripts according to command line parameters, configure
  now adjusts those paths. This avoids problems when configure is invoked
  again with a different prefix value.

Modified:
  D  tools/gen-python-starter.sh
  A  tools/hipdnskeyparse.in
  A  tools/hipdnsproxy.in
  M  Makefile.am
  M  configure.ac
  M  test/packaging/create-deb.sh

=== modified file 'Makefile.am'
--- Makefile.am 2010-04-26 18:48:41 +0000
+++ Makefile.am 2010-04-28 12:49:35 +0000
@@ -361,7 +361,6 @@
 #lib_ipsec_libhipsec_la_LIBADD  = $(LEXLIB)
 
 #DISTCLEANFILES = lib/ipsec/policy_parse.c lib/ipsec/policy_token.c
-DISTCLEANFILES = tools/hipdnsproxy tools/hipdnskeyparse
 
 ### library dependencies ###
 
@@ -437,8 +436,6 @@
 tools_hipdnsproxydir    = $(pyexecdir)/tools/hipdnsproxy
 endif # HAVE_PYTHON
 
-CLEANFILES = tools/hipdnsproxy tools/hipdnskeyparse
-
 
 ### misc stuff ###
 doxygen: doc/Doxyfile
@@ -454,7 +451,7 @@
 doc/HOWTO.txt: doc/HOWTO.xml
        xmlto -o $(@D) txt $<
 
-CLEANFILES += doc/HOWTO.html doc/HOWTO.txt
+CLEANFILES = doc/HOWTO.html doc/HOWTO.txt
 clean-local:
        rm -rf doc/doxy
 
@@ -462,11 +459,6 @@
 bin deb increl olddeb rpm syncrepo:
        env PYEXECDIR=$(pyexecdir) @srcdir@/test/packaging/create-package.sh $@
 
-tools/hipdnsproxy: tools/dnsproxy.py
-tools/hipdnskeyparse: tools/parse-key-3.py
-tools/hipdnsproxy tools/hipdnskeyparse:
-       @srcdir@/tools/gen-python-starter.sh $(pyexecdir)/$(@F) $^ $@
-
 autotools-clean: maintainer-clean
        rm -f aclocal.m4 compile config.* configure depcomp install-sh
        rm -f ltmain.sh m4/*.m4 Makefile.in missing py-compile

=== modified file 'configure.ac'
--- configure.ac        2010-04-26 18:48:41 +0000
+++ configure.ac        2010-04-28 12:49:35 +0000
@@ -325,6 +325,6 @@
 # Set the preprocessor flags for the entire project
 AC_SUBST(AM_CPPFLAGS, "-D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=500")
 
-AC_CONFIG_FILES([ Makefile doc/Doxyfile ])
+AC_CONFIG_FILES([ Makefile doc/Doxyfile tools/hipdnskeyparse tools/hipdnsproxy 
])
 
 AC_OUTPUT

=== modified file 'test/packaging/create-deb.sh'
--- test/packaging/create-deb.sh        2010-03-30 14:39:09 +0000
+++ test/packaging/create-deb.sh        2010-04-28 12:49:35 +0000
@@ -373,8 +373,8 @@
     inst tools/myasn.py* $PKGDIR/$PYEXECDIR/hipdnskeyparse
     inst tools/DNS/*py* $PKGDIR/$PYEXECDIR/DNS
 
-    $SUDO tools/gen-python-starter.sh $PYEXECDIR/hipdnsproxy dnsproxy.py 
$PKGDIR/usr/sbin/hipdnsproxy
-    $SUDO tools/gen-python-starter.sh $PYEXECDIR/hipdnskeyparse parse-key-3.py 
$PKGDIR/usr/sbin/hipdnskeyparse
+    inst tools/hipdnsproxy $PKGDIR/usr/sbin/hipdnsproxy
+    inst tools/hipdnskeyparse $PKGDIR/usr/sbin/hipdnskeyparse
 
     inst tools/nsupdate.pl $PKGDIR/usr/sbin
 

=== added file 'tools/hipdnskeyparse.in'
--- tools/hipdnskeyparse.in     1970-01-01 00:00:00 +0000
+++ tools/hipdnskeyparse.in     2010-04-28 12:49:35 +0000
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# This shell script invokes a python script from the right directory.
+# The reason for this indirection is that "make install" and
+# "dpkg -i dnsproxy.deb" (or rpm) store python scripts to different paths
+# (/usr/local vs. /usr). Thus, this script adjusts the paths of the generated
+# script according to configure.
+#
+# If you discover a better way to wrap python software with automake and
+# deb/rpm binary packages, please make sure that all the four invocation
+# methods to the python script still work:
+#
+# 1. tools/hipdnskeyparse
+# 2. cd tools && ./hipdnskeyparse
+# 3. make install && hipdnskeyparse
+# 4. make deb && dpkg -i hipl-dnskeyparse-version.deb && hipdnskeyparse
+# 5. all the previous use cases with command line arguments to
+#    hipdnskeyparse - required for deb/rpm packaging
+
+path=$(dirname $0)
+dev_script=tools/parse-key-3.py
+prefix=@prefix@
+
+if test ! -x $dev_script; then
+    dev_script=$(basename tools/parse-key-3.py)
+fi
+
+if echo $path | grep -q /usr; then
+    python @pythondir@/hipdnskeyparse/parse-key-3.py $@
+else
+    python $dev_script $@
+fi

=== added file 'tools/hipdnsproxy.in'
--- tools/hipdnsproxy.in        1970-01-01 00:00:00 +0000
+++ tools/hipdnsproxy.in        2010-04-28 12:49:35 +0000
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# This shell script invokes a python script from the right directory.
+# The reason for this indirection is that "make install" and
+# "dpkg -i dnsproxy.deb" (or rpm) store python scripts to different paths
+# (/usr/local vs. /usr). Thus, this script adjusts the paths of the generated
+# script according to configure.
+#
+# If you discover a better way to wrap python software with automake and
+# deb/rpm binary packages, please make sure that all the four invocation
+# methods to the python scripts still work:
+#
+# 1. tools/hipdnsproxy
+# 2. cd tools && ./hipdnsproxy
+# 3. make install && hipdnsproxy
+# 4. make deb && dpkg -i hipl-dnsproxy-version.deb && hipdnsproxy
+# 5. all the previous use cases with command line arguments to
+#    hipdnsproxy - required for deb/rpm packaging
+
+path=$(dirname $0)
+dev_script=tools/dnsproxy.py
+prefix=@prefix@
+
+if test ! -x $dev_script; then
+    dev_script=$(basename tools/dnsproxy.py)
+fi
+
+if echo $path | grep -q /usr; then
+    python @pythondir@/hipdnsproxy/dnsproxy.py $@
+else
+    python $dev_script $@
+fi

Other related posts:

  • » [hipl-commit] [trunk] Rev 4423: Eliminate gen-python-starter.sh indirection. - Diego Biurrun