Here's the final patch in all its glory, modulo ChangeLog entries. I
haven't managed to break it yet...

Below is what I consider to be an exhaustive set of tests on a PC running
Fedora Core 3. All tests passed.

Jean-Marc, if you're happy with the patch then I'd like to commit it.
That'll make it easier to test this thing on other machines and under
other OSes.

Angus


Start off by testing LyX in-place:

angus $HOME/lyx/13x/build-qt> src/lyx -dbg init

        Checking whether LyX is run in place... yes

        binary_dir /home/angus/lyx/13x/build-qt/src/
        system_support /home/angus/lyx/13x/lib
        build_support /home/angus/lyx/13x/build-qt/lib/
        user_support /home/angus/.lyx-1.3.6cvs/
        locale_dir /usr/local/share/locale
        document_dir /home/angus
        temp_dir /tmp
        home_dir /home/angus

$HOME/bin/qlyx13x is a symbolic link to $HOME/lyx/13x/build-qt/src/lyx
$HOME/bin is in my PATH.

angus $HOME/lyx/13x/build-qt> qlyx13x -dbg init

        Checking whether LyX is run in place... yes

        binary_dir /home/angus/bin/
        system_support /home/angus/lyx/13x/lib
        build_support /home/angus/lyx/13x/build-qt/lib/
        user_support /home/angus/.lyx-1.3.6cvs/
        locale_dir /usr/local/share/locale
        document_dir /home/angus
        temp_dir /tmp
        home_dir /home/angus

Note that LyX manages to resolve the true location of the executable having
found the executable in the PATH.

Installing lyx (PACKAGE = lyx-1.3.6cvs) in /usr/local/bin

angus $HOME/lyx/13x/build-qt> cd $HOME
angus $HOME> lyx-1.3.6cvs -dbg init

 Checking whether LyX is run in place... no

        binary_dir /usr/local/bin/
        system_support /usr/local/share/lyx-1.3.6cvs/
        build_support
        user_support /home/angus/.lyx-1.3.6cvs/
        locale_dir /usr/local/share/locale/
        document_dir /home/angus
        temp_dir /tmp
        home_dir /home/angus

$HOME/bin/test-lyx is a symbolic link pointing
to /usr/local/bin/lyx-1.3.6cvs

angus $HOME> test-lyx -dbg init

        Checking whether LyX is run in place... no

        binary_dir /home/angus/bin/
        system_support /usr/local/share/lyx-1.3.6cvs/
        build_support
        user_support /home/angus/.lyx-1.3.6cvs/
        locale_dir /usr/local/share/locale/
        document_dir /home/angus
        temp_dir /tmp
        home_dir /home/angus

Remove this symbolic link and copy the LyX executable to my home directory.

angus $HOME> rm -f bin/test-lyx
angus $HOME> cp lyx/13x/build-qt/src/lyx test-lyx
angus $HOME> ./test-lyx -dbg init

        Checking whether LyX is run in place... no

        binary_dir /home/angus/
        system_support /usr/local/share/lyx-1.3.6cvs
        build_support
        user_support /home/angus/.lyx-1.3.6cvs/
        locale_dir /usr/local/share/locale/
        document_dir /home/angus
        temp_dir /tmp
        home_dir /home/angus

Interesting. LyX is using the hard coded LYX_DIR and LOCALEDIR to find the
stuff that belongs to the installed LyX.

Let's move those directories.
angus $HOME> su
root $HOME> cd /usr/local/share
root /usr/local/share> ls
locale  lyx-1.3.6cvs
root /usr/local/share> mv lyx-1.3.6cvs lyx
root /usr/local/share> mv locale test-locale
root /usr/local/share> exit

angus $HOME> ./test-lyx -dbg init

        Checking whether LyX is run in place... no
        Unable to determine the system directory having searched
                /home/share/lyx-1.3.6cvs/
        Try the '-sysdir' command line parameter or set the
        environment variable LYX_DIR_13x to the LyX system
        directory containing the file `chkconfig.ltx'.

Good. That was expected to fail.

angus $HOME> ./test-lyx -dbg init -sysdir foo

        Checking whether LyX is run in place... no
        Invalid -sysdir switch.
        Directory /home/angus/foo does not contain chkconfig.ltx.
        Unable to determine the system directory having searched
                /home/angus/foo
                /home/share/lyx-1.3.6cvs/
        Try the '-sysdir' command line parameter or set the
        environment variable LYX_DIR_13x to the LyX system
        directory containing the file `chkconfig.ltx'.

Good. Also fails. Same reason.

angus $HOME> ./test-lyx -dbg init -sysdir /usr/local/share/lyx

        Checking whether LyX is run in place... no

        binary_dir /home/angus/
        system_support /usr/local/share/lyx
        build_support
        user_support /home/angus/.lyx-1.3.6cvs/
        locale_dir
        document_dir /home/angus
        temp_dir /tmp
        home_dir /home/angus

Succeeds. Note that locale_dir is unset, as expected.

Let's try the environment variable way.

