Changeset 540 for trunk


Ignore:
Timestamp:
Dec 29, 2007, 3:40:23 AM (16 years ago)
Author:
Peter Johansson
Message:

fixes automatic update of revision and copyright year in --version output. Options --version and --verbose can no be combined to get a slightly more detailed description.

Location:
trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/THANKS

    r519 r540  
    1818the generated CSS file, svndigest.css.
    1919
     20During the build process svndigest automagically incorporate its
     21current svn revision into the source and binary. The solution,
     22suggested Markus Hoenicka, works both when being in a subversion WC
     23(using svnversion) and when being outside. Hoenicka's suggestion can
     24be found here:
     25
     26http://www.mhoenicka.de/system-cgi/blog/index.php?itemid=999
    2027
    2128-----------------------------------------------------------------------
  • trunk/bin/Parameter.cc

    r538 r540  
    2525
    2626#include "ColumnStream.h"
     27#include "subversion_info.h"
    2728#include "utility.h"
    2829#include <config.h> // this header file is created by configure
    2930
     31#include <cstddef>
    3032#include <fstream>
    3133#include <iostream>
     
    116118      }
    117119      else if (myargv=="--version"){
    118           version();
    119           exit(0);
     120        version_=true;
     121        ok=true;
    120122      }
    121123      else if (myargv=="-vf" || myargv=="-fv"){
     
    130132    }
    131133
     134    if (version_){
     135      version(verbose_);
     136      exit(0);
     137    }     
    132138    analyse();
    133139  }
     
    191197    targetdir_=".";
    192198    verbose_=false;
     199    version_=false;
    193200  }
    194201
     
    238245
    239246
    240   void Parameter::version(void) const
     247  void Parameter::version(bool verbose) const
    241248  {
    242249    ColumnStream cs(std::cout, 1);
    243250    cs.width(0)=79;
    244     cs << PACKAGE_STRING
    245        << "\nCopyright (C) 2007 Jari Häkkinen and Peter Johansson.\n\n"
     251    cs << PACKAGE_STRING;
     252    if (verbose_) {
     253      cs << " (r" << svn_revision() << ")\n"
     254         << "   compiled " << __DATE__ ", " << __TIME__ << "\n";
     255    }
     256   
     257    cs << "\nCopyright (C) " << svn_year()
     258       << " Jari Häkkinen and Peter Johansson.\n\n"
    246259       << "This is free software; see the source for copying conditions. "
    247260       << "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR "
  • trunk/bin/Parameter.h

    r538 r540  
    5454    void defaults(void);
    5555    void help(void);
    56     void version(void) const;
     56    void version(bool=false) const;
    5757
    5858    std::string config_file_;
     
    6666    std::string targetdir_;
    6767    bool verbose_;
     68    bool version_;
    6869  };
    6970
  • trunk/configure.ac

    r519 r540  
    122122AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,svn_found="no")
    123123
     124
     125# check if svnversion is installed
     126have_svnversion="yes"
     127AC_PATH_PROG(SVNVERSION, svnversion, have_svnversion="no")
     128
     129wc_found="no";
     130if (test `$SVNVERSION -n '.'` != "exported"); then
     131   wc_found="yes";
     132fi
     133AC_CHECK_FILE("lib/subversion_info.h", info_found="yes", info_found="no")   
     134
     135# devel version should have svn WC and SVNVERSION installed
     136AM_CONDITIONAL(HAVE_SVN_WC, test "$wc_found" = "yes" )
     137
     138
    124139AC_CONFIG_FILES([Makefile
    125140                bin/Makefile
     
    133148# used to trigger exit before creation of output
    134149all_reqs_ok="true"
     150
     151#
     152if (test "$info_found" = "no" && test "$wc_found" = "no") ; then
     153   AC_MSG_WARN([Cannot find sources (lib/subverion_info.h).])
     154   if (test "$svnversion" = "no") ; then
     155     AC_MSG_WARN([If you grabbed the source from the subversion repository,
     156     the file will be generated automatically. However, svnversion cannot
     157     be found and therefore the file cannot be generated. Please install
     158     svnversion and make sure it is in your search path.])
     159   else
     160     AC_MSG_WARN([If you grabbed the source from the subversion repository,
     161     the file will be generated automatically. However, the output from
     162     svnversion was incorrect. Either your installation of svnversion is
     163     is not healthy or there is something wrong with the repository.])
     164   fi
     165   all_reqs_ok="false"
     166fi
    135167
    136168# Non-existing APR is fatal -- sub-sequent compilation will fail.
  • trunk/lib/Makefile.am

    r532 r540  
    4242  SVNblame.cc SVNinfo.cc SVNlog.cc SVNproperty.cc Trac.cc utility.cc
    4343
     44BUILT_SOURCES=subversion_info.h
     45
     46EXTRA_DIST=subversion_info.h
     47
    4448clean-local:
    45   rm -rf *~
     49  rm -rf *~ subversion_info.h
     50
     51all-local:
     52
     53if HAVE_SVN_WC
     54subversion_info.h: subversion_info.h.tmp
     55  @if [ ! -f $@ ]; then touch $@; fi; \
     56  diff $@ subversion_info.h.tmp > subversion_info.h.diff; \
     57  if test -s "subversion_info.h.diff"; then \
     58    mv subversion_info.h.tmp subversion_info.h; \
     59    $(ECHO) creating subversion_info.h; \
     60  fi; \
     61  rm -f subversion_info.h.tmp subversion_info.h.diff ;
     62
     63
     64subversion_info.h.tmp: FORCE
     65  @$(ECHO) '// svn_version.h generated from svn_version.h.in.' > $@ ;\
     66  revision=`$(SVNVERSION) $(top_srcdir)` ;\
     67  year=`svn info $(top_srcdir)| sed -n  's/.*Date: \(.*\)-..-.*/\1/p'`;\
     68  echo $$year; \
     69  $(SED) -e 's/sub_2_svn_revision/'$$revision'/g' \
     70  -e 's/sub_2_svn_year/'$$year'/g'  subversion_info.h.in >> $@ ;
     71endif
     72
     73FORCE:
  • trunk/lib/Parser.h

    r536 r540  
    4848    ///
    4949    enum line_type {
     50      copyright,
    5051      other,
    5152      comment,
  • trunk/test/Makefile.am

    r519 r540  
    4040utility_test_SOURCES = utility_test.cc
    4141
    42 rootdir = $(srcdir)/toy_project
    43 targetdir = $(builddir)/generated_output
    44 do_subst = $(SED) -e 's,@srcdir,$(srcdir),g' \
    45             -e 's,@top_builddir,$(top_builddir),g' \
    46             -e 's,@builddir,$(builddir),g' \
    47             -e 's,@MKDIR_P,$(MKDIR_P),g' \
    48             -e 's,@rootdir,$(rootdir),g' \
    49             -e 's,@targetdir,$(targetdir),g' \
    50                   -e 's,@SHELL,$(SHELL),g'
     42rootdir = $(abs_srcdir)/toy_project
     43targetdir = $(abs_builddir)/generated_output
     44repodir = $(abs_srcdir)/repo/trunk
     45
     46do_subst = $(SED) -e 's,%SHELL%,$(SHELL),g' \
     47            -e 's,%SED%,$(SED),g' \
     48            -e 's,%DISTFILES%,$(DISTFILES),g' \
     49            -e 's,%GREP%,$(GREP),g' \
     50            -e 's,%abs_srcdir%,$(abs_srcdir),g' \
     51            -e 's,%repodir%,$(repodir),g' \
     52            -e 's,%rootdir%,$(rootdir),g' \
     53            -e 's,%targetdir%,$(targetdir),g' \
     54            -e 's,%abs_top_builddir%,$(abs_top_builddir),g'
     55
    5156
    5257check_repo_status.sh: check_repo_status.sh.in Makefile
    5358  @$(do_subst) < $< > $@
    5459  @chmod +x $@
    55   @echo create $@
     60  @echo creating $@
    5661
    5762test_repo.sh: test_repo.sh.in Makefile
    5863  @$(do_subst) < $< > $@
    5964  @chmod +x $@
    60   @echo create $@
     65  @echo creating $@
    6166
    6267clean-local:
  • trunk/test/check_repo_status.sh.in

    r519 r540  
    1 #!@SHELL
     1#!%SHELL%
    22# $Id$
    33
  • trunk/test/test_repo.sh.in

    r539 r540  
    1 #!@SHELL
     1#!%SHELL%
    22# $Id$
    33
     
    2222
    2323# test repository does not exist and need to be checked out
    24 if [ ! -d @rootdir ]; then
    25     repodir=`cd "@srcdir" && pwd`;
     24if [ ! -d %rootdir% ]; then
     25    repodir=`cd "%abs_srcdir%" && pwd`;
    2626    repodir=$repodir"/repo/trunk";
    27     svn checkout file://$repodir @rootdir;
     27    svn checkout file://$repodir %rootdir%;
    2828fi
    2929
    30 svn update @rootdir > /dev/null;
     30svn update %rootdir% > /dev/null;
    3131
    32 if [ ! -d @targetdir ]; then
    33     mkdir @targetdir;
     32if [ ! -d %targetdir% ]; then
     33    mkdir %targetdir%;
    3434fi
    3535
    36 @top_builddir/bin/svndigest -r @rootdir -t @targetdir -f \
     36%abs_top_builddir%/bin/svndigest -r %rootdir% -t %targetdir% -f \
    3737--ignore-cache --no-report $1;
    3838
    39 @top_builddir/bin/svndigest -r @rootdir -t @targetdir -f --copyright $1;
     39%abs_top_builddir%/bin/svndigest -r %rootdir% -t %targetdir% -f --copyright $1;
    4040
Note: See TracChangeset for help on using the changeset viewer.