Imported Upstream version 2.4.2
[platform/upstream/libtool.git] / libltdl / config / mkstamp
1 #! /bin/sh
2
3 #   mkstamp - extract data from Revision and Date RCS tags in a file
4 #   Copyright (C) 1999, 2003 Free Software Foundation, Inc.
5 #   Written by Alexandre Oliva, 1999
6 #
7 #   This file is part of GNU Libtool.
8 #
9 # GNU Libtool is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of
12 # the License, or (at your option) any later version.
13 #
14 # GNU Libtool is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Libtool; see the file COPYING.  If not, a copy
21 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
22 # or obtained by writing to the Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 ####
25
26 # This script takes a directory as an argument and generates a
27 # revision and date based upon the ChangeLog files in that directory.
28
29 # Generate a revision that looks similar to CVS revision by using 1.
30 # then the number of lines in the ChangeLogs starting with dates (an
31 # approximation of the number of commits) + 1000. 
32 # For those pulling from the savannah git repository it should be
33 # possible to go from this revision number to the git revision fairly
34 # easily. The number will also always increase.
35
36 awk 'BEGIN {
37         cocount=0;
38 }
39 /[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]  / {
40         if (cocount== 0) {
41                 datestr=$1
42         }
43         cocount++;
44 }
45 END {
46         cocount = cocount + 1000;
47         print "1." cocount " " datestr;
48 }' $1/ChangeLog $1/ChangeLog.[12][0-9][0-9][0-9]