Subversion Repositories rld.domoticz

Rev

Blame | Last modification | View Log

#!/usr/bin/perl

use strict;
use XML::Simple;
use Data::Dumper;
use File::Basename;
use List::Util 1.33 'any';

my $input = ".distfiles";
my $output = "distfiles.mk";

my @excludedir = (".github", ".github/workflows");
my @excludefile = ();

open( my $fh => $input) || die "Cannot open $input: $!";
open( my $oh, ">", $output) || die "Cannot open $output: $!";

print $oh "# This File is automatically generated by make dist-update\n";
print $oh "# Any Edits on this file will be lost next time dist-update is run\n";
print $oh "\n";
print $oh "DISTFILES =\t";

while(my $line = <$fh>) {
    chomp($line);
    my $dir = dirname($line);
    if (any {/^$dir$/} @excludedir) 
    {
        print "Excluded File $line - (Directory Excluded)\n";
        next;
    }
    if (any {/^$line$/} @excludefile)
    {
        print "Excluded File $line - (File Excluded)\n";
        next;
    }
    print $oh $line." \\\n\t";
}
print $oh "cpp/src/vers.cpp\n";
close($oh);
close($fh);