[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn import fails (almost same problem) + script

From: Alexis Huxley <ahuxley_at_gmx.net>
Date: 2002-04-10 23:05:43 CEST

Hi everyone ...

> Ah, now I'm very embarrased. The permissions on /usr/local/svnroot were
> too restrictive.
>
> Thanks for all the help. Now it seems to be working.

No such luck for me: I even tried chmod -R 777 on my repository but
it made no difference :-(

Since I've tried it about five thousand times now (ok, slight
exaggeration ;-) I put the whole sequence in a script, from the
download to the tests. I've put it below, in the hope that it will
help you help me, and might, perhaps, help others.

It boils down to the following errors; doing this:

    svn import file://$SVN_REPOSITORY_ROOT . <arbitrary-name>
    
gives this:

    svn_error: #21093 : <Couldn't find a repository.>
    Unable to open an ra_local session to URL
    
    svn_error: #21093 : <Couldn't find a repository.>
    svn_ra_local__split_URL: Unable to find valid repository

and doing this:

    svn import http://localhost/repos/svn . <arbitrary-name>

gives this:
    
    svn_error: #21091 : <RA layer didn't receive requested OPTIONS info>
    The OPTIONS response did not include the requested activity-collection-set.
    (Check the URL again; this often means that the URL is not
    WebDAV-enabled.)

All the 'make check' tests pass.

'svn --version' reports:

    Subversion Client, version 0.10.2 (dev build)
       compiled Apr 10 2002, 20:53:07
    
    Copyright (C) 2000-2002 CollabNet.
    Subversion is open source software, see http://subversion.tigris.org/
    
    The following repository access (RA) modules are available:
    
    * ra_dav : Module for accessing a repository via WebDAV (DeltaV)
    * protocol.
      - handles 'http' schema
    * ra_local : Module for accessing a repository on local disk.
      - handles 'file' schema

And the apache2 startup seems fine:

    [Wed Apr 10 22:33:42 2002] [notice] Apache/2.0.36-dev (Unix)
    mod_ssl/2.0.36-dev OpenSSL/0.9.6c DAV/2 SVN/0.10.2 (dev build)
    configured -- resuming normal operations

Any advice would be much appreciated!

Alexis Huxley
ahuxley@gmx.net

----------------------------- cut here -------------------------------
#!/usr/bin/ksh
PROGNAME=`basename $0`
set -e

PREREQUISITE_PACKAGES="autoconf libtool cvs openssl libssl-dev"
# Use this binary to get the current SVN sources
SVN_CLIENT_BINARY_URL=ftp://marcus.debian.net/pub/svn/clients/linux/svn-1611-i386.bz2
# Stuff we'll need to download
DB4_SOURCES_URL=http://www.sleepycat.com/update/4.0.14/db-4.0.14.tar.gz
NEON_SOURCES_URL=http://www.webdav.org/neon/neon-0.19.3.tar.gz
TMP_DIR=/var/tmp
# Where am I going to build everything?
SVN_BUILD_ROOT=$TMP_DIR/$PROGNAME
# well, whaddayaknow, basename works on URLs :-)
SVN_CLIENT_BINARY=$SVN_BUILD_ROOT/svn-client-binary/`basename $SVN_CLIENT_BINARY_URL .bz2`
# Where will I make a test SVN repository?
SVN_REPOSITORY_ROOT=$TMP_DIR/svn-repository-test
# Where to SVN, DB4 and Apache2 get installed?
SVN_INSTALL_PREFIX=/usr/server/opt/svn
DB4_INSTALL_PREFIX=/usr/server/opt/db4
APACHE2_INSTALL_PREFIX=/usr/server/opt/apache2
# Who does the httpd process run as?
HTTP_USER=nobody
HTTP_GROUP=nogroup

main()
{
    # I uncomment these as I do the build.

    #check_prerequisites
    #make_directories
    setup_environment
    #make_db4
    #make_apache2
    #make_neon_no_compile
    #make_client_binary
    #make_svn
    #create_svn_repository
    #configure_apache2_for_svn
    #restart_apache2
    test_svn_import
}

info()
{
    echo "$PROGNAME: INFO: $1" >&2
}

error()
{
    echo "$PROGNAME: ERROR: $1" >&2
    exit 1
}

check_prerequisites()
{
    info "verifying all prerequisite packages installed ..."
    for PREREQUISITE_PACKAGE in $PREREQUISITE_PACKAGES; do
        dpkg -l $PREREQUISITE_PACKAGE
    done
}

make_directories()
{
    info "creating build root and subdirs ..."
    mkdir -p $SVN_BUILD_ROOT
    mkdir -p $SVN_BUILD_ROOT/svn-client-binary
}

setup_environment()
{
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$DB4_INSTALL_PREFIX/lib:$APACHE2_INSTALL_PREFIX/lib:$SVN_INSTALL_PREFIX/lib
    export PATH=$PATH:$APACHE2_INSTALL_PREFIX/bin:$SVN_INSTALL_PREFIX/bin
}

make_db4()
{
    mkdir -p $SVN_BUILD_ROOT/db4-sources
    cd $SVN_BUILD_ROOT/db4-sources

    info "downloading db sources from WWW site ..."
    lynx -dump $DB4_SOURCES_URL > `basename $DB4_SOURCES_URL`

    info "unpacking db4 sources ..."
    tar xzf `basename $DB4_SOURCES_URL`

    info "building db4 ..."
    cd `basename $DB4_SOURCES_URL .tar.gz`/build_unix
    ../dist/configure --prefix=$DB4_INSTALL_PREFIX
    make

    info "installing db4 ..."
    su root -c make install
}

make_apache2()
{
    mkdir -p $SVN_BUILD_ROOT/apache2-sources
    cd $SVN_BUILD_ROOT/apache2-sources

    info "downloading apache2 sources from CVS repository ..."
    cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic login
    cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co httpd-2.0
    cd httpd-2.0/srclib
    cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co apr
    cvs -d :pserver:anoncvs@cvs.apache.org:/home/cvspublic co apr-util
    cd ..

    info "building apache2 ..."
    ./buildconf
    ./configure --enable-dav --enable-so --prefix=$APACHE2_INSTALL_PREFIX \
        --with-dbm=db4 --with-berkeley-db=$DB4_INSTALL_PREFIX --enable-ssl
    make depend
    make

    info "installing apache2 ..."
    su root -c make install

    info "starting apache2 ..."
    su root -c ksh -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; sh $APACHE2_INSTALL_PREFIX/bin/apachectl start"
}

make_neon_no_compile()
{
    mkdir -p $SVN_BUILD_ROOT/neon-sources
    cd $SVN_BUILD_ROOT/neon-sources

    info "downloading neon sources from WWW site ..."
    lynx -dump $NEON_SOURCES_URL > `basename $NEON_SOURCES_URL`

    info "unpacking neon sources ..."
    tar xzf `basename $NEON_SOURCES_URL`
}

make_client_binary()
{
    mkdir $SVN_BUILD_ROOT/svn-client-binary
    cd $SVN_BUILD_ROOT/svn-client-binary

    info "downloading pre-compiled client binary from FTP site ..."
    # if ncftp is trying to download a file and it already exists then it is
    # not very polite about it. This will get round it.
    mkdir $TMP_DIR/$PROGNAME.$$
    cd $TMP_DIR/$PROGNAME.$$
    ncftpget -V $SVN_CLIENT_BINARY_URL
    mv `basename $SVN_CLIENT_BINARY_URL` $SVN_CLIENT_BINARY.bz2
    cd $SVN_BUILD_ROOT/svn-client-binary
    rmdir $TMP_DIR/$PROGNAME.$$
    info "unpacking pre-compiled client binary ..."
    bunzip2 -f $SVN_CLIENT_BINARY.bz2
    chmod 755 $SVN_CLIENT_BINARY
}

make_svn()
{
    mkdir -p $SVN_BUILD_ROOT/svn-sources
    cd $SVN_BUILD_ROOT/svn-sources

    #info "downloading latest subversion sources from SVN repository ..."
    #$SVN_CLIENT_BINARY checkout http://svn.collab.net/repos/svn/trunk -d svn
    cd svn

    #info "setting up symlinks for apr, aprutil and neon access ..."
    #ln -s $SVN_BUILD_ROOT/apache2-sources/httpd-2.0/srclib/apr .
    #ln -s $SVN_BUILD_ROOT/apache2-sources/httpd-2.0/srclib/apr-util .
    #ln -s $SVN_BUILD_ROOT/neon-sources/`basename $NEON_SOURCES_URL .tar.gz` neon

    #info "building svn ..."
    #sh ./autogen.sh
    #./configure --prefix=$SVN_INSTALL_PREFIX --enable-ssl \
    # --with-apxs=$APACHE2_INSTALL_PREFIX/bin/apxs \
    # --with-dbm=db4 --with-berkeley-db=$DB4_INSTALL_PREFIX
    #make clean
    #make
    #make check

    info "installing svn ..."
    su root -c ksh -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; make install"
}

create_svn_repository()
{
    info "creating SVN repository ..."
    #mkdir -p $SVN_REPOSITORY_ROOT
    su root -c ksh -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; svnadmin create $SVN_REPOSITORY_ROOT; chown -R $HTTP_USER:$HTTP_GROUP $SVN_REPOSITORY_ROOT"
}

configure_apache2_for_svn()
{
    info "adding SVN config info to end of apache2 config file ..."
    # 'su' won't allow redirection so put it in a temp file and then 'su'
    # can append that.
    cat > $TMP_DIR/$PROGNAME.$$.apache-svn-conf <<EOF
<Location /svn/repos>
    DAV svn
    SVNPath $SVN_REPOSITORY_ROOT
</Location>
EOF
    su root -c "cat $TMP_DIR/$PROGNAME.$$.apache-svn-conf >> $APACHE2_INSTALL_PREFIX/conf/httpd.conf"
}

restart_apache2()
{
    info "restarting apache2 ..."
    su root -c ksh -c "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH; export PATH=$PATH; apachectl stop; sleep 1; apachectl start"
}

test_svn_import()
{
    info "copying existing program ..."
    # 'ade' is a script I wrote and here try to import
    mkdir $TMP_DIR/$PROGNAME.$$.ade_src_copy
    ( cd $HOME/dev/active/ade && tar cf - . ) | ( cd $TMP_DIR/$PROGNAME.$$.ade_src_copy )

    info "tidying up copy (in preparation for svn import) ..."
    cd $TMP_DIR/$PROGNAME.$$.ade_src_copy
    find . -name RCS | xargs rm -fr

    info "doing ra_local import ..."
    # The following command ...
    svn import file://$SVN_REPOSITORY_ROOT . ade || true
    sleep 3 # don't let editor in next svn clear screen too soon

    # ... fails with the following message:
    #
    # svn_error: #21093 : <Couldn't find a repository.>
    # Unable to open an ra_local session to URL
    #
    # svn_error: #21093 : <Couldn't find a repository.>
    # svn_ra_local__split_URL: Unable to find valid repository

    info "doing ra_dav import ..."
    # The following command ...
    svn import http://localhost/repos/svn . ade || true
    sleep 3 # don't let editor in next svn clear screen too soon

    # ... fails with the following message:
    #
    # svn_error: #21091 : <RA layer didn't receive requested OPTIONS info>
    # ....

    info "tidying up after test ..."
    cd $SVN_BUILD_ROOT
    rm -fr $TMP_DIR/$PROGNAME.$$.ade_src_copy
}

# Do it!
main "$@"
----------------------------- cut here -------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Apr 10 23:06:37 2002

This is an archived mail posted to the Subversion Dev mailing list.