pkgsrc-WIP-discuss archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Updating wip/Makefile
Hi,
I was too lazy not updating Makefile, even after new wip
package imported. So sorry.
One reason I way lazy was that (I presume) it is not so
critical to update Makefile date-to-date, sorry again.
Now I have small perl script to get updated Makefile and I
have committed Makefile after automatic generation.
If it include something wrong, please correct or let me know.
Thanks,
---
Makoto Fujiwara,
Chiba, Japan, Narita Airport and Disneyland prefecture.
#!/usr/pkg/bin/perl
use strict;
my $WIP = '/usr/pkgsrc/wip';
my %ALREADY;
my @prologue;
my @body ;
my @sorted;
my @epilogue;
my $state = 0 ; # prologue(0) SUBDIR(1) epilogue(2)
sub internal_sort($$) {
my $a = shift;
my $b = shift;
my ($aa) = $a;
my ($bb) = $b;
$aa =~ s/.*SUBDIR\+=\s+//;
$bb =~ s/.*SUBDIR\+=\s+//;
$aa cmp $bb;
}
chdir $WIP;
open(MAKEFILE, "Makefile") || print "Problem reading Makefile: $!\n";
while ($_ = <MAKEFILE>) {
my $original = $_;
if (/^\#SUBDIR\+=[\t ]+(\S+)\s+#*/) { # exclude # comment after the name
my $dir = $1;
$ALREADY{$dir}++;
push (@body, $original);
# print STDERR $original, $dir,"\n";
}
if (/^SUBDIR\+=[\t ]+(.*)/) {
my $dir = $1;
$state = 1;
if ( -f "$dir/Makefile" && -d "$dir/CVS" ) {
$ALREADY{$dir}++;
push (@body, $_);
}
}
if ($state == 1 && /^$/ ) { $state = 2; }
if ($state == 0 ) { push(@prologue, $_);}
if ($state == 2 ) { push(@epilogue, $_);}
}
close(MAKEFILE);
my $name;
open(LIST,"/bin/ls */Makefile|");
while (<LIST>) {
if ( $_ =~ m|^(.*)/Makefile|) {
$name = $1;
if (! -d "$name/CVS") { next;} # skip if CVS is not there
if ($ALREADY{$name} == 0) {
push(@body,"SUBDIR+=\t$name\n"); # push new one not listed
}
}
}
close(LIST);
# check @body, Is listed one really has Makefile ?
@sorted = sort{internal_sort($a,$b)} @body;
print @prologue;
print @sorted;
print @epilogue;
__END__
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
pkgsrc-wip-discuss mailing list
pkgsrc-wip-discuss%lists.sourceforge.net@localhost
https://lists.sourceforge.net/lists/listinfo/pkgsrc-wip-discuss
Home |
Main Index |
Thread Index |
Old Index