SOURCES: kernel-desktop-module-build.pl (NEW) - script for collect...

sparky sparky at pld-linux.org
Tue Jun 13 21:01:50 CEST 2006


Author: sparky                       Date: Tue Jun 13 19:01:50 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- script for collecting Makefile, Kconfig files and needed direcrtories,
  idea based on kernel.spec at LINUX_2_6

---- Files affected:
SOURCES:
   kernel-desktop-module-build.pl (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/kernel-desktop-module-build.pl
diff -u /dev/null SOURCES/kernel-desktop-module-build.pl:1.1
--- /dev/null	Tue Jun 13 21:01:50 2006
+++ SOURCES/kernel-desktop-module-build.pl	Tue Jun 13 21:01:45 2006
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+#
+use strict;
+use warnings;
+use File::Find qw(find);
+
+my $rpmdir = shift @ARGV or die;
+my $fileoutdir = shift @ARGV or die;
+my @tosort;
+
+find(\&wanted, ".");
+
+sub wanted {
+	return unless -f;
+	return unless /^Kconfig/ or /^Makefile/;
+	#return if /\.orig$/;
+	return if $File::Find::name =~ /(Documentation|scripts)/;
+	(my $file = $File::Find::name) =~ s#^\./##;
+	$file =~ m#^(.*)/#;
+	my $dir = $1;
+	my $subdir = "";
+	foreach my $sub ( split( '/', $dir )) {
+		$subdir .= "/" . $sub;
+		push @tosort, "\%dir $rpmdir$subdir\n";
+	}
+	push @tosort, "$rpmdir/$file\n";
+}
+
+my $last = "";
+my @toprint = grep {if ($_ ne $last) { $last = $_; 1} else {0}} sort @tosort;
+
+open F_OUT, "> $fileoutdir/aux_files" or die "Can't create aux_files: $!\n";
+print F_OUT @toprint;
+close F_OUT and print "aux_files created\n";
+
+open F_OUT, "> $fileoutdir/aux_files_exc" or die "Can't create aux_files_exc: $!\n";
+print F_OUT map {"\%exclude $_"} @toprint;
+close F_OUT and print "aux_files_exc created\n";
+
+open F_OUT, "| sort | uniq > $fileoutdir/aux_files_sh" or die "Can't create aux_files: $!\n";
+print F_OUT @tosort;
+close F_OUT and print "aux_files created\n";
+
+open F_OUT, "| sort | uniq > $fileoutdir/aux_files_exc_sh" or die "Can't create aux_files_exc: $!\n";
+print F_OUT map {"\%exclude $_"} @toprint;
+close F_OUT and print "aux_files_exc created\n";
================================================================


More information about the pld-cvs-commit mailing list