Bug#252309: gjdoc: javadoc alternatives not created in postinst

Loic Minier Loic Minier <lool@dooz.org>, 252309@bugs.debian.org
Wed Jun 2 11:24:01 2004


This is a multi-part MIME message sent by reportbug.

--===============1060417075==
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="ISO-8859-15"
Content-Disposition: inline

Package: gjdoc
Version: 0.6.1-9
Severity: normal

 Hi,

 when installing gjdoc, the javadoc and javadoc.1.gz alternatives are
 not installed.

 these are only installed when upgrading from a previous version.

 I believe the problem is within:
    if ("dpkg" "--compare-versions" "${2} " "<<" "0.6.1"); then
        update-alternatives --remove javadoc /usr/bin/gjdoc;
    fi

 While the alternatives are correctly created, they're removed because
 ${2} is empty (no previous version available).

 I think the attached patch fixes this behavior.

   Regards,

-- 
Loïc Minier <lool@dooz.org>
-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.5-bee-2
Locale: LANG=fr_FR@euro, LC_CTYPE=fr_FR@euro

Versions of packages gjdoc depends on:
ii  debhelper              4.2.10            helper programs for debian/rules
ii  kaffe                  2:1.1.4-3         A JVM to run Java bytecode
ii  libgnujaxp-java        0.0.cvs20040416-4 free implementation of jaxp api

-- no debconf information

--===============1060417075==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="gjdoc.postinst.patch"

--- debian/gjdoc.postinst.old	2004-06-02 18:56:38.000000000 +0200
+++ debian/gjdoc.postinst	2004-06-02 19:00:45.000000000 +0200
@@ -8,8 +8,11 @@
         update-alternatives \
             --install /usr/bin/javadoc javadoc /usr/bin/gjdoc 350 \
             --slave $man/javadoc.1.gz javadoc.1.gz $man/gjdoc.1.gz
-	if ("dpkg" "--compare-versions" "${2} " "<<" "0.6.1"); then
-		update-alternatives --remove javadoc /usr/bin/gjdoc;
+	# is this a first install?
+	if [ "${2}" ]; then
+		if ("dpkg" "--compare-versions" "${2} " "<<" "0.6.1"); then
+			update-alternatives --remove javadoc /usr/bin/gjdoc;
+		fi
 	fi
 
     ;;

--===============1060417075==--