automatic update of WordPress with svn

My automatic upgrade had last night a bit of a problem. A change which required user-interaction was the problem. The following ruby code deal with this problem:

—-

#!ruby -W0

@doc = 'http://svn.automattic.com/wordpress/tags/'
@pathtoupdate = "/www/www.web-dreamer.de/wordpress/trunk"

#puts @doc
@tags = %x[svn list #{@doc}]
# puts @tags
@ltags = @tags.split(/\n/)
# puts @ltags.last

@doc.concat(@ltags.last)
@upgrade = %x[svn --non-interactive sw #{@doc} #{@pathtoupdate}]
#puts @upgrade

or this

#!/usr/bin/perl -w
# This litte script is related to this page
# http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion

#While i was tired of updating my wordpress installation but also don't want
#to use the development tree i choosed to code a little script.
#This will work with a little change on the xpath/expression
#with every svn server which posts itself to http
# (c) 2008 Johannes Rumpf / posted under the apache licence

  use strict;
  use HTML::TreeBuilder::XPath;
  use LWP::Simple;

#configure the SVN http server
  my $site = "http://svn.automattic.com/wordpress/tags/";
  my $pathtoupdate = "//www/www.web-dreamer.de/wordpress/trunk";
# receive svn information about the main-revisions.
  my $content = get($site);
  die "get failed" if (!defined $content);

#build xpath parse-able tree
  my $tree= HTML::TreeBuilder::XPath->new_from_content($content);
# The following XPATH expression evaluates the last of the and get backs the contents
# of  tag
  my $nb=$tree->findvalue( '//li[last()]/a');
#  print $nb; # prints f.e. 2.6.1/ just for test purpose

#switch (sw): Update the working copy to a different URL.
#usage: 1. switch URL [PATH]
#       2. switch --relocate FROM TO [PATH...]
#
#  1. Update the working copy to mirror a new URL within the repository.
#     This behaviour is similar to 'svn update', and is the way to
#     move a working copy to a branch or tag within the same repository.

#$nb could be used for executing bad things so delete pipes, semikolons and all bad isues.
#$nb = 'bad bad bubu'.$nb.';exec(dirt;)'; # if you have letters you may want to use this
#$nb =~ s/[^a-zA-Z0-9\.\/]//gi; #delete all what is not a letter, a digit, a point or a
# slash
$nb =~ s/[^0-9\.\/]//gi; #delete all what is not a digit a point or a slash

my $commandline = "svn --non-interactive sw ".$site.$nb." ".$pathtoupdate;
#  print $commandline;
exec ($commandline)   or print STDERR "couldn't exec $commandline: $!";

Update: Last night these scripts run into a problem. I haven’t debugged yet what the problem was. I will give you an update as soon as possible.

Hinterlasse eine Antwort