File:
[LON-CAPA] /
loncom /
build /
getcvsdate.pl
Revision
1.1:
download - view:
text,
annotated -
select for diffs
Fri Jan 27 23:50:57 2012 UTC (13 years ago) by
raeburn
Branches:
MAIN
CVS tags:
version_2_12_X,
version_2_11_X,
version_2_11_6_msu,
version_2_11_6,
version_2_11_5_msu,
version_2_11_5,
version_2_11_4_uiuc,
version_2_11_4_msu,
version_2_11_4,
version_2_11_3_uiuc,
version_2_11_3_msu,
version_2_11_3,
version_2_11_2_uiuc,
version_2_11_2_msu,
version_2_11_2_educog,
version_2_11_2,
version_2_11_1,
version_2_11_0_RC3,
version_2_11_0_RC2,
version_2_11_0_RC1,
version_2_11_0,
loncapaMITrelate_1,
HEAD
- Bug 6535
Eliminate creation of unnecessary .lpmlsave files during install.
- PDF manuals are not included in CVS, but instead are built dynamically
when running make build (e.g., when creating a tarball for release).
- Assign new categoryname: pdf manual and include check for this in
lpml_parse.pl so filecompare.pl is called with -b3 flag.
- license/about.html and loncapa_apache.conf in release tree are modified
by make aboutVERSION, so developer installations can include version
and datestamp of build in version info.
- make aboutVERSION now includes code to set the last modified time to
the CVS commit date, so unanted .lpmlsave files will no longer be created.
- new file: getcvsdate.pl now included in loncom/build -- used to extract
commit date/time from CVS/Entries for about.html and loncapa_apache.conf
1: #!/usr/bin/perl
2:
3: # The LearningOnline Network with CAPA
4: # getcvsdate.pl - script to get CVS commit date for a file from CVS/Entries.
5: #
6: # $Id: getcvsdate.pl,v 1.1 2012/01/27 23:50:57 raeburn Exp $
7: #
8: # Copyright Michigan State University Board of Trustees
9: #
10: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
11: #
12: # LON-CAPA is free software; you can redistribute it and/or modify
13: # it under the terms of the GNU General Public License as published by
14: # the Free Software Foundation; either version 2 of the License, or
15: # (at your option) any later version.
16: #
17: # LON-CAPA is distributed in the hope that it will be useful,
18: # but WITHOUT ANY WARRANTY; without even the implied warranty of
19: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20: # GNU General Public License for more details.
21: #
22: # You should have received a copy of the GNU General Public License
23: # along with LON-CAPA; if not, write to the Free Software
24: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25: #
26: # /home/httpd/html/adm/gpl.txt
27: #
28: # http://www.lon-capa.org/
29: #
30:
31: use strict;
32:
33: # ------------------------------------------------------------------ Invocation
34: my $invocation=<<END;
35: getcvsdate.pl [PATH TO CVS/Entries] [FILE]
36:
37: END
38:
39: unless (@ARGV) {
40: print $invocation;
41: exit 1;
42: }
43:
44: my %month_to_twodigit = (
45: Jan => '01',
46: Feb => '02',
47: Mar => '03',
48: Apr => '04',
49: May => '05',
50: Jun => '06',
51: Jul => '07',
52: Aug => '08',
53: Sep => '09',
54: Oct => '10',
55: Nov => '11',
56: Dec => '12',
57: );
58:
59: if (@ARGV==2) {
60: my $path = $ARGV[0];
61: my $file = $ARGV[1];
62: my $datetime;
63: if ($path ne '' && $file ne '') {
64: if (-e $path) {
65: if (open(my $fh,"<$path")) {
66: while(<$fh>) {
67: chomp();
68: if (m{\Q$file\E/[\d.]+/+([^/]+)/}) {
69: my ($wday,$month,$day,$clock,$yr) = split(/\s+/,$1);
70: if (exists($month_to_twodigit{$month})) {
71: $datetime = $yr.'-'.$month_to_twodigit{$month}.'-'.$day.' '.$clock.' +0000';
72: }
73: last;
74: }
75: }
76: close($fh);
77: }
78: }
79: }
80: print $datetime;
81: }
82:
83: =pod
84:
85: =head1 NAME
86:
87: getcvsdate.pl - script to get CVS commit date for a file from CVS/Entries.
88:
89: =head1 SYNOPSIS
90:
91: getcvsdate.pl [PATH TO CVS/Entries] [FILE]
92:
93: =head1 DESCRIPTION
94:
95: getcvsdate.pl can be used to retrieve the CVS commit date/time for a prticular
96: file from the corresponding entry in CVS/Entries.
97:
98: The date is returned in the following format:
99: YYYY-MM-DD HH:MM:SS +0000
100:
101: where +0000 (in HHMM) is the (assumed zero) timezone offset from UTC.
102:
103: This script is invoked in Makefile (within aboutVERSION and postaboutVERSION
104: targets) to set the modification dates for two files containing version
105: information which are modified during the LON-CAPA installation process.
106: In this use case the time string generated by a call to getcvsdate.pl for
107: loncapa_apache.conf and about.html is passed as the input for the date argument
108: in a call to the touch utility, e.g.,
109:
110: touch --date="$(shell echo `perl getcvsdate.pl
111: $(SOURCE)/loncom/license/CVS/Entries about.html`)"
112: $(SOURCE)/loncom/license/about.html
113:
114: =cut
115:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>