#!/usr/bin/env perl # # Check consistency of research archive. # Copyright (c) 2007-2012, Hiroyuki Ohsaki. # All rights reserved. # # $Id: chkarchive,v 1.11 2015/02/25 14:15:39 ohsaki Exp $ # # usage: chkarchive use File::Basename; use Getopt::Std; use strict; our $err_count = 0; sub msg { my $str = shift; $err_count++; warn "$str\n"; } sub msg_invaild { my ($path, $dir) = @_; if (-d $path) { msg "$path/:\tinvalid directory"; } else { msg "$path:\tinvalid file/symlink"; } } ### check existence of invalid files for (glob '*') { next if /^(RCS|README|bib|camera-ready|figure|misc|submit)$/; next if /\.tex$/; msg_invaild($_); } ### check existence of invalid bib files for (glob 'bib/*') { next if /\.bib$/; msg_invaild($_); } # check existence of invalid figure files my %hash; for (glob 'figure/*') { next if /\.def$/; if (/\.eps$/) { my $base = basename($_, '.eps'); $hash{$base} = $_; } elsif (/\.(res|obj|ai|ppt|vsd)$/) { my $base = basename($_, qw(.res .obj .ai .ppt .vsd .xcf .ppt)); delete $hash{$base} if defined $hash{$base}; } else { msg_invaild($_); } } for (sort keys %hash) { msg "$hash{$_}:\tmissing source file"; } ### check existence of final version for my $dir ('.', 'camera-ready') { next unless (-d $dir); for (<$dir/submit/*>) { next if /\.(ps\.gz|pdf|ppt)$/; msg_invaild($_); } for (qw(paper.pdf)) { msg "$dir/submit/$_:\tmissing final version" unless (-f "$dir/submit/$_"); } } ### check existence of presentation slide my $dir = (-d 'camera-ready' ? 'camera-ready' : '.'); msg "$dir/submit/slide.pdf:\tmissing slide PDF file" unless (-f "$dir/submit/slide.pdf"); warn "$err_count error(s)/warning(s) found\n";