diff options
author | Fabien Tassin <fta@ubuntu.com> | 2008-10-12 19:04:41 +0200 |
---|---|---|
committer | Fabien Tassin <fta@ubuntu.com> | 2008-10-12 19:04:41 +0200 |
commit | c283158cb39dc40b5e12989469e7ed400e538ed6 (patch) | |
tree | 12b0ca5fdecde1526a1075e3e9e044be13bf64d6 | |
parent | d600b2c6f0918731f285d53e942c0ffee49a337c (diff) |
* [mozclient] add support for git
- add src/mozclient/lib/MozClient/Git.pm
- update src/mozclient/mozclient.pl
- update src/mozclient/lib/MozClient/VCS.pm
- update debian/control
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | src/mozclient/lib/MozClient/Git.pm | 100 | ||||
-rw-r--r-- | src/mozclient/lib/MozClient/VCS.pm | 1 | ||||
-rwxr-xr-x | src/mozclient/mozclient.pl | 2 |
5 files changed, 110 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index d37fab3..182f333 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,11 @@ mozilla-devscripts (0.11) UNRELEASED; urgency=low - update src/mozclient.mk.in - drop $(EXT), left-over from when mozclient.pl was substed and use -c instead - update src/mozclient.mk.in + - add support for git + - add src/mozclient/lib/MozClient/Git.pm + - update src/mozclient/mozclient.pl + - update src/mozclient/lib/MozClient/VCS.pm + - update debian/control - move thunderbird-3.0 from cvs to hg comm-central - update src/mozclient/thunderbird-3.0.conf - add src/mozclient/thunderbird-3.0-remove.binonly.sh @@ -26,7 +31,7 @@ mozilla-devscripts (0.11) UNRELEASED; urgency=low allow caller to specify the xulrunner version by pre-setting DEBIAN_XUL_VER - update src/xulapp.mk.in - -- Fabien Tassin <fta@ubuntu.com> Sat, 11 Oct 2008 03:00:22 +0200 + -- Fabien Tassin <fta@ubuntu.com> Sun, 12 Oct 2008 19:03:20 +0200 mozilla-devscripts (0.10) intrepid; urgency=low diff --git a/debian/control b/debian/control index 8c82a7d..3b0fd3f 100644 --- a/debian/control +++ b/debian/control @@ -10,7 +10,7 @@ Vcs-Bzr: https://code.launchpad.net/~mozillateam/mozclient/mozclient.dev Package: mozilla-devscripts Architecture: all Depends: wget, quilt, libxml-xpath-perl, zip, unzip, dpkg-dev, fakeroot, python | python2.4 -Suggests: cvs, mercurial +Suggests: cvs, mercurial, git-core Description: Collection of dev scripts used by Ubuntu Mozilla packages This package contains mozilla-devscripts, a collection of scripts based on Makefile inheritance which provides targets usable by Mozilla diff --git a/src/mozclient/lib/MozClient/Git.pm b/src/mozclient/lib/MozClient/Git.pm new file mode 100644 index 0000000..393032b --- /dev/null +++ b/src/mozclient/lib/MozClient/Git.pm @@ -0,0 +1,100 @@ +# -*- mode: Perl -*- + +# Copyright (c) 2007-2008 Fabien Tassin <fta@sofaraway.org> +# Description: MozClient::Git +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +############################################################################ + +package MozClient::Git; + +use vars qw(@ISA); +use strict; +use MozClient::VCS; + +@ISA = ("MozClient::VCS"); + +sub get_client { + my $self = shift; + + $self->LOG("MozClient::Git::get_client()"); + # nothing to do +} + +sub convert_revdate { + my $self = shift; + my $arg = shift; + + $self->LOG("MozClient::Git::convert_revdate($arg)"); + $arg =~ s,^\d+r,,; + $arg; +} + +sub set_revdate { + my $self = shift; + + $self->LOG("MozClient::Git::set_revdate()"); + + # We can set a revision for git + $self->{'mozclient_date'} = + $self->convert_revdate($self->{'have_date'}); +} + +sub set_tag { + my $self = shift; + my $tag = shift; + + $self->LOG("MozClient::Git::set_tag($tag)"); + + $self->{'co_tag'} = "$tag"; +} + +sub checkout { + my $self = shift; + + $self->LOG("MozClient:Git::checkout:()"); + $self->chdir($self->work_dir); + my $modules = []; + if (defined $self->{'MOZCLIENT_PROJECT'}) { + push @$modules, + $self->{'MOZCLIENT_VCS_LOC'} . $self->{'MOZCLIENT_PROJECT'} . "/"; + } + else { + warn "MOZCLIENT_MODULES not supported for Git"; + for my $module (@{$self->{'MOZCLIENT_MODULES'}}) { + push @$modules, (sprintf " %s%s/%s", $self->{'MOZCLIENT_VCS_LOC'}, + $self->{'MOZCLIENT_PROJECT'}, $module); + } + } + my $cmd = sprintf "git clone %s %s", join(" ", @$modules), $self->{'MOZCLIENT_MOZDIRNAME'}; + $self->run_system($cmd); + $self->chdir($self->{'MOZCLIENT_MOZDIRNAME'}); + my $rev = $self->{'mozclient_date'} ? $self->{'mozclient_date'} : $self->{'co_tag'}; + $cmd = sprintf "git branch %s %s", $rev, $rev; + $self->run_system($cmd); + $cmd = sprintf "git checkout %s", $rev; + $self->run_system($cmd); + $self->chdir("../.."); +} + +sub tar_exclude { + my $self = shift; + + $self->LOG("MozClient::Git::tar_exclude()"); + [ '--exclude .git', '--exclude .gitignore' ]; +} + +1; diff --git a/src/mozclient/lib/MozClient/VCS.pm b/src/mozclient/lib/MozClient/VCS.pm index 79e5ba1..f5b1b56 100644 --- a/src/mozclient/lib/MozClient/VCS.pm +++ b/src/mozclient/lib/MozClient/VCS.pm @@ -34,6 +34,7 @@ my $nobinonly = "nobinonly"; my $dependencies = { 'cvs' => '/usr/bin/cvs', 'mercurial' => '/usr/bin/hg', + 'git' => '/usr/bin/git', 'quilt' => '/usr/bin/quilt', 'wget' => '/usr/bin/wget', }; diff --git a/src/mozclient/mozclient.pl b/src/mozclient/mozclient.pl index e909ae0..d106231 100755 --- a/src/mozclient/mozclient.pl +++ b/src/mozclient/mozclient.pl @@ -175,6 +175,7 @@ sub read_project_file { use MozClient::CVS; use MozClient::Mercurial; use MozClient::Subversion; +use MozClient::Git; # Main my $opt = {}; @@ -198,6 +199,7 @@ my $vcs = $$conf{'MOZCLIENT_VCS'}; $vcs eq 'cvs' && do { $client = MozClient::CVS->new($conf, $opt); 1; } || $vcs eq 'svn' && do { $client = MozClient::Subversion->new($conf, $opt); 1; } || $vcs eq 'hg' && do { $client = MozClient::Mercurial->new($conf, $opt); 1; } || +$vcs eq 'git' && do { $client = MozClient::Git->new($conf, $opt); 1; } || do { die "VCS '$$conf{'MOZCLIENT_VCS'}' not supported yet"; }; |