bug-gnulib
[Top][All Lists]
Advanced

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

Re: strfile: new module


From: Simon Josefsson
Subject: Re: strfile: new module
Date: Wed, 31 May 2006 15:28:43 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Simon Josefsson <address@hidden> writes:

> Hmmm.  I've made the same mistake before.  I'll see how hard it would
> be to write a tool that will "prepare" additions of a gnulib module,
> for one it should run indent on the files, and then run 'cvs
> --new-file diff' on the modules file, and the files mentioned in the
> modules file.  Eventually, it could apply the tests from the
> maintainer-makefile module.

The following script is a start on this...  Right now it only prints
out some commands that you may want to run:

address@hidden:~/src/gnulib$ ./diff-module read-file Modules:
read-file

Files:
lib/read-file.c
lib/read-file.h
m4/read-file.m4
modules/read-file

indent lib/read-file.c lib/read-file.h

cvs add lib/read-file.c lib/read-file.h m4/read-file.m4 modules/read-file

cvs diff lib/read-file.c lib/read-file.h m4/read-file.m4 modules/read-file
cvs diff --new-file lib/read-file.c lib/read-file.h m4/read-file.m4 
modules/read-file
address@hidden:~/src/gnulib$

The source:

#!/bin/sh
#
# Copyright (C) 2006 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

case "$0" in
  /*) self_abspathname="$0" ;;
  */*) self_abspathname=`pwd`/"$0" ;;
  *) for d in `echo ":$PATH:" | sed -e 's/:::*/:.:/g' | sed -e 's/:/ /g'`; do
       if test -x "$d/$0" && test ! -d "$d/$0"; then
         self_abspathname="$d/$0"
         break
       fi
     done
     if test -z "$self_abspathname"; then
       func_fatal_error "could not locate the gnulib-tool program - how did you 
invoke it?"
     fi
     ;;
esac
while test -h "$self_abspathname"; do
  # Resolve symbolic link.
  linkval=`func_readlink "$self_abspathname"`
  test -n "$linkval" || break
  case "$linkval" in
    /* ) self_abspathname="$linkval" ;;
    * ) self_abspathname=`echo "$self_abspathname" | sed -e 
's,/[^/]*$,,'`/"$linkval" ;;
  esac
done
gnulib_dir=`echo "$self_abspathname" | sed -e 's,/[^/]*$,,'`

sed_extract_prog=':[    ]*$/ {
  :a
    n
    s/^Description:[    ]*$//
    s/^Files:[  ]*$//
    s/^Depends-on:[     ]*$//
    s/^configure\.ac:[  ]*$//
    s/^Makefile\.am:[   ]*$//
    s/^Include:[        ]*$//
    s/^License:[        ]*$//
    s/^Maintainer:[     ]*$//
    tb
    p
    ba
  :b
}'

# func_get_filelist module
func_get_filelist ()
{
  sed -n -e "/^Files$sed_extract_prog" < "$gnulib_dir/modules/$1"
}

MODULES="$@"

FILES=`for module in "$MODULES"; do
    echo modules/$module
    func_get_filelist "$module"
done`
FILES=`for f in $FILES; do echo $f; done | LC_ALL=C sort | LC_ALL=C uniq`

echo "Modules:"
echo "$MODULES"
echo
echo "Files:"
echo "$FILES"
echo

echo "indent "`for f in $FILES; do if echo "$f" | grep -q ^lib/; then echo 
"$f"; fi; done`
echo
echo "cvs add "`for f in $FILES; do echo "$f"; done`
echo
echo "cvs diff "`for f in $FILES; do echo "$f"; done`
echo "cvs diff --new-file "`for f in $FILES; do echo "$f"; done`




reply via email to

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