[Pkg-mono-svn-commits] rev 2354 - in cli-common/trunk: . debian

D. Moonfire dmoonfire-guest at costa.debian.org
Thu Mar 23 20:04:27 UTC 2006


Author: dmoonfire-guest
Date: 2006-03-23 20:04:25 +0000 (Thu, 23 Mar 2006)
New Revision: 2354

Added:
   cli-common/trunk/debian/dirs
   cli-common/trunk/dh_installcligac
   cli-common/trunk/gac-install
   cli-common/trunk/gac-package-install
   cli-common/trunk/gac-package-remove
   cli-common/trunk/gac-remove
   cli-common/trunk/postinst-cligac
   cli-common/trunk/prerm-cligac
Modified:
   cli-common/trunk/debian/changelog
   cli-common/trunk/debian/cli-common.install
Log:
This is the proposed late GAC installer and uninstaller framework
for the policy changes.


Modified: cli-common/trunk/debian/changelog
===================================================================
--- cli-common/trunk/debian/changelog	2006-03-23 19:49:55 UTC (rev 2353)
+++ cli-common/trunk/debian/changelog	2006-03-23 20:04:25 UTC (rev 2354)
@@ -6,6 +6,8 @@
     + Added LD_LIBRARY_PATH to "mono" call for internal-mono mode.
     + Fixed dllmap parser regex in dh_clideps and dh_makeclideps, to not use
       the full filename but the SONAME.
+  * Dylan R. E. Moonfire <debian at mfgames.com>
+    + Added a late GAC installer framework.
 
  -- Debian Mono Group <pkg-mono-group at lists.alioth.debian.org>  Mon, 20 Feb 2006 00:59:07 +0100
 

Modified: cli-common/trunk/debian/cli-common.install
===================================================================
--- cli-common/trunk/debian/cli-common.install	2006-03-23 19:49:55 UTC (rev 2353)
+++ cli-common/trunk/debian/cli-common.install	2006-03-23 20:04:25 UTC (rev 2354)
@@ -1,3 +1,10 @@
-dh_makeclilibs	/usr/bin/
-dh_clideps	/usr/bin/
-ildasm-monodis	/usr/share/cli-common/
+dh_makeclilibs		/usr/bin/
+dh_clideps		/usr/bin/
+dh_installcligac	/usr/bin/
+ildasm-monodis		/usr/share/cli-common/
+gac-install		/usr/lib/cli-common/
+gac-remove		/usr/lib/cli-common/
+gac-package-install	/usr/lib/cli-common/
+gac-package-remove	/usr/lib/cli-common/
+postinst-cligac		/usr/share/debhelper/autoscripts/
+prerm-cligac		/usr/share/debhelper/autoscripts/

Added: cli-common/trunk/debian/dirs
===================================================================
--- cli-common/trunk/debian/dirs	2006-03-23 19:49:55 UTC (rev 2353)
+++ cli-common/trunk/debian/dirs	2006-03-23 20:04:25 UTC (rev 2354)
@@ -0,0 +1,4 @@
+usr/lib/cli-common/mapping.d
+usr/lib/cli-common/install-gac.d
+usr/lib/cli-common/remove-gac.d
+usr/lib/cli-common/packages.d

Added: cli-common/trunk/dh_installcligac
===================================================================
--- cli-common/trunk/dh_installcligac	2006-03-23 19:49:55 UTC (rev 2353)
+++ cli-common/trunk/dh_installcligac	2006-03-23 20:04:25 UTC (rev 2354)
@@ -0,0 +1,80 @@
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_installcligac - register assemblies to be late installed into a GAC
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_installcligac> [S<I<debhelper options>>] [B<-n>]
+
+=head1 DESCRIPTION
+
+dh_installcligac is a debhelper program that is responsible for
+installing assemblies and related files used by the Debian cli-common
+package into GAC of all installed runtimes.
+
+It also automatically generates the postinst and prerm commands needed
+to late install the assemblies. See L<dh_installdeb(1)> for an
+explanation of how this works.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-n>, B<--noscripts>
+
+Do not modify postinst/prerm scripts.
+
+=back
+
+=head1 NOTES
+
+Note that this command is not idempotent. "dh_clean -k" should be called
+between invocations of this command. Otherwise, it may cause multiple
+instances of the same text to be added to maintainer scripts.
+
+=cut
+
+init();
+
+if (! defined $dh{PRIORITY}) {
+	$dh{PRIORITY}=50;
+}
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+	my $tmp=tmpdir($package);
+
+	my $cligac=pkgfile($package,"installcligac");
+
+	if ($cligac ne '') {
+		if (! -d "$tmp/usr/lib/cli-common/packages.d") {
+			doit("install","-d","$tmp/usr/lib/cli-common/packages.d");
+		}
+		doit("install","-m0644",$cligac,"$tmp/usr/lib/cli-common/packages.d/$package.installcligac");
+
+		if (! $dh{NOSCRIPTS}) {
+			autoscript($package,"postinst","postinst-cligac",
+				"s/#PACKAGE#/$package/");
+			autoscript($package,"prerm","prerm-cligac",
+				"s/#PACKAGE#/$package/");
+		}
+	}
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Dylan R. E. Moonfire <debian at mfgames.com>
+
+=cut


