From bf5059dcd11bbe01bb9bdeb77de647545e33a42112ff877e9edf6004d971ccc7 Mon Sep 17 00:00:00 2001 From: Michal Marek Date: Tue, 4 Oct 2011 05:01:24 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/Kernel:HEAD/kernel-source?expand=0&rev=7066 --- group-source-files.pl | 82 ------------------------------------------- 1 file changed, 82 deletions(-) delete mode 100644 group-source-files.pl diff --git a/group-source-files.pl b/group-source-files.pl deleted file mode 100644 index de4ff13af..000000000 --- a/group-source-files.pl +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/perl - -use Getopt::Long; -use strict; - -&main(); -sub main -{ - my($dev_output, $ndev_output, $loc) = ("-", "-", "."); - &Getopt::Long::Configure(qw(bundling)); - &GetOptions( - "D=s" => \$dev_output, - "N=s" => \$ndev_output, - "L=s" => \$loc, - ); - - my($dev, $ndev) = &scan($loc); - &output($dev, $ndev, $dev_output, $ndev_output); -} - -sub scan -{ - my $loc = shift @_; - my(@dev, @ndev); - - foreach $_ (`find "$loc"`) - { - chomp $_; - if (!-f $_) { - # Generate directory list later. - next; - } - my $is_devel = - m{^\Q$loc\E.*/Kconfig} || - m{^\Q$loc\E.*/Kbuild} || - m{^\Q$loc\E.*/Makefile} || - m{^\Q$loc\E/arch/[^/]+/include\b} || - m{^\Q$loc\E/include/[^/]+\b} || - m{^\Q$loc\E/scripts\b}; - if (substr($_, 0, 1) ne "/") { - # We cannot use an absolute path during find, - # but rpm wants one later. - $_ = "/$_"; - } - $is_devel ? push(@dev, $_) : push(@ndev, $_); - } - - push(@dev, &calc_dirs("/$loc", \@dev)); - push(@ndev, &calc_dirs("/$loc", \@ndev)); - return (\@dev, \@ndev); -} - -sub calc_dirs -{ - my($base, $files) = @_; - my %dirs; - - foreach my $file (@$files) { - my $path = $file; - do { - $path =~ s{/[^/]+$}{}; - $dirs{$path} = 1; - } while ($path ne $base); - # This loop also makes sure that $base itself is included. - } - - return map { "\%dir $_" } keys %dirs; -} - -sub output -{ - my($dev, $ndev, $dev_out, $ndev_out) = @_; - local *FH; - - open(FH, "> $dev_out") || warn "Error writing to $dev_out: $!"; - print FH join("\n", @$dev), "\n"; - close FH; - - open(FH, "> $ndev_out") || warn "Error writing to $ndev_out: $!"; - print FH join("\n", @$ndev), "\n"; - close FH; -}