From 54a3c5b11e2e3cf544131adde7b430bc49d97472 Mon Sep 17 00:00:00 2001 From: Michael Pyne Date: Wed, 19 Aug 2009 23:09:14 +0000 Subject: [PATCH] Enable git for any module where the "repository" option is set. kdesvn-build will not correctly handle the "branch" option yet, but if you don't mind HEAD then you'll get the correct build for a KDE module. For example, this works: module amarok repository git://gitorious.org/amarok/amarok.git end module If you already have a subversion checkout in that directory, you need to remove it yourself first, kdesvn-build won't delete your source for you. Also, warn if you change the repository option since kdesvn-build also doesn't handle that. svn path=/trunk/KDE/kdesdk/scripts/kdesvn-build; revision=1013453 --- kdesvn-build | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/kdesvn-build b/kdesvn-build index a271040..d1a33a5 100755 --- a/kdesvn-build +++ b/kdesvn-build @@ -1885,6 +1885,10 @@ sub git_clone_module my $srcdir = get_fullpath($module, 'source'); my $result = log_command($module, 'git-clone', ['git', 'clone', '--', $git_repo, $srcdir]); + if ($result == 0) { + set_persistent_option($module, 'git-cloned-repository', $git_repo); + } + return ($result == 0); } @@ -1896,22 +1900,35 @@ sub git_update_module { my $module = shift; my $srcdir = get_fullpath($module, 'source'); + my $old_repo = get_persistent_option($module, 'git-cloned-repository'); + my $cur_repo = get_option($module, 'repository'); p_chdir($srcdir); - my $result = log_command($module, 'git-pull', ['git', 'pull']); - return ($result == 0); + if ((not $old_repo) or ($cur_repo eq $old_repo)) { + my $result = log_command($module, 'git-pull', ['git', 'pull']); + return ($result == 0); + } + else { + warning " y[b[*] y[$module]'s repository has changed"; + warning " y[b[*] from\t$old_repo"; + warning " y[b[*] to\t$cur_repo,"; + warning " y[b[*] but support for this has not been implemented yet."; + warning " y[b[*] No update has occurred, but proceeding anyways."; + return 1; + } } + # Either performs the initial checkout or updates the current git checkout for qt-copy, # as appropriate. # # If errors are encountered, an exception is raised using die(). # # Returns the number of files updated (actually it just returns 0 now, but maybe someday) -sub update_qt_checkout() +sub update_module_git_checkout { - my $module = 'qt-copy'; # bwahaha, not shift for once + my $module = shift; my $srcdir = get_fullpath($module, 'source'); if (-e $srcdir) { @@ -1927,7 +1944,7 @@ sub update_qt_checkout() git_clone_module($module, "$git_repo") or die "Can't checkout $module: $!"; } - return 0; + return 0; # TODO Fixy McFix } # Checkout a module that has not been checked out before, along with any @@ -4330,8 +4347,9 @@ sub handle_updates my $count; eval { - if ($module eq 'qt-copy') { - $count = update_qt_checkout(); + if (get_option($module, 'repository')) { + # Handle git module update + $count = update_module_git_checkout($module); } elsif (-e "$fullpath/.svn") {