From 4eae593f838ceb599e2568f6abe1edaf3d9c0273 Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Fri, 6 May 2005 09:06:27 +0000 Subject: [PATCH] Fix bug with updating modules not using checkout-only. I'm not sure why it was working for me before, because there's no reason it should have. Change default anon server to use svn:// instead of https://. Include auto-repo-switching functionality so that people who have already checked out code using the default won't have to life a finger. svn path=/trunk/kdenonbeta/kdecvs-build/; revision=409957 --- HISTORY | 9 +++++++ kdesvn-build | 58 ++++++++++++++++++++++++++++++------------- kdesvn-buildrc-sample | 2 +- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/HISTORY b/HISTORY index 3633f24..7b5d60a 100644 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,12 @@ +Version history: 0.91 + * Use svn://anonsvn.kde.org/ instead of https://anonsvn.kde.org/ by default. + * Automatically switch repositories if the user (or script) changes the value + of svn-server. + * Fix updating modules not using checkout-only, I'm not sure why this worked + sometimes for me before. This area of code could use some definite cleanup, + I may spend a few hours tomorrow learning Perl objects to clean this crap + up. + Version history: 0.90 * Initial public release of kdesvn-build. * The release-tag option is broken for now. Everything you build will be diff --git a/kdesvn-build b/kdesvn-build index e520d66..d57e209 100755 --- a/kdesvn-build +++ b/kdesvn-build @@ -59,7 +59,7 @@ my %global_opts = ( "set-env" => { }, # Hash of environment vars to set "source-dir" => "$ENV{HOME}/kdesvn", "stop-on-failure" => "", - "svn-server" => "https://anonsvn.kde.org/home/kde", + "svn-server" => "svn://anonsvn.kde.org/home/kde", "use-unsermake" => "1", # Default to true now, we may need a blacklist ); @@ -1390,6 +1390,24 @@ sub check_for_extragear chdir($base); # Go to src dir } +# Subroutine to switch repos to a different one if necessary. +# First and only parameter is the new repo url +sub switch_repo_url +{ + my $svnroot = shift; + + if (not pretending) + { + my $repo_url = get_repo_url(); + + if($repo_url ne $svnroot) + { + print "${YELLOW}Repository URL has changed, updating${NORMAL}.\n"; + system('svn', 'switch', '--relocate', $repo_url, $svnroot); + } + } +} + # Subroutine to check out a specific set of directories from a module, # instead of recursively checking out the entire module. # The first parameter is the module to check out. The subroutine will @@ -1424,6 +1442,9 @@ sub checkout_svn_partial my $modulename = $module; $modulename =~ s/^([^\/]*\/)//; push @args, $modulename; + + # switch repos if necessary + switch_repo_url($svnroot); } else { @@ -1584,27 +1605,19 @@ sub handle_updates # checked out. print "Updating ${GREEN}$module${NORMAL}\n"; - # The admin directory SCREWS crap up though, make sure it's - # installed. + # If we have a slash it's probably because of playground or + # extragear, so let's split that out. Otherwise we switch into + # the directory that already exists and just run svn up. + my ($base, $modulename) = split(/\//, $module); + ($base, $modulename) = ($module, '') if $module !~ /\//; -=pod - - if (not download_admin_dir($module)) - { - print "Can't download admin dir for $module!\n"; - print "Removing from list of packages to build.\n"; - - dont_build($module); - $result = 1; - next; - } - -=cut + chdir($base); + switch_repo_url($svnroot); $verb = 'updating'; $command = 'up'; push @args, $command; - push @args, $module; + push @args, $modulename if $modulename; } else { @@ -2380,6 +2393,17 @@ sub finish exit $exitcode; } +# Subroutine to determine the current repository URL for the current working +# directory. +sub get_repo_url +{ + my $output = `svn info | grep URL`; + $output =~ s/URL: (.*)$/$1/; + chomp $output; + + return $output; +} + # Subroutine to handle the installation process. Simply calls # 'make install' in the directory. sub handle_install diff --git a/kdesvn-buildrc-sample b/kdesvn-buildrc-sample index b3b27ba..ded6b5d 100644 --- a/kdesvn-buildrc-sample +++ b/kdesvn-buildrc-sample @@ -46,7 +46,7 @@ global # This is the Subversion server to download the KDE sources from. Developers: # Don't forget to add your username to the URL if necessary! -# svn-server https://anonsvn.kde.org/home/kde +# svn-server svn://anonsvn.kde.org/home/kde # This is the directory that KDE will end up installed at. The default is # appropriate for a single-user installation of KDE, which requires no root