angus $HOME> export LYX_DIR_13x=/foo
angus $HOME> ./test-lyx -dbg init

        Checking whether LyX is run in place... no
        Invalid LYX_DIR_13x environment variable.
        Directory /foo does not contain chkconfig.ltx.
        Unable to determine the system directory having searched
                /foo
                /home/share/lyx-1.3.6cvs/

angus $HOME> export LYX_DIR_13x=/usr/local/share/lyx
angus $HOME> ./test-lyx -dbg init

        Checking whether LyX is run in place... no

        binary_dir /home/angus/
        system_support /usr/local/share/lyx
        build_support
        user_support /home/angus/.lyx-1.3.6cvs/
        locale_dir
        document_dir /home/angus
        temp_dir /tmp
        home_dir /home/angus

angus $HOME> unset LYX_DIR_13x

Let's see if the locale dir can be set using the environment variable way:

angus $HOME> export LYX_LOCALEDIR=/foo
angus $HOME> ./test-lyx -dbg init -sysdir /usr/local/share/lyx

        Checking whether LyX is run in place... no
        Invalid LYX_LOCALEDIR environment variable.
        /foo is not a directory.

        binary_dir /home/angus/
        system_support /usr/local/share/lyx
        build_support
        user_support /home/angus/.lyx-1.3.6cvs/
        locale_dir
        document_dir /home/angus
        temp_dir /tmp
        home_dir /home/angus

angus $HOME> export LYX_LOCALEDIR=/usr/local/share/test-locale
angus $HOME> ./test-lyx -dbg init -sysdir /usr/local/share/lyx

        Checking whether LyX is run in place... no

        binary_dir /home/angus/
        system_support /usr/local/share/lyx
        build_support
        user_support /home/angus/.lyx-1.3.6cvs/
        locale_dir /usr/local/share/test-locale
        document_dir /home/angus
        temp_dir /tmp
        home_dir /home/angus

Yes, that all works.

Let's try messing around with the userdir. First, let's put stuff back in
the expected locations and check that all is still Ok.

angus $HOME> rm -f ./test-lyx
angus $HOME> su
root $HOME> cd /usr/local/share
root /usr/local/share> mv lyx lyx-1.3.6cvs
root /usr/local/share> mv test-locale locale
root /usr/local/share> exit
angus $HOME> lyx-1.3.6cvs -dbg init

        Checking whether LyX is run in place... no
        Invalid LYX_DIR_13x environment variable.
        Directory /usr/local/share/lyx does not contain chkconfig.ltx.
        Invalid LYX_LOCALEDIR environment variable.
        /usr/local/share/test-locale is not a directory.

        binary_dir /usr/local/bin/
        system_support /usr/local/share/lyx-1.3.6cvs/
        build_support
        user_support /home/angus/.lyx-1.3.6cvs/
        locale_dir /usr/local/share/locale/
        document_dir /home/angus
        temp_dir /tmp
        home_dir /home/angus

So, all is found correctly once again, but I should unset some environment
variables.

angus $HOME> unset LYX_DIR_13x LYX_LOCALEDIR

Thereafter, those particular warnings no longer appear. Onto the userdir.

angus $HOME> rm -fr $HOME/.lyx-1.3.6cvs
angus $HOME> lyx-1.3.6cvs -dbg init

        ...
        LyX: Creating directory /home/angus/.lyx-1.3.6cvs/ and 
        running configure...

angus $HOME> rm -fr $HOME/.lyx-1.3.6cvs
angus $HOME> lyx-1.3.6cvs -dbg init -userdir foo

A little dialog pops up

        You have specified a non-existent user LyX directory.
        It is needed to keep your own configuration.
        Should I try to set it up for you? I'll exit if "No".

 [ Yes ]

LyX creates a directory $HOME/foo and continues as normal.

angus $HOME> rm -rf foo
angus $HOME> lyx-1.3.6cvs -dbg init -userdir foo

        You have specified a non-existent user LyX directory.
        It is needed to keep your own configuration.
        Should I try to set it up for you? I'll exit if "No".

        [ No ]

        No user LyX directory. Exiting.

angus $HOME> lyx-1.3.6cvs -dbg init -userdir /foo

        You have specified a non-existent user LyX directory.
        It is needed to keep your own configuration.
        Should I try to set it up for you? I'll exit if "No".

        [ Yes ]

        LyX: Creating directory /foo and running configure...

A little dialog pops up

        Error! Couldn't create directory:
        /foo
        Permision denied.

        [ OK ]

        Failed to create directory. Exiting.

So, all those tests seem to work as expected.

Let's try out the LYX_USERDIR_13x environment variable.

angus $HOME> export LYX_USERDIR_13x=foo
angus $HOME> lyx-1.3.6cvs -dbg init 

        You have specified a non-existent user LyX directory.
        It is needed to keep your own configuration.
        Should I try to set it up for you? I'll exit if "No".

        [ No ]

        No user LyX directory. Exiting.

So that seems to work as well.

All tests passed successfully, IMO.

-- 
Angus

Attachment: package_13x.diff.bz2
Description: BZip2 compressed data

Reply via email to