Subversion

Contents

環境

公式ページ


 

 

サーバの構築



iptables


iptablesについて

HTTP、HTTPSはデフォルトでは閉じられているため、ポートを開放する必要がある。
次のように編集する。

vi /etc/sysconfig/iptables

IPアドレスの制限をせず、標準のHTTP、HTTPSポートを使用する場合は以下を追記する。
(-A INPUT -j REJECT –reject-with icmp-host-prohibitedより前に記述する)

-A INPUT -p tcp --dport 3690 -j ACCEPT
-A INPUT -p tcp --dport http -j ACCEPT
-A INPUT -p tcp --dport https -j ACCEPT

再起動して反映させる。(reloadでは反映されない)

service iptables restart





Subversion環境の構築

 

インストール

 

ソースコードからインストール


過去のバージョンを使用したい場合はこちら

  1. 関連パッケージをインストールする
    1. コンパイラをインストールする
      yum install gcc

 

  1. ダウンロードサイト:http://subversion.apache.org/download/からアーカイブのURLを取得する
  2. ダウンロードする
    wget http://ftp.yz.yamagata-u.ac.jp/pub/network/apache/subversion/subversion-1.8.8.tar.gz
  3. アーカイブファイルを展開する
    tar xzfv subversion-*.tar.gz
  4. SQLiteを用意する
    1. SQLiteをダウンロードする
      wget https://sqlite.org/2014/sqlite-amalgamation-3080403.zip
    2. 展開する
      unzip sqlite-amalgamation-*.zip
    3. Subversionソースコードディレクトリへ移動させる
      mv sqlite-amalgamation-3080403 subversion-1.8.8/sqlite-amalgamation
    4. ダウンロードしたファイルは削除する
      rm -f sqlite-amalgamation-*.zip
  5. ソースコードディレクトリへ移動する
    cd subversion-*
  6. コンパイル最適化設定を行う
    export CFLAGS="-O3 -m64"
  7. configure設定を行う
    ./configure --prefix=/usr/local/`pwd | sed "s/.*\///"` 2>&1 | tee configure.log.`date +"%Y%m%d"`
    使用できる設定内容は以下のとおり

    [root@subversion1 subversion-1.8.8]# ./configure --help
    `configure' configures subversion 1.8.8 to adapt to many kinds of systems.
    
    Usage: ./configure [OPTION]... [VAR=VALUE]...
    
    To assign environment variables (e.g., CC, CFLAGS...), specify them as
    VAR=VALUE.  See below for descriptions of some of the useful variables.
    
    Defaults for the options are specified in brackets.
    
    Configuration:
      -h, --help              display this help and exit
          --help=short        display options specific to this package
          --help=recursive    display the short help of all the included packages
      -V, --version           display version information and exit
      -q, --quiet, --silent   do not print `checking ...' messages
          --cache-file=FILE   cache test results in FILE [disabled]
      -C, --config-cache      alias for `--cache-file=config.cache'
      -n, --no-create         do not create output files
          --srcdir=DIR        find the sources in DIR [configure dir or `..']
    
    Installation directories:
      --prefix=PREFIX         install architecture-independent files in PREFIX
                              [/usr/local]
      --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                              [PREFIX]
    
    By default, `make install' will install all the files in
    `/usr/local/bin', `/usr/local/lib' etc.  You can specify
    an installation prefix other than `/usr/local' using `--prefix',
    for instance `--prefix=$HOME'.
    
    For better control, use the options below.
    
    Fine tuning of the installation directories:
      --bindir=DIR            user executables [EPREFIX/bin]
      --sbindir=DIR           system admin executables [EPREFIX/sbin]
      --libexecdir=DIR        program executables [EPREFIX/libexec]
      --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
      --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
      --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
      --libdir=DIR            object code libraries [EPREFIX/lib]
      --includedir=DIR        C header files [PREFIX/include]
      --oldincludedir=DIR     C header files for non-gcc [/usr/include]
      --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
      --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
      --infodir=DIR           info documentation [DATAROOTDIR/info]
      --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
      --mandir=DIR            man documentation [DATAROOTDIR/man]
      --docdir=DIR            documentation root [DATAROOTDIR/doc/subversion]
      --htmldir=DIR           html documentation [DOCDIR]
      --dvidir=DIR            dvi documentation [DOCDIR]
      --pdfdir=DIR            pdf documentation [DOCDIR]
      --psdir=DIR             ps documentation [DOCDIR]
    
    System types:
      --build=BUILD     configure for building on BUILD [guessed]
      --host=HOST       cross-compile to build programs to run on HOST [BUILD]
      --target=TARGET   configure for building compilers for TARGET [HOST]
    
    Optional Features:
      --disable-option-checking  ignore unrecognized --enable/--with options
      --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
      --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
      --enable-sqlite-compatibility-version=X.Y.Z
                              Allow binary to run against SQLite as old as ARG
      --enable-shared[=PKGS]  build shared libraries [default=yes]
      --enable-static[=PKGS]  build static libraries [default=yes]
      --enable-fast-install[=PKGS]
                              optimize for fast installation [default=yes]
      --disable-libtool-lock  avoid locking (might break parallel builds)
      --enable-experimental-libtool
                              Use APR's libtool
      --enable-static         Build static libraries
      --enable-shared         Build shared libraries
      --enable-all-static     Build completely static (standalone) binaries.
      --enable-local-library-preloading
                              Enable preloading of locally built libraries in
                              locally built executables. This may be necessary for
                              testing prior to installation on some platforms. It
                              does not work on some platforms (Darwin, OpenBSD,
                              ...).
      --enable-bdb6           Allow building against BDB 6+. See
                              --with-berkeley-db for specifying the location of
                              the Berkeley DB installation. Using BDB 6 will fail
                              if this option is not used.
      --disable-keychain      Disable use of Mac OS KeyChain for auth credentials
      --enable-ev2-impl       Use Ev2 implementations, where available
                              [EXPERIMENTAL]
      --disable-nls           Disable gettext functionality
      --disable-plaintext-password-storage
                              Disable on-disk caching of plaintext passwords and
                              passphrases. (Leaving this functionality enabled
                              will not force Subversion to store passwords in
                              plaintext, but does permit users to explicitly allow
                              that behavior via runtime configuration.)
      --enable-debug          Turn on debugging
      --enable-optimize       Turn on optimizations
      --enable-disallowing-of-undefined-references
                              Use -Wl,--no-undefined flag during linking of some
                              libraries to disallow undefined references
      --enable-maintainer-mode
                              Turn on debugging and very strict compile-time
                              warnings
      --disable-full-version-match
                              Disable the full version match rules when checking
                              Subversion library compatibility.
      --enable-mod-activation Enable mod_dav_svn in httpd.conf
      --enable-gcov           Turn on gcov coverage testing (GCC only).
      --enable-gprof          Produce gprof profiling data in 'gmon.out' (GCC
                              only).
      --enable-runtime-module-search
                              Turn on dynamic loading of RA/FS libraries including
                              third-party FS libraries
      --enable-javahl         Enable compilation of Java high-level bindings
                              (requires C++)
    
    Optional Packages:
      --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
      --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
      --with-apr=PATH         prefix for installed APR, path to APR build tree,
                              or the full path to apr-config
      --with-apr-util=PATH    prefix for installed APU, path to APU build tree,
                              or the full path to apu-config
      --with-serf=PREFIX      Serf HTTP client library (enabled by default if
                              found)
      --with-apr_memcache=PREFIX
                              Standalone apr_memcache client library
      --with-apxs[=FILE]      Build shared Apache modules. FILE is the optional
                              pathname to the Apache apxs tool; defaults to
                              "apxs".
      --with-apache-libexecdir[=PATH]
                              Install Apache modules to Apache's configured
                              modules directory instead of LIBEXECDIR; if PATH is
                              given, install to PATH.
      --with-sqlite=PREFIX    Use instmalled SQLite library or amalgamation file.
      --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                              both]
      --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
      --with-sysroot=DIR Search for dependent libraries within DIR
                            (or the compiler's sysroot if not specified).
      --with-trang=PATH       Specify the command to run the trang schema
                              converter
      --with-doxygen=PATH     Specify the command to run doxygen
      --with-expat=INCLUDES:LIB_SEARCH_DIRS:LIBS
                              Specify location of Expat
      --with-berkeley-db[=HEADER:INCLUDES:LIB_SEARCH_DIRS:LIBS]
                              The Subversion Berkeley DB based filesystem library
                              requires Berkeley DB $db_version or $db_alt_version.
                              If you specify `--without-berkeley-db', that library
                              will not be built. If you omit the argument of this
                              option completely, the configure script will use
                              Berkeley DB used by APR-UTIL.
      --with-sasl=PATH        Compile with libsasl2 in PATH
      --without-gpg-agent     Disable support for GPG-Agent
      --with-gnome-keyring    Enable use of GNOME Keyring for auth credentials
                              (enabled by default if found)
      --with-libmagic=PREFIX  libmagic filetype detection library
      --with-kwallet[=PATH]   Enable use of KWallet (KDE 4) for auth credentials
      --with-openssl          This option does NOT affect the Subversion build
                              process in any way. It tells an integrated Serf HTTP
                              client library build process where to locate the
                              OpenSSL library when (and only when) building Serf
                              as an integrated part of the Subversion build
                              process. When linking to a previously installed
                              version of Serf instead, you do not need to use this
                              option.
      --with-editor=PATH      Specify a default editor for the subversion client.
      --with-zlib=PREFIX      zlib compression library
      --with-jdk=PATH         Try to use 'PATH/include' to find the JNI headers.
                              If PATH is not specified, look for a Java
                              Development Kit at JAVA_HOME.
      --with-jikes=PATH       Specify the path to a jikes binary to use it as your
                              Java compiler. The default is to look for jikes
                              (PATH optional). This behavior can be switched off
                              by supplying 'no'.
      --with-swig=PATH        Try to use 'PATH/bin/swig' to build the swig
                              bindings. If PATH is not specified, look for a
                              'swig' binary in your PATH.
      --with-ruby-sitedir=SITEDIR
                              install Ruby bindings in SITEDIR (default is same as
                              ruby's one)
      --with-ruby-test-verbose=LEVEL
                              how to use output level for Ruby bindings tests
                              (default is normal)
      --with-ctypesgen=PATH   Specify the path to ctypesgen. This can either be
                              the full path to a ctypesgen installation, the full
                              path to a ctypesgen source tree or the full path to
                              ctypesgen.py.
      --with-junit=PATH       Specify a path to the junit JAR file.
    
    Some influential environment variables:
      CC          C compiler command
      CFLAGS      C compiler flags
      LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
                  nonstandard directory <lib dir>
      LIBS        libraries to pass to the linker, e.g. -l<library>
      CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
                  you have headers in a nonstandard directory <include dir>
      CXX         C++ compiler command
      CXXFLAGS    C++ compiler flags
      CPP         C preprocessor
      CXXCPP      C++ preprocessor
    
    Use these variables to override the choices made by `configure' or to help
    it to find libraries and programs with nonstandard names/locations.
    
    Report bugs to <http://subversion.apache.org/>.
  8. エラーが出なかった場合、インストールを行う
    make 2>&1 | tee make.log.`date +"%Y%m%d"`
    make install 2>&1 | tee make_install.log.`date +"%Y%m%d"`
  9. リンク作成、環境変数設定などを行う
    1. インストールディレクトリへのシンボリックリンクを作成する。
      これによって、複数のバージョンを同居させ、リンクを切り替えることで、バージョン変更が可能となる。
      各バージョンの実行ファイルはデフォルトでは各バージョンの設定ファイルを読み込むこととなる。
      ln -s /usr/local/subversion-`pwd | sed "s/.*\///"` /usr/local/subversion
  10. 共通した環境とするために環境変数を設定する
    export SUBVERSION_HOME=/usr/local/subversion
  11. ツール類にパスを通す
    export PATH=$SUBVERSION_HOME/bin:$PATH
    1. 環境変数を再起動後も有効にする
      echo "" >> /etc/bashrc
      echo "# SUBVERSION ENVIRONMENT VARIABLE" >> /etc/bashrc
      echo "export SUBVERSION_HOME=$SUBVERSION_HOME" >> /etc/bashrc
      echo "export PATH=\$SUBVERSION_HOME/bin:\$PATH" >> /etc/bashrc
  12. インストールに使用したパッケージを削除する
    cd ../
    rm -rf subversion-*
  13. リポジトリ管理用のディレクトリを作成する
    mkdir -p /usr/local/data/svn-repository

 

サーバの設定


Subversionをサーバとして使用するにはApache HTTPD経由と、Subversion専用サーバのsvnserve経由の方法がある。
使用する方の設定を以下で行う。

Apacheの設定

 

vi $APACHE_HOME/conf/httpd.conf

 

LoadModule dav_module modules/mod_dav.so
<IfModule dav_module>
	
	LoadModule dav_svn_module /usr/local/subversion/libexec/mod_dav_svn.so
	
	<IfModule dav_svn_module>
	
		LoadModule authz_svn_module /usr/local/subversion/libexec/mod_authz_svn.so
		
		<IfModule authz_svn_module>
		
			<Location /svn>
				DAV svn
				SVNParentPath "/usr/local/data/svn-repository"
			</Location>
		
		</IfModule>
	</IfModule>
</IfModule>




svnserveの設定

 

 

 

Tracの利用


プロジェクト管理ツールのTracをインストールすることで、Subversionで管理しているコンテンツの最新版や差分内容を
WEBブラウザで閲覧することができる。

Trac:http://trac.edgewall.org/

Tracのインストール

 

  1. Tracをインストールする
    1. 次のURLから最新版のTracのダウンロードURLを確認する
      http://trac.edgewall.org/wiki/TracDownload#LatestStableRelease
    2. ダウンロードする
      wget http://download.edgewall.org/trac/Trac-1.0.1.tar.gz
  2. アーカイブファイルを展開する
    tar xvzf Trac-*.tar.gz
  3. ソースコードディレクトリへ移動する
    cd Trac-*
  4. setuptoolsをインストールする
    wget http://peak.telecommunity.com/dist/ez_setup.py
    python ez_setup.py
  5. Tracをインストールする
    python ./setup.py install
  6. インストールに使用したパッケージを削除する
    cd ../
    rm -rf Trac-*
  7. Tracデータ用ディレクトリを作成する
    mkdir /usr/local/data/trac

 

Subversionと同期


Subversionと同期させるためには、リポジトリを再作成する必要がある。
最新版のSubversionではTracに対応していないためである。

 

WEBサーバの起動

 

Apache経由での利用



tracdによる起動


TracにはTrac専用のWEBサーバツールのtracdが含まれる。
これを起動することで、HTTPアクセスが可能となる。
なお、起動時に複数のtracのパスを指定することで、単一のデーモンで複数のtracプロジェクトを閲覧することができる

 



トラブルシューティング

 

エラーメッセージ

 

 

 

 





コマンド

 

svn

 

チェックアウト

 

svn co <URL>

 

新規フォルダ・ファイル追加

 

svn add <対象フォルダ/ファイル>

フォルダを指定した場合、子階層以下も全て対象となる

コミット

 

svn commit -m "<コメント>"

 

ファイル一覧表示

 

svn list <URL>

 

特定パスを更新から除外

 

svn up --set-depth exclude <パス>

実行後commitが必要になるので、最新状態で行う必要がある。

svnadmin

 

crashtest

 

create

 

deltify

 

dump

 

freeze

 

help (?, h)

 

hotcopy

 

list-dblogs

 

list-unused-dblogs

 

load

 

lock

 

lslocks

 

lstxns

 

pack

 

recover

 

rmlocks

 

rmtxns

 

setlog

 

setrevprop

 

setuuid

 

unlock

 

upgrade

 

verify




svndumpfilter

 

svnlook

 

svnmucc

 

svnrdump

 

svnserve

 

svnsync

 

svnversion




Subversionの運用

 

リポジトリの作成

 

  1. リポジトリ用のディレクトリを作成する
    svnadmin create /usr/local/data/svn-repository/<リポジトリ名>
  2. オーナーを変更する
    chown -R svn:svn /usr/local/data/svn-repository/<リポジトリ名>
  3. 正常に作成できたか確認する
    svn list svn://localhost/<リポジトリ名>
    何も表示されなければ正常である。
    プロトコルはHTTP使用の場合はhttp://~とする。

 

リポジトリの設定変更


設定はブロックごとに分かれており、各設定は適切なブロックに記述する。
設定ファイルは各リポジトリのディレクトリ内の、以下のパスに存在する。

conf/svnserve.conf

confフォルダ内のほかのファイルはこの設定ファイルで設定することで、読み出される。


全般的な設定

 

 

 

 

 

 

ユーザに関する設定


この設定はpassword-db設定を行ったうえ、別ファイル内に記述する必要がある。

 

 

SASL

 

[sasl]
[default]
[pre-commit]
[aliases]
[groups]

hookスクリプトの作成


Commit前後など、サーバにアクセスした際のあるタイミングで任意のスクリプトを実行することができる。

スクリプト一覧


スクリプトは各ディレクトリのhookフォルダ内に作成する。
デフォルトでテンプレートファイルが作成されており、各ファイル名の .tmpl を取り除くことで実行することができる。
テンプレートをコピーするなどして作る場合は、実行権限を与える必要がある。

 

 

スクリプトの作成




Tips

 

コミット時にアップデート(デプロイ)する

 


Notice: Trying to get property 'queue' of non-object in /usr/local/wordpress/wp-includes/script-loader.php on line 2876

Warning: Invalid argument supplied for foreach() in /usr/local/wordpress/wp-includes/script-loader.php on line 2876