bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Relocatable Perl scripts


From: Ben Pfaff
Subject: Re: Relocatable Perl scripts
Date: Wed, 8 Jan 2014 22:16:39 -0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Jan 08, 2014 at 09:44:35AM +0000, Reuben Thomas wrote:
> On 8 January 2014 05:59, Ben Pfaff <address@hidden> wrote:
> 
> > I think that the following change to Gnulib would clarify.  I
> > have not actually tested the shell code it suggests, although I
> > probably should.  Will you take a look at it?
> >
> > diff --git a/doc/relocatable-maint.texi b/doc/relocatable-maint.texi
> > index 58160cf..86d1438 100644
> > --- a/doc/relocatable-maint.texi
> > +++ b/doc/relocatable-maint.texi
> > @@ -122,12 +122,20 @@ if test "@@RELOCATABLE@@" = yes; then
> >    orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables
> >    func_find_curr_installdir # determine curr_installdir
> >    func_find_prefixes
> > -  # Relocate the directory variables that we use.
> > -  gettext_dir=`
> > -    echo "$gettext_dir/" \
> > +  relocate () {
> > +    echo "$1/" \
> >      | sed -e "address@hidden@}/address@hidden@}/%" \
> > -    | sed -e 's,/$,,'`
> > +    | sed -e 's,/$,,'
> > +  }
> > +else
> > +  relocate () {
> > +    echo "$1"
> > +  }
> >  fi
> > +
> > +# Get some relocated directory names.
> > +sysconfdir=`relocate "@@sysconfdir@@"`
> > +some_datadir=`relocate "@@datadir@@/something"`
> >  @end example
> >
> >  You must adapt the definition of @code{orig_installdir}, depending on
> >
> 
> This looks good to me. I don't currently have a shell use via which to test
> it, but I will implement the same idea in my Perl version.

Thanks for the review.  I applied this to master, as follows.

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <address@hidden>
Date: Wed, 8 Jan 2014 22:15:21 -0800
Subject: [PATCH] relocatable-shell: Update suggested usage in maintainer
 documentation.

Instead of suggesting an inline usage of "sed", that would have to be
cut-and-pasted for every directory to be relocated, suggest a shell
function.

Make the example obviously an example, whereas previously it looked like
it might be literal text.

Thanks to Reuben Thomas <address@hidden> for pointing out these issues.  See
http://lists.gnu.org/archive/html/bug-gnulib/2014-01/msg00039.html for
further context.
---
 doc/relocatable-maint.texi |   19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/doc/relocatable-maint.texi b/doc/relocatable-maint.texi
index 8780b84..f972b2f 100644
--- a/doc/relocatable-maint.texi
+++ b/doc/relocatable-maint.texi
@@ -122,17 +122,26 @@ if test "@@RELOCATABLE@@" = yes; then
   orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables
   func_find_curr_installdir # determine curr_installdir
   func_find_prefixes
-  # Relocate the directory variables that we use.
-  gettext_dir=`
-    echo "$gettext_dir/" \
+  relocate () @{
+    echo "$1/" \
     | sed -e "address@hidden@}/address@hidden@}/%" \
-    | sed -e 's,/$,,'`
+    | sed -e 's,/$,,'
+  @}
+else
+  relocate () @{
+    echo "$1"
+  @}
 fi
+
+# Get some relocated directory names.
+sysconfdir=`relocate "@@sysconfdir@@"`
+some_datadir=`relocate "@@datadir@@/something"`
 @end example
 
 You must adapt the definition of @code{orig_installdir}, depending on
 where the script gets installed.  Also, at the end, instead of
address@hidden, transform those variables that you need.
address@hidden and @code{some_datadir}, transform those variables
+that you need.
 
 @item
 In your @file{Makefile.am}, for every program @command{foo} that gets
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]