Changeset 82

Show
Ignore:
Timestamp:
06/19/07 17:53:52 (2 years ago)
Author:
mbailey
Message:

svn_install now builds python bindings (with swig) which are required by trac

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1-7-stable/lib/deprec/recipes/svn.rb

    r73 r82  
    11require 'fileutils' 
     2require 'uri' 
    23 
    34Capistrano.configuration(:must_exist).load do 
     
    1011  # however the SVN docs convinced me it's probably overkill. 
    1112  # http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.serverconfig.pathbasedauthz 
     13  # 
    1214  set :scm_group, 'scm' 
    1315   
    14   set :svn_root, '/usr/local/svn' 
     16  # The following values define the svn repository to work with. 
     17  # If any are undefined but :repository is set, we'll extract the  
     18  # necessary values from it, otherwise we'll prompt the user. 
     19  #  
     20  # An example of :repository entries are: 
     21  # 
     22  #   set :repository, 'svn+ssh://scm.deprecated.org/var/svn/deprec/trunk' 
     23  #   set :repository, 'file:///tmp/svn/deprec/trunk' 
     24  # 
     25  # I've only used svn+ssh but it shouldn't be hard to get the file scheme working. 
     26  # 
     27  set (:svn_scheme) do 
     28    repository ? URI.parse(repository).scheme : 'svn+ssh' 
     29  end 
    1530   
     31  set (:scm_host) do 
     32    if repository 
     33      URI.parse(repository).host || 'localhost' 
     34    elsif ENV['HOSTS'] 
     35      svn_host = ENV['HOSTS'] 
     36    else 
     37      Capistrano::CLI.password_prompt('svn host: ') 
     38    end 
     39  end 
     40 
     41  # This is the actual path in the svn repos where we'll check our project into 
     42  set (:repos_path) do 
     43    repository ? URI.parse(repository).path : Capistrano::CLI.password_prompt('svn repos path: ') 
     44  end 
     45 
     46  # We'll calculate this based on the repos_path. It's used when initializing the repository 
     47  set (:repos_root) do 
     48    (repository ? URI.parse(repository).path : repos_path).sub(/\/(trunk|tags|branches)$/, '') 
     49  end 
    1650   
     51  # XXX sudo apt-get install swig python-dev 
     52  # XXX requires apache already installed... 
    1753  desc "install Subversion version control system" 
    18   task :install_svn do 
     54  task :svn_install do 
    1955    # svn 1.4 server improves on 1.3 and is backwards compatible with 1.3 clients 
    2056    # http://subversion.tigris.org/svn_1.4_releasenotes.html 
     
    2359    # http://svnbook.red-bean.com/nightly/en/svn-book.html#svn.reposadmin.basics.backends 
    2460    # 
    25     version = 'subversion-1.4.3' 
     61    # NOTE: we're bulding the python bindings for trac 
     62    # ./subversion/bindings/swig/INSTALL 
     63    # 
     64    version = 'subversion-1.4.4' 
    2665    set :src_package, { 
    2766      :file => version + '.tar.gz',    
    28       :md5sum => '6b991b63e3e1f69670c9e15708e40176 subversion-1.4.3.tar.gz',  
     67      :md5sum => '702655defa418bab8f683f6268b4fd30  subversion-1.4.4.tar.gz',  
    2968      :dir => version,   
    3069      :url => "http://subversion.tigris.org/downloads/#{version}.tar.gz", 
     
    3675        --with-apr=/usr/local/apache2  
    3776        --with-apr-util=/usr/local/apache2 
     77        PYTHON=/usr/bin/python 
    3878        ; 
    3979        ).reject{|arg| arg.match '#'}.join(' ') , # DRY this up 
    4080      :make => 'make;', 
    41       :install => 'make install;' 
     81      :install => 'make install;', 
     82      :post_install => ' 
     83        make swig-py;  
     84        make install-swig-py; 
     85        echo /usr/local/lib/svn-python > /usr/lib/python2.4/site-packages/subversion.pth; 
     86        ' 
    4287    } 
    43     apt.install( {:base => %w(libneon25 libneon25-dev)}, :stable ) 
     88    enable_universe 
     89    apt.install( {:base => %w(libneon25 libneon25-dev swig python-dev)}, :stable ) 
    4490    deprec.download_src(src_package, src_dir) 
    4591    deprec.install_from_src(src_package, src_dir) 
    4692  end 
    4793   
    48   desc "create a repository and import a project" 
    49   task :svn_create_repos, :roles => :scm do 
    50     svn_repos ||= "#{svn_root}/#{application}" 
     94  task :scm_setup do # deprecated 
     95    svn_import_project 
     96  end 
     97   
     98  desc "Create subversion repository and import project into it" 
     99  task :svn_import_project, :roles => scm do 
     100    svn_create_repos 
     101    svn_import 
     102  end 
     103   
     104  desc "Create a subversion repository" 
     105  task :svn_create_repos, :roles => scm do 
    51106    deprec.groupadd(scm_group)  
    52107    deprec.add_user_to_group(user, scm_group) 
    53     deprec.mkdir(svn_root, :mode => '0755') 
    54     deprec.mkdir(svn_repos, :mode => '2775', :group => scm_group) 
    55     sudo "svnadmin verify #{svn_repos} > /dev/null 2>&1 || sudo svnadmin create #{svn_repos}" 
    56     sudo "chmod -R g+w #{svn_repos}" 
     108    # deprec.mkdir(svn_root, :mode => '0755') 
     109    deprec.mkdir(repos_root, :mode => '2775', :group => scm_group) 
     110    sudo "svnadmin verify #{repos_root} > /dev/null 2>&1 || sudo svnadmin create #{repos_root}" 
     111    sudo "chmod -R g+w #{repos_root}" 
    57112  end 
    58  
    59   # XXX check through and test the next two [mike] 
    60113   
    61   # from Bradley Taylors RailsMachine gem 
    62   desc "Import code into svn repository." 
    63   task :svn_import  do 
     114  # Adapted from code in Bradley Taylors RailsMachine gem 
     115  desc "Import project into subversion repository." 
     116  task :svn_import, :roles => scm do  
     117    repository ||= "#{svn_scheme}://#{scm_host == 'localhost' ? '/' : scm_host}/#{repos_path}"    
    64118    new_path = "../#{application}" 
    65119    tags = repository.sub("trunk", "tags") 
     
    76130    system "svn co #{repository} #{application}" 
    77131    Dir.chdir application 
    78     puts "removing log directory contents from svn" 
    79     system "svn remove log/*" 
    80     puts "ignoring log directory" 
    81     system "svn propset svn:ignore '*.log' log/" 
    82     system "svn update log/" 
    83     puts "removing tmp directory from svn" 
    84     system "svn remove tmp/" 
    85     puts "ignoring tmp directory" 
    86     system "svn propset svn:ignore '*' tmp/" 
    87     system "svn update tmp/" 
    88     puts "committing changes" 
    89     system "svn commit -m 'Removed and ignored log files and tmp'" 
     132    svn_remove_log_and_tmp 
    90133    puts "Your repository is: #{repository}"  
    91134  end 
    92135   
    93   # from Bradley Taylors RailsMachine gem 
     136  # Lifted from Bradley Taylors RailsMachine gem 
    94137  desc "remove and ignore log files and tmp from subversion" 
    95138  task :svn_remove_log_and_tmp do