Remove magic.prov|req that were only used by the unused find-bla.pl
authorPanu Matilainen <pmatilai@redhat.com>
Fri, 31 Aug 2007 08:28:52 +0000 (11:28 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 31 Aug 2007 08:28:52 +0000 (11:28 +0300)
scripts/magic.prov [deleted file]
scripts/magic.req [deleted file]

diff --git a/scripts/magic.prov b/scripts/magic.prov
deleted file mode 100755 (executable)
index ba3a45c..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-#!/usr/bin/perl
-
-use File::Basename;
-use Getopt::Long;
-
-# this dependency analysis program is the only one which need to know
-# the RPM buildroot to do its work.
-
-# Figuring out what files are really executables via magic numbers is
-# hard.  Not only is every '#!' an executable of some type (with a
-# potentially infinite supply of interpreters) but there are thousands
-# of valid binary magic numbers for old OS's and old CPU types.
-
-# Permissions do not always help discriminate binaries from the rest
-# of the files, on Solaris the shared libraries are marked as
-# 'executable'.
-
-#      -rwxr-xr-x   1 bin      bin      1013248 Jul  1  1998 /lib/libc.so.1
-
-# I would like to let the 'file' command take care of the magic
-# numbers for us. Alas! under linux file prints different kind of
-# messages for each interpreter, there is no common word 'script' to
-# look for.
-
-#      ' perl commands text'
-#      ' Bourne shell script text'
-#      ' a /usr/bin/wish -f script text'
-
-# WORSE on solaris there are entries which say:
-
-#      ' current ar archive, not a dynamic executable or shared object' 
-
-# how do I grep for 'executable' when people put a 'not executable' in
-# there?  I trim off everything after the first comma (if there is
-# one) and if the result has the string 'executable' in it then it may
-# be one.
-
-
-# so we must also do some magic number processing ourselves, and be
-# satisfied with 'good enough'.
-
-# I look for files which have atleast one of the executable bits set
-# and are either labled 'executable' by the file command (see above
-# restriction) OR have a '#!' as their first two characters.
-
-
-$is_mode_executable=oct(111);
-
-# set a known path
-  
-$ENV{'PATH'}= (
-              ':/usr/bin'.
-              ':/bin'.
-              '');
-
-# taint perl requires we clean up these bad environmental variables.
-  
-delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
-
-$BUILDROOT = '';
-%option_linkage = (
-                  "buildroot" => \$BUILDROOT,
-                 );
-
-if( !GetOptions (\%option_linkage, "buildroot=s") ) {
-  die("Illegal options in \@ARGV: '@ARGV'\n");
-
-}
-
-if ($BUILDROOT == '/') {
-  $BUILDROOT = '';
-}
-
-if ("@ARGV") {
-  foreach (@ARGV) {
-    process_file($_);
-  }
-} else {
-  
-  # notice we are passed a list of filenames NOT as common in unix the
-  # contents of the file.
-  
-  foreach (<>) {
-    process_file($_);
-  }
-}
-
-
-foreach $module (sort keys %provides) {
-  print "executable($module)\n";
-}
-
-exit 0;
-
-
-
-
-sub is_file_script {
-  
-  my ($file) = @_;
-  chomp $file;
-  
-  my $out = 0;
-  open(FILE, "<$file")||
-    die("$0: Could not open file: '$file' : $!\n");
-  
-  my $rc = sysread(FILE,$line,2);
-  
-  if ( ($rc > 1) && ($line =~ m/^\#\!/) ) {
-    $out = 1;
-  } 
-
-  close(FILE) ||
-    die("$0: Could not close file: '$file' : $!\n");
-  
-  return $out; 
-}
-
-
-
-sub is_file_binary_executable {
-  my ($file) = @_;
-
-  $file_out=`file $file`;
-  # trim off any extra descriptions.
-  $file_out =~ s/\,.*$//;
-  
-  my $out = 0;
-  if ($file_out =~ m/executable/ ) {
-    $out = 1;
-  }
-  return $out;
-}
-
-
-sub process_file {
-  my ($file) = @_;
-  chomp $file;
-
-  my $prov_name = $file;
-  $prov_name =~ s!^$BUILDROOT!!;
-
-  # If its a link find the file it points to.  Dead links do not
-  # provide anything.
-
-  while (-l $file) {
-    my $newfile = readlink($file);
-    if ($newfile !~ m!^/!) {
-      $newfile = dirname($file).'/'.$newfile;
-    } else {
-      $newfile = $BUILDROOT.$newfile;
-    }
-    $file = $newfile;
-  }
-
-  (-f $file) || return ;  
-  ( (stat($file))[2] & $is_mode_executable ) || return ;
-
-  is_file_script($file) || 
-    is_file_binary_executable($file) || 
-      return ;
-
-  $provides{$prov_name}=1;
-  $provides{basename($prov_name)}=1;
-    
-  return ; 
-}
diff --git a/scripts/magic.req b/scripts/magic.req
deleted file mode 100755 (executable)
index e325328..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/usr/bin/perl
-
-# Given a list of filenames on the command line or on stdin this
-# script returns the interpreter that is required to run the
-# filenames.  Usually this is extracted from the #! line of the file
-# but we also handle the various 'exec' tricks that people use to
-# start the interpreter via an intermediate shell.  
-
-# Also we want to convert:
-#      /usr/local/bin/perl5.00404 
-#      /usr/local/bin/tclsh8.0 
-# into dependencies with RPM version numbers.
-
-
-
-
-
-# These have all been seen on our system or are "recommended" in
-# various man pages.
-
-# Examples:
-
-#   #!/bin/sh
-#   # the next line restarts using wish \
-#   exec wish "$0" "$@"
-
-
-#   #!/bin/sh -- # -*- perl -*- -p
-#     eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
-#       if $running_under_some_shell;
-
-
-#   #!/bin/sh -- # -*- perl -*- -p
-#   eval '(exit $?0)' && eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
-
-
-#   #!/bin/sh -- # -*- perl -*- -p
-#   & eval 'exec /usr/bin/perl -wS $0 $argv:q'
-#     if $running_under_some_shell;
-
-
-#   #! /usr/bin/env python
-
-
-use File::Basename;
-
-if ("@ARGV") {
-  foreach (@ARGV) {
-    process_file($_);
-  }
-} else {
-  
-  # notice we are passed a list of filenames NOT as common in unix the
-  # contents of the file.
-  
-  foreach (<>) {
-    process_file($_);
-  }
-}
-
-
-foreach $prog (sort keys %require) {
-
-
-  # ignore variable interpolation and any program whose name is made
-  # up only of non word characters ('<', '&&', etc).
-
-  ( ( $prog != /\$/ ) || ( $prog =~ /^\W+$/ ) ) && 
-    next;
-
-  # filenames of the form './miniperl' will be reported in canonical
-  # manner 'miniperl'
-
-   $prog =~ s!^\./!!;
-
-  if ( $prog !~ /\$/ ) {
-    print "exectuable($prog)\n";
-  }
-
-  $prog=basename($prog);
-
-  if ( $prog !~ /\$/ ) {
-    print "exectuable($prog)\n";
-
-    # get the correct version dependencies for magic numbers like:
-    #  /usr/local/bin/perl5.00404 
-    #  /usr/local/bin/tclsh8.0 
-    # these are always PACKAGE versions since typical executables do not
-    # have versions
-
-    my $version = "";
-    if ($module =~ s/([.0-9]+)$//) {
-      $version = "$1";
-      print "$prog>=$version\n";
-    }
-
-  }
-
-}
-
-exit 0;
-
-
-sub process_file {
-  
-  my ($file) = @_;
-  chomp $file;
-  
-  my ($version, $magic) = ();
-  
-  (-f $file) || return ;  
-
-  open(FILE, "<$file")||
-    die("$0: Could not open file: '$file' : $!\n");
-  
-  my $rc = sysread(FILE,$line,1000);
-
-  $rc =~ s/\#.*\n//g;
-
-  # Ignore all parameter substitution.
-  # I have no hope of parsing something like: 
-  #  exec ${SHELL:-/bin/sh}
-  $rc =~ s/\$\{.*\}//g;
-  $rc =~ s/echo\s+.*[\n;]//g;
-  
-  if  ( ($rc > 1) && ($line =~ m/^\#\!\s*/) )  {
-    
-    if ($line =~ m/\b(exec|env)\s+([\'\"\`\\]+)?([^ \t\n\r]+)/) {
-      $require{$3} = 1;
-    }
-    
-    # strip off extra lines and any arguments
-    if ($line =~ m/^\#\!\s*([^ \t\n\r]+)/) {
-      $require{$1} = 1;
-    }
-
-  }
-
-  close(FILE) ||
-    die("$0: Could not close file: '$file' : $!\n");
-  
-  return ; 
-}