2006-01-25

Install HenPlus on FC4

HenPlus is a nice command line tool that I use instead of Oracle's SQLPlus. HenPlus is distributed as an RPM, but it requires libreadline-java, which isn't included in the FC4 distribution:

$ sudo rpm -i henplus-0.9.5-1.noarch.rpm error: Failed dependencies:
libreadline-java >= 0.7.3 is needed by henplus-0.9.5-1.noarch

The RPM of libreadline-java that is referenced on the HenPlus web page is a little stale. It requires obsolete versions libhistory.so and libreadline.so:

$ sudo rpm -i libreadline-java-0.8.0-1.i386.rpm
error: Failed dependencies:
libhistory.so.4 is needed by libreadline-java-0.8.0-1.i386
libreadline.so.4 is needed by libreadline-java-0.8.0-1.i386

I already have the current versions of these libraries installed:

$ rpm -ql readline | grep lib
/usr/lib/libhistory.so.5
/usr/lib/libhistory.so.5.0
/usr/lib/libreadline.so.5
/usr/lib/libreadline.so.5.0

and I don't want to pollute my install with obsolete libraries. My options to get HenPlus installed from the RPM are:

  • Create fake symbolic links to fool the RPM dependency system into thinking libhistory.so.4 and libreadline.so.4 exist. This is obviously a bad hack, and I'd rather not do it.

  • Download and install a fresher libreadline-java RPM. Maybe fresh RPMs package the newer .so files. I'd rather let yum do that kind of work for me, though—that's its job.

  • Configure yum to use JPackage. There is a fresh libreadline-java RPM on JPackage, and instructions for how to configure yum to get packages from JPackage. I think this is the way to go.

To configure yum to use the JPackage repository, I download the jpackage.repo file and copy it to /etc/yum.repos.d/:

$ sudo cp jpackage.repo /etc/yum.repos.d/

I edit jpackage.repo to enable only the Fedora Core repository:

$ sudo emacs -nw /etc/yum.repos.d/jpackage.repo

In jpackage.repo, I disable [jpackage-generic] and enable [jpackage-fc]. The top of the file originally looked like this:

[jpackage-generic]
name=JPackage (free), generic
mirrorlist=http://www.jpackage.org/jpackage_generic.txt
failovermethod=priority
gpgcheck=1
gpgkey=http://www.jpackage.org/jpackage.asc
enabled=1

[jpackage-fc]
name=JPackage (free) for Fedora Core $releasever
mirrorlist=http://www.jpackage.org/jpackage_fedora-$releasever.txt
failovermethod=priority
gpgcheck=1
gpgkey=http://www.jpackage.org/jpackage.asc
enabled=0

and now it looks like this:

[jpackage-generic]
name=JPackage (free), generic
mirrorlist=http://www.jpackage.org/jpackage_generic.txt
failovermethod=priority
gpgcheck=1
gpgkey=http://www.jpackage.org/jpackage.asc
enabled=0

[jpackage-fc]
name=JPackage (free) for Fedora Core $releasever
mirrorlist=http://www.jpackage.org/jpackage_fedora-$releasever.txt
failovermethod=priority
gpgcheck=1
gpgkey=http://www.jpackage.org/jpackage.asc
enabled=1

I save the file, exit Emacs, and install libreadline-java:

$ sudo yum install libreadline-java
Password:
Setting up Install Process
Setting up repositories
http://ftp.nara.wide.ad.jp/pub/Linux/fedora/core/updates/4/i386/repodata/repomd.xml: [Errno 4] IOError: HTTP Error 404: Date: Wed, 25 Jan 2006 18:43:46 GMT
Server: Apache
Content-Length: 254
Content-Type: text/html; charset=iso-8859-1
Trying other mirror.
updates-released 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
jpackage-fc 100% |=========================| 951 B 00:00
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for libreadline-java to pack into transaction set.
libreadline-java-0.8.0-10 100% |=========================| 3.9 kB 00:00
---> Package libreadline-java.i386 0:0.8.0-10jpp set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
libreadline-java i386 0.8.0-10jpp jpackage-fc 21 k

Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 21 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): libreadline-java-0 100% |=========================| 21 kB 00:00
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID c431416d
Public key for libreadline-java-0.8.0-10jpp.i386.rpm is not installed
Retrieving GPG key from http://www.jpackage.org/jpackage.asc
Importing GPG key 0xC431416D "JPackage Project (JPP Official Keys) "
Is this ok [y/N]: y
Key imported successfully
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: libreadline-java ######################### [1/1]

Installed: libreadline-java.i386 0:0.8.0-10jpp
Complete!

Now that libreadline-java is installed, I can install HenPlus from the RPM:

$ sudo rpm -i henplus-0.9.5-1.noarch.rpm

This time, it succeeds.

I have installed HenPlus, so I try to run it:

$ henplus
Exception in thread "main" java.lang.NoClassDefFoundError: org/gnu/readline/ReadlineCompleter

I bet there's a problem with the class path. I notice that the henplus executable is a shell script:

$ which henplus
/usr/bin/henplus
$ file /usr/bin/henplus
/usr/bin/henplus: Bourne shell script text executable

That's good—I can edit the file and fix the class path. The class path should include the libreadline-java jar file. To find the location of that jar file, I type:

$ rpm -ql libreadline-java | grep jar
/usr/lib/java/libreadline-java-0.8.0.jar
/usr/lib/java/libreadline-java.jar

I edit the henplus shell script:

$ sudo emacs /usr/bin/henplus

and replace

CLASSPATH=$CLASSPATH:$THISDIR/../share/java/libreadline-java.jar

with

CLASSPATH=$CLASSPATH:/usr/lib/java/libreadline-java.jar

I save the file, exit Emacs, and try again:

$ henplus
using GNU readline (Brian Fox, Chet Ramey), Java wrapper by Bernhard Bablok
creating henplus config dir
henplus config at /home/kasper/.henplus
---------------------------------------------------------------------------
HenPlus II 0.9.5 Copyright(C) 1997, 2003 Henner Zeller
HenPlus is provided AS IS and comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it under the
conditions of the GNU Public License
---------------------------------------------------------------------------
Hen*Plus>

Success! Now I can use HenPlus and get on with my life.

No comments:

LinkWithin

Related Posts with Thumbnails