From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- contrib/regression/mkindex.pl | 107 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100755 contrib/regression/mkindex.pl (limited to 'contrib/regression/mkindex.pl') diff --git a/contrib/regression/mkindex.pl b/contrib/regression/mkindex.pl new file mode 100755 index 000000000..46e11069f --- /dev/null +++ b/contrib/regression/mkindex.pl @@ -0,0 +1,107 @@ +#!/usr/bin/perl + +# Copy log files from a GCC build for HTTP access. +# Copyright (C) 2008, 2009 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# INPUT: +# mkindex.pl + +# This script copies log files from a GCC build directory, compresses +# and indexes them for web browser access. It's aimed at having an +# easy-to-access collection of files for analyzing regressions without +# needing to run the build yourself. Binary files (.o, executables) +# are intentionally not included since usually if they are needed it's +# better to just run a build, and because they take up a lot of space. + +# 'srcdir' is the root directory of a GCC build (was $objdir in the build). +# 'destdir' will be erased and replaced with the log files, and should be an +# absolute path. +# 'branchname' is used only to produce the title of the index page, +# which will be named 'index.html'. + +use warnings; +use strict; +use File::Path qw(mkpath rmtree); +use File::Find qw(find); + +if ($#ARGV != 2) { + print "usage: $0 \n"; + exit 1; +} + +my ($srcdir, $destdir, $branchname) = @ARGV; +die "destdir is not absolute" unless ($destdir =~ m,^/,); + +# Erase the destination. +rmtree $destdir; +mkdir $destdir or die "${destdir}: $!"; + +# Copy and compress the files into the destination, and keep a list in @files. +my @files = (); +sub my_wanted { + # Copy all files ending with .log or .sum. + if (/\.(log|sum)$/ && -f) { + + die unless (substr ($File::Find::dir,0,(length $srcdir)) eq $srcdir); + my $dir = substr $File::Find::dir,(length $srcdir); + $dir = substr $dir,1 unless ($dir eq ''); + my $name = $_; + $name = $dir . '/' . $_ if ($dir ne ''); + + mkpath $destdir . '/' . $dir; + # Compress the files. Use .gzip instead of .gz for the + # extension to avoid (broken) browser workarounds for broken + # web servers. + system ("gzip -c -q -9 $_ > $destdir/${name}.gzip") == 0 or exit 2; + + # Write the (compressed) size consistently in Kbytes. + my $size = -s $destdir .'/' . $name . '.gzip'; + my $printable_size = (sprintf "%.0fK",$size / 1024); + + push @files,[$name.'.gzip',$name,$printable_size]; + } +} +find ({wanted => \&my_wanted}, $srcdir); + +# Sort the list of files for the index. +@files = sort {$a->[1] cmp $b->[1]} @files; + +# Create the index. +open INDEX,'>',$destdir . '/index.html' or die "${destdir}/index.html: $!"; +# Use strict XHTML 1.0, and set charset to UTF-8. +print INDEX < + + + Log files for $branchname + + + +

Log files for $branchname

+ +EOF +# The index will have two columns, filename (without .gzip) and +# compressed size. +foreach my $f (@files) { + printf INDEX "\n", + $f->[0], $f->[1], $f->[2] or die "writing index: $!"; +} + +print INDEX "
NameSize
%s%s
\n" or die "writing index: $!"; +close INDEX or die "writing index: $!"; +exit 0; -- cgit v1.2.3