Mercurial > hg > octave-lyh > gnulib-hg
changeset 9805:d3af04de9f0b
Tweak "gnulib --version" output.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sun, 23 Mar 2008 12:18:23 +0100 |
parents | 1a9e11101b9d |
children | 88f73fbd046d |
files | ChangeLog gnulib-tool |
diffstat | 2 files changed, 37 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-03-23 Bruno Haible <bruno@clisp.org> + + Tweak "gnulib --version" output. + * gnulib-tool (func_version): Use date of last commit to ChangeLog, + rather than contents of ChangeLog, when possible. + 2008-03-21 Eric Blake <ebb9@byu.net> More --version tweaks.
--- a/gnulib-tool +++ b/gnulib-tool @@ -195,11 +195,39 @@ func_version () { func_gnulib_dir - date=`sed 's/ .*//;q' "$gnulib_dir"/ChangeLog` - version=`"$gnulib_dir"/build-aux/git-version-gen /dev/null` + if test -d "$gnulib_dir"/.git \ + && (git --version) >/dev/null 2>/dev/null \ + && (date --version) >/dev/null 2>/dev/null; then + # gnulib checked out from git. + sed_extract_first_date='/^Date/{ +s/^Date:[ ]*//p +q +}' + date=`cd "$gnulib_dir" && git log ChangeLog | sed -n -e "$sed_extract_first_date"` + # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600". + sed_year_before_time='s/^[^ ]* \([^ ]*\) \([0-9]*\) \([0-9:]*\) \([0-9]*\) /\1 \2 \4 \3 /' + date=`echo "$date" | sed -e "$sed_year_before_time"` + # Use GNU date to compute the time in GMT. + date=`date -d "$date" -u +"%Y-%m-%d %H:%M:%S"` + version=' '`"$gnulib_dir"/build-aux/git-version-gen /dev/null` + else + if test -d "$gnulib_dir"/CVS \ + && (cvs --version) >/dev/null 2>/dev/null; then + # gnulib checked out from CVS. + sed_extract_first_date='/^date: /{ +s/^date: \([0-9][0-9][0-9][0-9]\).\([0-9][0-9]\).\([0-9][0-9]\) \([0-9][0-9]:[0-9][0-9]:[0-9][0-9]\).*/\1-\2-\3 \4/p +q +}' + date=`cd "$gnulib_dir" && cvs log -N ChangeLog 2>/dev/null | sed -n -e "$sed_extract_first_date"` + else + # gnulib copy without versioning information. + date=`sed -e 's/ .*//;q' "$gnulib_dir"/ChangeLog` + fi + version= + fi year=`"$gnulib_dir"/build-aux/mdate-sh "$self_abspathname" | sed 's,^.* ,,'` echo "\ -gnulib-tool (GNU $package $date) $version +gnulib-tool (GNU $package $date)$version Copyright (C) $year Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it.