From: Zhang Qiang Date: Wed, 29 Aug 2012 07:32:25 +0000 (+0800) Subject: add --include-all and --commit option for gbs export use. X-Git-Tag: 0.1~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0119f20009855199679fe770b88bc620356d7bdb;p=tools%2Fdepanneur.git add --include-all and --commit option for gbs export use. generally --include-all and --commit options are used to build single package. if build multiple packages, --commit is not available. Change-Id: I7b13257f458bedc6b3313bb70fb0ab7d644f7d8c --- diff --git a/depanneur b/depanneur index a09160b..61eeb47 100755 --- a/depanneur +++ b/depanneur @@ -66,6 +66,8 @@ my $style = "git"; my $clean = 0; my $binarylist = ""; my $buildall = 0; +my $commit = ""; +my $includeall = 0; my $dist = "tizen"; my $dryrun = 0; my $help = 0; @@ -115,6 +117,8 @@ GetOptions ( "exclude=s" => \@exclude, "exclude-from-file=s" => \$exclude_from_file, "build-all" => \$buildall, + "commit=s" => \$commit, + "include-all" => \$includeall, "binary=s" => \$binarylist, "style=s" => \$style, "path=s" => \$path, @@ -366,7 +370,13 @@ sub prepare_git { my $skip = 0; my $old_base = ""; if ( -e "$base/.git" ) { - open(GIT,"git --git-dir $base/.git rev-parse HEAD |") || die "Failed: $!\n"; + my $commit_id; + if ($commit eq ""){ + $commit_id = "HEAD"; + }else{ + $commit_id = $commit; + } + open(GIT,"git --git-dir $base/.git rev-parse $commit_id|") || die "Failed: $!\n"; while (my $current_rev = ) { chomp($current_rev); if ( system("grep -rq $current_rev $cache_path") == 0 ) { @@ -399,7 +409,7 @@ sub prepare_git { } else { debug("not a git repo: $base/.git!!"); } - if ($skip == 1) { + if ($skip == 1 && $includeall == 0) { if ( $old_base ne "" ) { $old_base = basename($old_base); push(@packs, "$pkg_path/$old_base/$spec_file"); @@ -407,7 +417,18 @@ sub prepare_git { push(@packs, "$pkg_path/$pkg_name-$pkg_version-$pkg_release/$spec_file"); } } else { - if ( system("gbs export $base -o $pkg_path") == 0 ) { + my @args = (); + my $cmd; + push @args, "gbs export"; + push @args, "$base"; + push @args, "-o $pkg_path"; + if ($includeall == 1) { + push @args, "--include-all"; + } elsif ($commit ne "") { + push @args, "--commit=$commit"; + } + $cmd = join(" ", @args); + if ( system($cmd) == 0 ) { push(@packs, "$pkg_path/$pkg_name-$pkg_version-$pkg_release/$spec_file"); } else { debug("$name was not exported correctly"); @@ -764,6 +785,9 @@ info("Start building packages from: " . $package_path . " ($style)"); if ($buildall || @packs == 0 ) { if ($style eq "git") { File::Find::find({wanted => \&git_wanted}, $package_path ); + if (@original_specs > 1 && ! $commit eq ""){ + error("--commit option can't be specified with multiple packages"); + } } elsif ($style eq "obs") { File::Find::find({wanted => \&obs_wanted}, $package_path ); }