Rudimentary support for the new orphan-packaging development model
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Fri, 28 Mar 2014 06:35:17 +0000 (08:35 +0200)
committerZhang Qiang <qiang.z.zhang@intel.com>
Wed, 16 Apr 2014 03:15:41 +0000 (11:15 +0800)
Add a new --spec-commit command line option in order to support the new
package maintenance model of using separate packaging and devel
branches. In this model the packaging files (i.e. spec et al) must be
taken from other branch if the current branch is a development branch
(which only contains source code).

Change-Id: Ia8eb916dafd5bdc74c9b2d22591a8a36f6c11e95
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Zhang Qiang <qiang.z.zhang@intel.com>
depanneur

index 6a603b15d3325895cd36c3c248f3f6d3b396bb9f..9f2d4d3954b1ec2c7bbe8b8703df2d452e4166c1 100755 (executable)
--- a/depanneur
+++ b/depanneur
@@ -78,6 +78,7 @@ my $clean = 0;
 my $binarylist = "";
 my $binary_from_file = "";
 my $commit = "HEAD";
+my $spec_commit = "";
 my $includeall = 0;
 my $upstream_branch = "";
 my $upstream_tag = "";
@@ -159,6 +160,7 @@ GetOptions (
     "exclude=s" => \@exclude,
     "exclude-from-file=s" => \$exclude_from_file,
     "commit=s" => \$commit,
+    "spec-commit=s" => \$spec_commit,
     "include-all" => \$includeall,
     "upstream-branch=s" => \$upstream_branch,
     "upstream-tag=s" => \$upstream_tag,
@@ -497,7 +499,7 @@ sub fill_packs_from_git {
     debug("working on $base");
     if ($includeall == 0) {
         my (undef, $tmp_file) = tempfile(CLEANUP=>1, OPEN => 0);
-        if (my_system("cd $base; git show $commit:$packaging_dir >$tmp_file 2>/dev/null") == 0) {
+        if (my_system("cd $base; git show $spec_commit:$packaging_dir >$tmp_file 2>/dev/null") == 0) {
             open my $file, '<', $tmp_file or die $!;
             my $first_line = <$file>;
             if ($first_line =~ /^tree/) {
@@ -510,7 +512,7 @@ sub fill_packs_from_git {
                 }
             } else { #packaging_dir is a symbol link
                 my (undef, $tmp_symlink_file) = tempfile(CLEANUP=>1, OPEN => 0);
-                if (my_system("cd $base; git show $commit:$first_line >$tmp_symlink_file 2>/dev/null") == 0) {
+                if (my_system("cd $base; git show $spec_commit:$first_line >$tmp_symlink_file 2>/dev/null") == 0) {
                     open my $symlink_file, '<', $tmp_symlink_file or die $!;
                     while (<$symlink_file>) {
                         chomp;
@@ -638,8 +640,8 @@ sub prepare_git {
         my $without_base;
         $spec =~ s!\Q$base/\E!!;
         $without_base = $spec;
-        if (my_system("cd $base; git show $commit:$without_base >$tmp_spec 2>/dev/null") != 0) {
-            warning("failed to checkout spec file from commit: $commit:$without_base");
+        if (my_system("cd $base; git show $spec_commit:$without_base >$tmp_spec 2>/dev/null") != 0) {
+            warning("failed to checkout spec file from commit: $spec_commit:$without_base");
             return;
         }
         $spec = $tmp_spec;
@@ -1690,6 +1692,7 @@ sub get_binary_list() {
 info("start building packages from: " . $package_path . " ($style)");
 ($_, $start_time) = my_system("date +\"%Y-%m-%d %H:%M %z\"");
 
+$spec_commit = $commit if ($spec_commit eq "");
 if ($style eq 'git') {
     File::Find::find({wanted => \&git_wanted}, $package_path );
     if (@pre_packs > 1 && $commit ne "HEAD"){