summaryrefslogtreecommitdiff
path: root/scripts/sql.req
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-03-15 13:58:16 +0000
committerjbj <devnull@localhost>2001-03-15 13:58:16 +0000
commitbd80ac253d70e8da19e5634f0ab6f3e8aedf8eb5 (patch)
tree4e089a543eb57e7d7c600e6cafc33cadfcbb8092 /scripts/sql.req
parentfc920e3ac326473d884ffc6cfc86225d98442ea0 (diff)
downloadrpm-bd80ac253d70e8da19e5634f0ab6f3e8aedf8eb5.tar.gz
rpm-bd80ac253d70e8da19e5634f0ab6f3e8aedf8eb5.tar.bz2
rpm-bd80ac253d70e8da19e5634f0ab6f3e8aedf8eb5.zip
Updated dependency scripts (#20295).
CVS patchset: 4625 CVS date: 2001/03/15 13:58:16
Diffstat (limited to 'scripts/sql.req')
-rwxr-xr-xscripts/sql.req108
1 files changed, 108 insertions, 0 deletions
diff --git a/scripts/sql.req b/scripts/sql.req
new file mode 100755
index 000000000..24fa97278
--- /dev/null
+++ b/scripts/sql.req
@@ -0,0 +1,108 @@
+#!/usr/bin/perl
+
+# RPM and it's source code are covered under two separate licenses.
+
+# The entire code base may be distributed under the terms of the GNU
+# General Public License (GPL), which appears immediately below.
+# Alternatively, all of the source code in the lib subdirectory of the
+# RPM source code distribution as well as any code derived from that
+# code may instead be distributed under the GNU Library General Public
+# License (LGPL), at the choice of the distributor. The complete text
+# of the LGPL appears at the bottom of this file.
+
+# This alternatively is allowed to enable applications to be linked
+# against the RPM library (commonly called librpm) without forcing
+# such applications to be distributed under the GPL.
+
+# Any questions regarding the licensing of RPM should be addressed to
+# marc@redhat.com and ewt@redhat.com.
+
+
+# sql.req - a simple script to print the uses of sql functions.
+
+
+# by Ken Estes Mail.com kestes@staff.mail.com
+
+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 %require) {
+ print "sql($module)\n";
+}
+
+exit 0;
+
+
+
+sub process_file {
+
+ my ($filename) = @_;
+ chomp $filename;
+
+ open(FILE, "<$filename")||
+ die("$0: Could not open file: '$filename' : $!\n");
+
+ my ($package, $version) = ();
+
+ my (@file) = <FILE>;
+
+ my ($file) = "@file";
+
+ close(FILE)||
+ die("$0: Could not close file: '$file' : $!\n");
+
+ # skip the comments
+
+ # Suck the whole file in to make removing /* */ (multiple lines
+ # comments) comments easier
+
+ $file =~ s!/\*(.*?)\*/!!gs;
+ $file =~ s!^\s*--(.*?)\n!\n!gm;
+
+ @file = split(/\n/, $file);
+
+ foreach (@file) {
+
+ # remove strings
+
+ s!\'[^\']*\'!!g;
+
+
+ # we are interested in function names which have a dot in them and
+ # are followed by an open parenthesis
+
+ foreach ( m/([a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)\s*\(/ ) {
+ my $func = $_;
+ $func=lc($func);
+ $func =~ m/\.\./ &&
+ next;
+ $require{$func}=1;
+ }
+
+ # Each keyword can appear multiple times. Don't
+ # bother with datastructures to store these strings,
+ # if we need to print it print it now.
+
+ if ( m/^\s*\$RPM_Provides\s*:=\s*["'](.*)['"]/i) {
+ foreach $_ (spit(/\s+/, $1)) {
+ print "$_\n";
+ }
+ }
+
+ }
+
+ return ;
+}