]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_installxaw
r522: * Set DH_ALWAYS_EXCLUDE=CVS and debhelper will exclude CVS directories
[debhelper.git] / dh_installxaw
index 31867f156e67d6a9461a6ee9eb6224d6db4da2cc..17321834bf10818793b8a241544ebdf90f7b32bc 100755 (executable)
 #!/usr/bin/perl -w
-#
-# Integration with xaw-wrappers
-#
-# If debian/xaw-wrappers file exists, save it to 
-# $TMP/usr/lib/xaw-wrappers/conf/$PACKAGE
-#
-# Also, add calls to postinst and postrm.
-
-BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
-use Dh_Lib;
+
+=head1 NAME
+
+dh_installxaw - install xaw wrappers config files into package build directories
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_installxaw> [S<I<debhelper options>>] [B<-n>]
+
+=head1 DESCRIPTION
+
+Warning: The xaw-wrappers package has been removed from debian, and so this
+program is deprecated, and due to be removed soon.
+
+dh_installxaw is a debhelper program that is responsible for installing
+xaw wrappers config files into package build directories.
+
+It also automatically generates the postinst, prerm, and postrm commands
+needed to interface with the debian xaw-wrappers package. See
+L<dh_installdeb(1)> for an explanation of how this works.
+
+If a file named debian/package.xaw exists, then it is installed into
+usr/lib/xaw-wrappers/config/package in the package build directory.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-n>, B<--noscripts>
+
+Do not modify postinst/prerm/postrm 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();
 
-foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
-       $TMP=tmpdir($PACKAGE);
-       $xaw=pkgfile($PACKAGE,'xaw');
+warning("The xaw-wrappers package has been removed from debian, and so this program is deprecated, and due to be removed soon.");
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+       my $tmp=tmpdir($package);
+       my $xaw=pkgfile($package,'xaw');
 
        if ($xaw ne '') {
-               if (! -d "$TMP/usr/lib/xaw-wrappers/conf") {
-                       doit("install","-d","$TMP/usr/lib/xaw-wrappers/conf");
+               if (! -d "$tmp/usr/share/xaw-wrappers/config") {
+                       doit("install","-d","$tmp/usr/share/xaw-wrappers/config");
                }
                doit("install","-p","-m644",$xaw,
-                    "$TMP/usr/lib/xaw-wrappers/conf/$PACKAGE");
+                       "$tmp/usr/share/xaw-wrappers/config/$package");
 
                if (! $dh{NOSCRIPTS}) {
-                       autoscript($PACKAGE,"postinst","postinst-xaw");
-                       autoscript($PACKAGE,"postrm","postrm-xaw");
+                       # Parse the xaw conf file to figure out what programs
+                       # and link names are present in it. Have to pass
+                       # those into the scripts.
+                       my %data;
+                       my $install_opts='';
+                       my $remove_opts='';
+                       my $stanza='';
+                       
+                       open (IN,$xaw);
+                       while (<IN>) {
+                               chomp;
+                               s/\s+/ /g;
+                               if (/^#/ eq '') {
+                                       if (/(.*?):\s?(.*)/) {
+                                               $data{lc($1)}=$2;
+                                               $stanza=1;
+                                       }
+                                       elsif ($stanza) {
+                                               $install_opts.="'$data{program} $data{'link-name'} $data{wrapped}' ";
+                                               $remove_opts.="'$data{'link-name'} $data{wrapped}' ";
+                                               undef %data;
+                                               $stanza='';
+                                       }
+                               }
+                       }
+                       close IN;
+
+                       if ($stanza) {
+                               $install_opts.="'$data{program} $data{'link-name'} $data{wrapped}'";
+                               $remove_opts.="'$data{'link-name'} $data{wrapped}'";
+                       }
+                       
+                       autoscript($package,"postinst","postinst-xaw",
+                               "s:#OPTS#:$install_opts:");
+                       autoscript($package,"prerm","prerm-xaw",
+                               "s:#OPTS#:$remove_opts:");
+                       autoscript($package,"postrm","postrm-xaw");
                }
        }
 }
+
+=head1 SEE ALSO
+
+L<debhelper(1)>
+
+This program is a part of debhelper.
+
+=head1 AUTHOR
+
+Joey Hess <joeyh@debian.org>
+
+=cut