[PATCH] Build: Make changelog action call git directly without Git module
The changelog action needs to checkout git2cl as a submodule. For some reason, when called through the Git module, command('submodule', 'update') was doing something unfathomable, and different to just calling 'git submodule update'. As Git is just a command line wrapper anyway, I've sidestepped this by just calling the command directly. --- Build.PL | 18 ++---------------- 1 files changed, 2 insertions(+), 16 deletions(-) diff --git a/Build.PL b/Build.PL index efce5dd..51afae8 100644 --- a/Build.PL +++ b/Build.PL @@ -150,22 +150,8 @@ sub ACTION_changelog return 1; } - # Check that git is available - eval "use Git;"; - if($@) { - $self->log_info("Git is not installed\n"); - return 1; - } - - # Update submodules to get git2cl - my $repo = Git->repository(Directory => '.'); - - eval { - $repo->command_noisy('submodule', 'update'); - }; - - if($@) { - $self->log_info("Failed to initialise git2cl\n"); + unless(system("git", "submodule", "update") == 0) { + $self->log_info("Failed to initialise git2cl: $@\n"); return 1; } -- 1.6.6
On Tue, Feb 16, 2010 at 01:51:45PM +0000, Matthew Booth wrote:
The changelog action needs to checkout git2cl as a submodule. For some reason, when called through the Git module, command('submodule', 'update') was doing something unfathomable, and different to just calling 'git submodule update'. As Git is just a command line wrapper anyway, I've sidestepped this by just calling the command directly. --- Build.PL | 18 ++---------------- 1 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/Build.PL b/Build.PL index efce5dd..51afae8 100644 --- a/Build.PL +++ b/Build.PL @@ -150,22 +150,8 @@ sub ACTION_changelog return 1; }
- # Check that git is available - eval "use Git;"; - if($@) { - $self->log_info("Git is not installed\n"); - return 1; - } - - # Update submodules to get git2cl - my $repo = Git->repository(Directory => '.'); - - eval { - $repo->command_noisy('submodule', 'update'); - }; - - if($@) { - $self->log_info("Failed to initialise git2cl\n"); + unless(system("git", "submodule", "update") == 0) { + $self->log_info("Failed to initialise git2cl: $@\n"); return 1; }
Seems sensible, ACK. Did you see the script that Jim Meyering wrote which we use for libguestfs? (It's part of Gnulib) http://git.annexia.org/?p=libguestfs.git;a=blob;f=Makefile.am;h=0abe3dd06aa0... Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
On 19/02/10 09:44, Richard W.M. Jones wrote:
On Tue, Feb 16, 2010 at 01:51:45PM +0000, Matthew Booth wrote:
The changelog action needs to checkout git2cl as a submodule. For some reason, when called through the Git module, command('submodule', 'update') was doing something unfathomable, and different to just calling 'git submodule update'. As Git is just a command line wrapper anyway, I've sidestepped this by just calling the command directly. --- Build.PL | 18 ++---------------- 1 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/Build.PL b/Build.PL index efce5dd..51afae8 100644 --- a/Build.PL +++ b/Build.PL @@ -150,22 +150,8 @@ sub ACTION_changelog return 1; }
- # Check that git is available - eval "use Git;"; - if($@) { - $self->log_info("Git is not installed\n"); - return 1; - } - - # Update submodules to get git2cl - my $repo = Git->repository(Directory => '.'); - - eval { - $repo->command_noisy('submodule', 'update'); - }; - - if($@) { - $self->log_info("Failed to initialise git2cl\n"); + unless(system("git", "submodule", "update") == 0) { + $self->log_info("Failed to initialise git2cl: $@\n"); return 1; }
Seems sensible, ACK.
Did you see the script that Jim Meyering wrote which we use for libguestfs? (It's part of Gnulib)
http://git.annexia.org/?p=libguestfs.git;a=blob;f=Makefile.am;h=0abe3dd06aa0...
No I didn't. However, I think it would be sensible to use the same approach in both tools. Do you have time to copy the libguestfs solution for virt-v2v? Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team M: +44 (0)7977 267231 GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
participants (2)
-
Matthew Booth -
Richard W.M. Jones