summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJonathan "Duke" Leto <jonathan@leto.net>2011-02-23 00:15:10 +0000
committerJonathan "Duke" Leto <jonathan@leto.net>2011-02-23 00:15:10 +0000
commit3dc954db25b482074bb8abff5aaa51de002d3b5d (patch)
tree70c24c7b636a5c651746775462e1cf0c94494d57 /lib
parentCreate a new repo for the first time, even if reuse_repo is true (diff)
downloadjitterbug-3dc954db25b482074bb8abff5aaa51de002d3b5d.tar.gz
Make reusing git repos actually work
This code is not pretty, but it works. Currently, Git::Repository is eschewed because it was giving odd errors.
Diffstat (limited to '')
-rw-r--r--lib/jitterbug/Builder.pm24
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/jitterbug/Builder.pm b/lib/jitterbug/Builder.pm
index 1e71e2e..50df80c 100644
--- a/lib/jitterbug/Builder.pm
+++ b/lib/jitterbug/Builder.pm
@@ -98,11 +98,11 @@ sub run_task {
$task->project->name,
$task->commit->sha256,
);
+ my $dir = $conf->{'jitterbug'}{'build'}{'dir'};
+ mkdir $dir unless -d $dir;
+
+ my $build_dir = dir($dir, $task->project->name);
- my $build_dir = dir(
- $conf->{'jitterbug'}{'build'}{'dir'},
- $task->project->name,
- );
my $r;
my $repo = $task->project->url . '.git';
unless ($buildconf->{reuse_repo}) {
@@ -112,24 +112,32 @@ sub run_task {
$r = Git::Repository->create( clone => $repo => $build_dir );
} else {
# If this is the first time, the repo won't exist yet
- if( -e $build_dir ){
+ debug("build_dir = $build_dir");
+ if( -d $build_dir ){
my $pwd = getcwd;
chdir $build_dir;
# TODO: Error Checking
debug("Cleaning git repo");
system("git clean -dfx");
debug("Fetching new commits into $repo");
- system("git fetch");
+ system("git pull --rebase");
chdir $pwd;
$r = Git::Repository->new( work_tree => $build_dir );
} else {
- $r = Git::Repository->create( clone => $repo => $build_dir );
+ debug("Creating new repo");
+ my $pwd = getcwd;
+ debug("pwd=$pwd");
+ chdir $build_dir;
+ system("git clone $repo $build_dir");
+ #$r = Git::Repository->create( clone => $repo => $build_dir );
+ chdir $pwd;
}
}
$self->sleep(1); # avoid race conditions
debug("Checking out " . $task->commit->sha256 . " from $repo into $build_dir\n");
- $r->run( 'checkout', $task->commit->sha256 );
+ # $r->run( 'checkout', $task->commit->sha256 );
+ system("git checkout " . $task->commit->sha256 );
my $builder = $conf->{'jitterbug'}{'build_process'}{'builder'};