summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPaul Nasrat <pnasrat@redhat.com>2007-05-10 13:15:34 +0100
committerPaul Nasrat <pnasrat@redhat.com>2007-05-10 13:15:34 +0100
commita94e9ed5c5df62dc2f917b1a3d3bc69cd7678c9a (patch)
tree3c8852197d6dc6aa6dc00decaff79820cb3af434 /scripts
parentc3524d91c7d47088eaf05e792c766067a0550d15 (diff)
downloadlibrpm-tizen-a94e9ed5c5df62dc2f917b1a3d3bc69cd7678c9a.tar.gz
librpm-tizen-a94e9ed5c5df62dc2f917b1a3d3bc69cd7678c9a.tar.bz2
librpm-tizen-a94e9ed5c5df62dc2f917b1a3d3bc69cd7678c9a.zip
Add mono req/provides support
Alexander Larsson alexl@redhat.com
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am3
-rw-r--r--scripts/mono-find-provides42
-rw-r--r--scripts/mono-find-requires86
3 files changed, 130 insertions, 1 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index aa659b435..eb3d9a68e 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -20,7 +20,7 @@ EXTRA_DIST = \
sql.prov sql.req tcl.req tgpg trpm u_pkg.sh \
vpkg-provides.sh vpkg-provides2.sh \
macros.perl* macros.python* \
- macros.php* find-*.php find-php-*
+ macros.php* find-*.php find-php-* mono-find*
installprefix = $(DESTDIR)
@@ -36,6 +36,7 @@ config_SCRIPTS = \
cpanflute cpanflute2 Specfile.pm find-provides.perl \
find-requires.perl freshen.sh get_magic.pl getpo.sh http.req \
magic.prov magic.req perldeps.pl perl.prov perl.req pythondeps.sh \
+ mono-find-requires mono-find-provides \
rpmdb_loadcvt rpmdiff rpmdiff.cgi \
rpm.daily rpm.log rpm.xinetd rpm2cpio.sh \
sql.prov sql.req tcl.req tgpg trpm u_pkg.sh \
diff --git a/scripts/mono-find-provides b/scripts/mono-find-provides
new file mode 100644
index 000000000..2c808a038
--- /dev/null
+++ b/scripts/mono-find-provides
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# mono-find-provides
+#
+# Authors:
+# Ben Maurer (bmaurer@ximian.com)
+#
+# (C) 2005 Novell (http://www.novell.com)
+#
+# Args: builddir buildroot libdir
+
+IFS=$'\n'
+filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
+monolist=($(printf "%s\n" "${filelist[@]}" | egrep "\\.(exe|dll)\$"))
+
+# If monodis is in the package being installed, use that one
+# This is to support building mono
+build_bindir="$2/usr/bin"
+build_libdir="$2$3"
+
+if [ -x $build_bindir/monodis ]; then
+ monodis="$build_bindir/monodis"
+ export LD_LIBRARY_PATH=$build_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+elif [ -x /usr/bin/monodis ]; then
+ monodis="/usr/bin/monodis"
+else
+ exit 0;
+fi
+
+export MONO_SHARED_DIR=$1
+
+for i in "${monolist[@]}"; do
+ ($monodis --assembly $i | awk '
+ BEGIN { LIBNAME=""; VERSION=""; }
+ /^Version:/ { VERSION=$2 }
+ /^Name:/ { LIBNAME=$2 }
+ END {
+ if (VERSION && LIBNAME)
+ print "mono(" LIBNAME ") = " VERSION
+ }
+ ') 2>/dev/null
+done
diff --git a/scripts/mono-find-requires b/scripts/mono-find-requires
new file mode 100644
index 000000000..66b1f4bc7
--- /dev/null
+++ b/scripts/mono-find-requires
@@ -0,0 +1,86 @@
+#!/bin/bash
+#
+# mono-find-requires
+#
+# Authors:
+# Ben Maurer (bmaurer@ximian.com)
+#
+# (C) 2005 Novell (http://www.novell.com)
+#
+# Args: builddir buildroot libdir
+
+IFS=$'\n'
+filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
+monolist=($(printf "%s\n" "${filelist[@]}" | egrep "\\.(exe|dll)\$"))
+
+# If monodis is in the package being installed, use that one
+# This is to support building mono
+build_bindir="$2/usr/bin"
+build_libdir="$2$3"
+
+if [ -x $build_bindir/monodis ]; then
+ monodis="$build_bindir/monodis"
+ export LD_LIBRARY_PATH=$build_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
+elif [ -x /usr/bin/monodis ]; then
+ monodis="/usr/bin/monodis"
+else
+ exit 0;
+fi
+
+export MONO_SHARED_DIR=$1
+
+REQUIRES=$(
+ for i in "${monolist[@]}"; do
+ ($monodis --assemblyref $i | awk '
+ BEGIN { START=0; LIBNAME=""; VERSION=""; }
+ (START==0) && /^[0-9]+: Version=/ {
+ START=1;
+ sub(/Version=/, "", $2);
+ VERSION=$2
+ }
+
+ (START==1) && /^\tName=/ {
+ sub(/Name=/, "", $1);
+ LIBNAME=$1
+
+ print "mono(" LIBNAME ") = " VERSION
+ START=0
+ }
+ ') 2> /dev/null
+ done
+)
+
+PROVIDES=$(
+ for i in "${monolist[@]}"; do
+ ($monodis --assembly $i | awk '
+ BEGIN { LIBNAME=""; VERSION=""; }
+ /^Version:/ { VERSION=$2 }
+ /^Name:/ { LIBNAME=$2 }
+ END {
+ if (VERSION && LIBNAME)
+ print "mono(" LIBNAME ") = " VERSION
+ }
+ ') 2>/dev/null
+ done
+)
+#
+# This is a little magic trick to get all REQUIRES that are not
+# in PROVIDES. While RPM functions correctly when such deps exist,
+# they make the metadata a bit bloated.
+#
+
+# Filter out dups from both lists
+REQUIRES=$(echo "$REQUIRES" | sort | uniq)
+PROVIDES=$(echo "$PROVIDES" | sort | uniq)
+
+#
+# Get a list of elements that exist in exactly one of PROVIDES or REQUIRES
+#
+UNIQ=$(echo "$PROVIDES
+$REQUIRES" | sort | uniq -u)
+
+#
+# Of those, only chose the ones that are in REQUIRES
+#
+echo "$UNIQ
+$REQUIRES" | sort | uniq -d