Property changes on: cli-common/trunk/dh_installcligac
___________________________________________________________________
Name: svn:executable
   + *

Added: cli-common/trunk/gac-install
===================================================================
--- cli-common/trunk/gac-install	2006-03-23 19:49:55 UTC (rev 2353)
+++ cli-common/trunk/gac-install	2006-03-23 20:04:25 UTC (rev 2354)
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# Make sure the GAC file exists
+if [ ! -x /usr/lib/cli-common/install-gac.d/$1 ]; then
+    echo E: Cannot install GAC $1
+    exit 1
+fi
+
+# Make some useful noise
+#echo "Installing packages in $1"
+
+for file in /usr/lib/cli-common/packages.d/*.installcligac
+do
+  if [ -f $file ]; then
+      /usr/lib/cli-common/gac-package-install \
+	  $(basename $file .installcligac) \
+	  $1
+  fi
+done


Property changes on: cli-common/trunk/gac-install
___________________________________________________________________
Name: svn:executable
   + *

Added: cli-common/trunk/gac-package-install
===================================================================
--- cli-common/trunk/gac-package-install	2006-03-23 19:49:55 UTC (rev 2353)
+++ cli-common/trunk/gac-package-install	2006-03-23 20:04:25 UTC (rev 2354)
@@ -0,0 +1,148 @@
+#!/usr/bin/perl
+
+#
+# Setup
+#
+
+# Directives
+use strict;
+use warnings;
+
+# Modules
+use File::Basename;
+
+# This script gets the name of the package as the first parameter.  It
+# parses the file given, figures out the black and white listing, then
+# installs them as appropriate. If there is a second parameter, this
+# is the only CLR installed.
+
+#
+# Handle the input file
+#
+
+# Get the package
+my $pkg = $ARGV[0];
+my $use_clr = $ARGV[1];
+my $full = "/usr/lib/cli-common/packages.d/$pkg";
+
+# Make sure it exists
+if ( ! -f "$full.installcligac" )
+{
+    print STDERR "E: $full.installcligac doesn't exist!\n";
+    exit 1;
+}
+
+# Parse the file
+unless (open INPUT, "<$full.installcligac")
+{
+    print STDERR "E: Cannot open $full.installcligac ($!)\n";
+    exit 2;
+}
+
+my @dlls = ();
+my %blacklist = ();
+my %whitelist = ();
+
+while (<INPUT>)
+{
+    # Clean up the line and ignore blanks and comments
+    chomp;
+    s/^\s+//;
+    s/\s+$//;
+    next if /^\#/;
+    next if /^\s*$/;
+
+    # Split on the space
+    my @p = split(/\s+/);
+
+    # Check the DLL
+    my $dll = shift @p;
+
+    if (! -f $dll)
+    {
+	print STDERR "E: Assembly $dll does not exist, ignoring\n";
+	next;
+    }
+
+    push @dlls, $dll;
+
+    # Go through the listing
+    while (@p)
+    {
+	# Get it
+	my $p = shift @p;
+
+	#print "D: List -> $dll: $p\n";
+
+	# Add it to the appropriate list. The dll:$dll key is used for
+	# sanity checking.
+	if ($p =~ s/^-//)
+	{
+	    $blacklist{"$p:$dll"}++;
+	    $blacklist{"dll:$dll"}++;
+	}
+	elsif ($p =~ s/^\+//)
+	{
+	    $whitelist{"$p:$dll"}++;
+	    $whitelist{"dll:$dll"}++;
+	}
+    }
+}
+
+# Do some sanity checking
+foreach my $dll (@dlls)
+{
+    if (defined($whitelist{"dll:$dll"}) && defined($blacklist{"dll:$dll"}))
+    {
+	print STDERR "E: $dll has both a white- and blacklist.\n";
+	print STDERR "E:   Ignoring blacklist.\n";
+    }
+}
+
+# Go through the installation targets
+foreach my $clr (glob("/usr/lib/cli-common/install-gac.d/*"))
+{
+    # Ignore temporary files
+    next if $clr =~ /~$/;
+    next if $clr =~ /^\./;
+
+    # Get the "name"
+    my $name = basename($clr);
+
+    # Get the formal name
+    my $formalfile = "/usr/lib/cli-common/mapping.d/$name";
+    my $formal = $name;
+    $formal = `cat $formalfile` if ( -f $formalfile);
+    $formal = $name if !defined $formal || $formal =~ /^\s*$/;
+    chomp($formal);
+
+    # Only use the one CLR if given
+    next if (defined $use_clr && $name ne $use_clr);
+
+    # Figure out the package list
+    my @install = ();
+
+    foreach my $dll (@dlls)
+    {
+	# Check the white list
+	if (defined $whitelist{"dll:$dll"})
+	{
+	    next if (!defined $whitelist{"$name:$dll"});
+	}
+	elsif (defined $blacklist{"dll:$dll"})
+	{
+	    next if (defined $blacklist{"$name:$dll"});
+	}
+
+	# We are going to install this one
+	push @install, $dll;
+    }
+
+    # Install it
+    my $t = scalar(@install) . " assemblies";
+    $t = "one assembly" if (@install == 1);
+
+    #print "D: ", join(", ", @install), "\n";
+    print STDERR "I: Installing $t from $pkg into $formal\n";
+    system($clr, $pkg, @install);
+}


Property changes on: cli-common/trunk/gac-package-install
___________________________________________________________________
Name: svn:executable
   + *

Added: cli-common/trunk/gac-package-remove
===================================================================
--- cli-common/trunk/gac-package-remove	2006-03-23 19:49:55 UTC (rev 2353)
+++ cli-common/trunk/gac-package-remove	2006-03-23 20:04:25 UTC (rev 2354)
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+for file in /usr/lib/cli-common/remove-gac.d/*
+  do	
+  if [ -x $file ]; then
+      # Figure out the formal name
+      B="$(basename $file)"
+      F=$B
+
+      if [ -f /usr/lib/cli-common/mapping.d/$B ]; then
+	  F=$(cat /usr/lib/cli-common/mapping.d/$B)
+      fi
+
+      echo "Removing $1 from $F"
+      $file $1
+  fi
+done


Property changes on: cli-common/trunk/gac-package-remove
___________________________________________________________________
Name: svn:executable
   + *

Added: cli-common/trunk/gac-remove
===================================================================
--- cli-common/trunk/gac-remove	2006-03-23 19:49:55 UTC (rev 2353)
+++ cli-common/trunk/gac-remove	2006-03-23 20:04:25 UTC (rev 2354)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+if [ ! -x /usr/lib/cli-common/remove-gac.d/$1 ]; then
+    echo E: Cannot remove GAC $1
+    exit 1
+fi
+
+echo "Removing packages from $1"
+
+for file in /usr/lib/cli-common/packages.d/*.installcligac
+do
+  if [ -f $file ]; then
+      /usr/lib/cli-common/remove-gac.d/$1 $(basename $file .installcligac)
+  fi
+done


Property changes on: cli-common/trunk/gac-remove
___________________________________________________________________
Name: svn:executable
   + *

Added: cli-common/trunk/postinst-cligac
===================================================================
--- cli-common/trunk/postinst-cligac	2006-03-23 19:49:55 UTC (rev 2353)
+++ cli-common/trunk/postinst-cligac	2006-03-23 20:04:25 UTC (rev 2354)
@@ -0,0 +1,4 @@
+if [ "$1" = "configure" ] && [ -x /usr/lib/cli-common/gac-package-install ]
+then
+	/usr/lib/cli-common/gac-package-install #PACKAGE#
+fi

Added: cli-common/trunk/prerm-cligac
===================================================================
--- cli-common/trunk/prerm-cligac	2006-03-23 19:49:55 UTC (rev 2353)
+++ cli-common/trunk/prerm-cligac	2006-03-23 20:04:25 UTC (rev 2354)
@@ -0,0 +1,3 @@
+if [ -x /usr/lib/cli-common/gac-package-remove ] ; then
+	/usr/lib/cli-common/gac-package-remove #PACKAGE#
+fi




More information about the Pkg-mono-svn-commits mailing list