Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Side by Side Diff: third_party/lcov-1.9/bin/updateversion.pl

Issue 23189008: Upgrades lcov to 1.10, removes lcov-1.9 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Re-adds UNKNOWN suppression Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/lcov-1.9/bin/lcov ('k') | third_party/lcov-1.9/contrib/galaxy/CHANGES » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 sub update_man_page($);
6 sub update_bin_tool($);
7 sub update_txt_file($);
8 sub update_spec_file($);
9 sub get_file_info($);
10
11 our $directory = $ARGV[0];
12 our $version = $ARGV[1];
13 our $release = $ARGV[2];
14
15 our @man_pages = ("man/gendesc.1", "man/genhtml.1", "man/geninfo.1",
16 "man/genpng.1", "man/lcov.1", "man/lcovrc.5");
17 our @bin_tools = ("bin/gendesc", "bin/genhtml", "bin/geninfo",
18 "bin/genpng", "bin/lcov");
19 our @txt_files = ("README");
20 our @spec_files = ("rpm/lcov.spec");
21
22 if (!defined($directory) || !defined($version) || !defined($release)) {
23 die("Usage: $0 <directory> <version string> <release string>\n");
24 }
25
26 foreach (@man_pages) {
27 print("Updating man page $_\n");
28 update_man_page($directory."/".$_);
29 }
30 foreach (@bin_tools) {
31 print("Updating bin tool $_\n");
32 update_bin_tool($directory."/".$_);
33 }
34 foreach (@txt_files) {
35 print("Updating text file $_\n");
36 update_txt_file($directory."/".$_);
37 }
38 foreach (@spec_files) {
39 print("Updating spec file $_\n");
40 update_spec_file($directory."/".$_);
41 }
42 print("Done.\n");
43
44 sub get_file_info($)
45 {
46 my ($filename) = @_;
47 my ($sec, $min, $hour, $year, $month, $day);
48 my @stat;
49
50 @stat = stat($filename);
51 ($sec, $min, $hour, $day, $month, $year) = localtime($stat[9]);
52 $year += 1900;
53 $month += 1;
54
55 return (sprintf("%04d-%02d-%02d", $year, $month, $day),
56 sprintf("%04d%02d%02d%02d%02d.%02d", $year, $month, $day,
57 $hour, $min, $sec),
58 sprintf("%o", $stat[2] & 07777));
59 }
60
61 sub update_man_page($)
62 {
63 my ($filename) = @_;
64 my @date = get_file_info($filename);
65 my $date_string = $date[0];
66 local *IN;
67 local *OUT;
68
69 $date_string =~ s/-/\\-/g;
70 open(IN, "<$filename") || die ("Error: cannot open $filename\n");
71 open(OUT, ">$filename.new") ||
72 die("Error: cannot create $filename.new\n");
73 while (<IN>) {
74 s/\"LCOV\s+\d+\.\d+\"/\"LCOV $version\"/g;
75 s/\d\d\d\d\\\-\d\d\\\-\d\d/$date_string/g;
76 print(OUT $_);
77 }
78 close(OUT);
79 close(IN);
80 chmod(oct($date[2]), "$filename.new");
81 system("mv", "-f", "$filename.new", "$filename");
82 system("touch", "$filename", "-t", $date[1]);
83 }
84
85 sub update_bin_tool($)
86 {
87 my ($filename) = @_;
88 my @date = get_file_info($filename);
89 local *IN;
90 local *OUT;
91
92 open(IN, "<$filename") || die ("Error: cannot open $filename\n");
93 open(OUT, ">$filename.new") ||
94 die("Error: cannot create $filename.new\n");
95 while (<IN>) {
96 s/(our\s+\$lcov_version\s*=\s*["']).*(["'].*)$/$1LCOV version $v ersion$2/g;
97 print(OUT $_);
98 }
99 close(OUT);
100 close(IN);
101 chmod(oct($date[2]), "$filename.new");
102 system("mv", "-f", "$filename.new", "$filename");
103 system("touch", "$filename", "-t", $date[1]);
104 }
105
106 sub update_txt_file($)
107 {
108 my ($filename) = @_;
109 my @date = get_file_info($filename);
110 local *IN;
111 local *OUT;
112
113 open(IN, "<$filename") || die ("Error: cannot open $filename\n");
114 open(OUT, ">$filename.new") ||
115 die("Error: cannot create $filename.new\n");
116 while (<IN>) {
117 s/(Last\s+changes:\s+)\d\d\d\d-\d\d-\d\d/$1$date[0]/g;
118 print(OUT $_);
119 }
120 close(OUT);
121 close(IN);
122 chmod(oct($date[2]), "$filename.new");
123 system("mv", "-f", "$filename.new", "$filename");
124 system("touch", "$filename", "-t", $date[1]);
125 }
126
127 sub update_spec_file($)
128 {
129 my ($filename) = @_;
130 my @date = get_file_info($filename);
131 local *IN;
132 local *OUT;
133
134 open(IN, "<$filename") || die ("Error: cannot open $filename\n");
135 open(OUT, ">$filename.new") ||
136 die("Error: cannot create $filename.new\n");
137 while (<IN>) {
138 s/^(Version:\s*)\d+\.\d+.*$/$1$version/;
139 s/^(Release:\s*).*$/$1$release/;
140 print(OUT $_);
141 }
142 close(OUT);
143 close(IN);
144 system("mv", "-f", "$filename.new", "$filename");
145 system("touch", "$filename", "-t", $date[1]);
146 }
OLDNEW
« no previous file with comments | « third_party/lcov-1.9/bin/lcov ('k') | third_party/lcov-1.9/contrib/galaxy/CHANGES » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698