Automatically generated files check



Hi,

I wrote a perl script to check for autogen'd files in the CVS.  Here's
the output on my (2-3 days old) CVS copy:

Found configure in CVS file ./gimp/plug-ins/perl/etc/CVS/Entries
Found aclocal.m4 in CVS file ./gimp/plug-ins/perl/etc/CVS/Entries
Found Makefile in CVS file ./gtk--/gdk--/gdk--/CVS/Entries
Found Makefile in CVS file ./gtk--/gdk--/tests/CVS/Entries
Found Makefile.in in CVS file ./gdm/CVS/Entries
Found Makefile.in in CVS file ./gtkicq/CVS/Entries
Found configure in CVS file ./gtkicq/CVS/Entries
Found Makefile.in in CVS file ./gtkicq/src/CVS/Entries
Found Makefile.in in CVS file ./gtkicq/src/xpms/CVS/Entries
Found aclocal.m4 in CVS file ./gnome-libs/popt/CVS/Entries

Am I using the right strategy here?  Here's the perl-script:

#! /usr/bin/perl

# uncondionally "bad" files to distribute
@autogen_files = (
    "configure",            # by autoconf
    "aclocal.m4",           # by aclocal
    "config.cache",         # by configure
    "config.status",        # by configure
    "config.log",           # by configure
    "stamp-h"               # by configure
#    "config.h",            # by autoheader
#    "acconfig.h",          # by autoheader
#    "libtool",             # from distribution
#    "ltmain.sh",           # from distribution
#    "ltconfig"             # from distribution
);

open (CVS_FILES, "find . | grep /Entries\$ |");

while (<CVS_FILES>) {
    chomp;
    $cvs_file_name = $_;

    open (CVS_FILE, '<' . $cvs_file_name);

    %files = ();
    while (<CVS_FILE>) {
        s/^[^\/]*\/([^\/]*)\//\1/;
        if ($1 ne 'D') {
            $files{$1} = 1;
        }
    }

    if ($files{"Makefile"}) {
        # Makefile's are ok if not auto-gen'd
        if ($files{"Makefile.in"} || $files{"Makefile.am"}) {
            report ($cvs_file_name, "Makefile");
        }
    }

    if ($files{"Makefile.in"} && $files{"Makefile.am"}) {
        # Makefile.in's are ok if not auto-gen'd
        report ($cvs_file_name, "Makefile.in");
    }

    for my $file_name (@autogen_files) {
        if ($files{$file_name}) { report ($cvs_file_name, $file_name); }

    }
}

sub report {
    (my $cvs_file, my $cvs_entry) = @_;
    print "Found $cvs_entry in CVS file $cvs_file\n";
}

----
Andrew Clausen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]