[Bps-public-commit] RT-Extension-rt_cpan_org branch, rt4, updated. 497879189fdd463ad8cb4682b2d25f5790bdbcfd

Thomas Sibley trs at bestpractical.com
Wed Apr 3 16:33:14 EDT 2013


The branch, rt4 has been updated
       via  497879189fdd463ad8cb4682b2d25f5790bdbcfd (commit)
       via  4dea4a8e3d3a4b1d3214e73c8e6214fa3bdd6121 (commit)
       via  47b88479422ced474b1357d069746483515946ff (commit)
      from  128d0bc68b8c00524e21b492cb56fa19aaf779c8 (commit)

Summary of changes:
 bin/pull-live                          | 59 +++++++++++++++++++++---------
 patches/4.0.10-quicksearch-links.patch | 65 ++--------------------------------
 2 files changed, 44 insertions(+), 80 deletions(-)

- Log -----------------------------------------------------------------
commit 47b88479422ced474b1357d069746483515946ff
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Apr 3 12:38:44 2013 -0700

    Fix indent

diff --git a/bin/pull-live b/bin/pull-live
index 62154ac..5cb9c3f 100755
--- a/bin/pull-live
+++ b/bin/pull-live
@@ -104,11 +104,11 @@ foreach my $module (@UPDATE) {
     my $repo = $REPOS{ $module };
     print "Getting $repo...\n";
     if ( $repo =~ /^svn/ ) {
-    ($_ = `svn export --quiet --non-interactive --force $repo $module`)
-        or !$? or die "$_\n\nCouldn't export repo";
+        ($_ = `svn export --quiet --non-interactive --force $repo $module`)
+            or !$? or die "$_\n\nCouldn't export repo";
     } else {
-    ($_ = `git clone --quiet $repo $module`)
-        or !$? or die "$_\n\nCouldn't export repo";
+        ($_ = `git clone --quiet $repo $module`)
+            or !$? or die "$_\n\nCouldn't export repo";
     }
 
     print "Installing $module...\n";

commit 4dea4a8e3d3a4b1d3214e73c8e6214fa3bdd6121
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Apr 3 13:28:50 2013 -0700

    Adjust the quicksearch links patch to apply more cleanly
    
    Squashing the hunks from the first commit into the second commit lets
    patch(1) detect that the patch is already applied and respond
    accordingly.

diff --git a/patches/4.0.10-quicksearch-links.patch b/patches/4.0.10-quicksearch-links.patch
index c1b34df..8c36abe 100644
--- a/patches/4.0.10-quicksearch-links.patch
+++ b/patches/4.0.10-quicksearch-links.patch
@@ -1,64 +1,3 @@
-From 292dd3bf6fb7371593a8a978868308a1f1cc75d1 Mon Sep 17 00:00:00 2001
-From: Thomas Sibley <trs at bestpractical.com>
-Date: Tue, 26 Feb 2013 18:57:04 -0800
-Subject: [PATCH 1/2] Use a tiny comment to fix vim's syntax highlighting
-
----
- share/html/Elements/QueueSummaryByLifecycle | 2 +-
- share/html/Elements/QueueSummaryByStatus    | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
-index 01514f1..6e5e0cb 100644
---- a/share/html/Elements/QueueSummaryByLifecycle
-+++ b/share/html/Elements/QueueSummaryByLifecycle
-@@ -67,7 +67,7 @@ for my $queue (@queues) {
- 
-     $i++;
-     my $name = $queue->{Name};
--    $name =~ s/(['\\])/\\$1/g;
-+    $name =~ s/(['\\])/\\$1/g; #'
-     my $queue_cond = "Queue = '$name' AND ";
-     my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", @cur_statuses ) . ')';
- </%PERL>
-diff --git a/share/html/Elements/QueueSummaryByStatus b/share/html/Elements/QueueSummaryByStatus
-index b843bba..082a5dc 100644
---- a/share/html/Elements/QueueSummaryByStatus
-+++ b/share/html/Elements/QueueSummaryByStatus
-@@ -59,7 +59,7 @@ my $i = 0;
- for my $queue (@queues) {
-     $i++;
-     my $name = $queue->{Name};
--    $name =~ s/(['\\])/\\$1/g;
-+    $name =~ s/(['\\])/\\$1/g; #'
-     my $queue_cond = "Queue = '$name' AND ";
-     my $lifecycle = $lifecycle{ lc $queue->{'Lifecycle'} };
-     my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", grep $lifecycle->IsValid($_), @statuses ) . ')';
--- 
-1.7.11.3
-
-
-From 5c0efc3773eaba35d9853fa45691d8c7b506d8b2 Mon Sep 17 00:00:00 2001
-From: Thomas Sibley <trs at bestpractical.com>
-Date: Tue, 26 Feb 2013 19:29:10 -0800
-Subject: [PATCH 2/2] Callbacks for changing the link destinations in the
- queue summaries
-
-While likely to be used only rarely, these callbacks are very useful for
-extensions which provide a richer "queue dashboard" than the vanilla
-search results normally linked to by the queue summary portlets.
-Without the callbacks, such extensions are forced to overlay the entire
-files just to change some URLs.
-
-The duplication between the two types of queue summaries is unfortunate,
-but large scale refactoring is out of scope for the simple goal of this
-commit.  A future refactoring isn't hampered any by the additional
-duplication.
----
- share/html/Elements/QueueSummaryByLifecycle | 33 +++++++++++++++++++++++-----
- share/html/Elements/QueueSummaryByStatus    | 34 ++++++++++++++++++++++++-----
- 2 files changed, 55 insertions(+), 12 deletions(-)
-
 diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
 index 6e5e0cb..44d6b5a 100644
 --- a/share/html/Elements/QueueSummaryByLifecycle
@@ -68,7 +7,7 @@ index 6e5e0cb..44d6b5a 100644
  
      $i++;
 -    my $name = $queue->{Name};
--    $name =~ s/(['\\])/\\$1/g; #'
+-    $name =~ s/(['\\])/\\$1/g;
 -    my $queue_cond = "Queue = '$name' AND ";
 -    my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", @cur_statuses ) . ')';
  </%PERL>
@@ -127,7 +66,7 @@ index 082a5dc..2a8dc53 100644
  for my $queue (@queues) {
      $i++;
 -    my $name = $queue->{Name};
--    $name =~ s/(['\\])/\\$1/g; #'
+-    $name =~ s/(['\\])/\\$1/g;
 -    my $queue_cond = "Queue = '$name' AND ";
      my $lifecycle = $lifecycle{ lc $queue->{'Lifecycle'} };
 -    my $all_q = $queue_cond . '(' . join( " OR ", map "Status = '$_'", grep $lifecycle->IsValid($_), @statuses ) . ')';

commit 497879189fdd463ad8cb4682b2d25f5790bdbcfd
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Apr 3 13:31:01 2013 -0700

    More robust error handling when pulling live
    
    The previous error handling assumed that output on STDOUT meant success,
    which is not always correct.  Be more nuanced about error detection and
    handling and provide better diagnostics.  A few of the previous fatal
    errors are now only warnings.

diff --git a/bin/pull-live b/bin/pull-live
index 5cb9c3f..59ed735 100755
--- a/bin/pull-live
+++ b/bin/pull-live
@@ -89,10 +89,10 @@ chdir $tmp_dir;
 
 unless ( skip 'RT' ) {
     my $url = 'http://download.bestpractical.com/pub/rt/release/rt.tar.gz';
-    ($_ = `curl $url | tar xzp`)
-        or !$? or die "$_\n\nCouldn't download and extract RT ($url)";
-    ($_ = `cd rt-4.* && ./configure $rt_opts && sudo make install`)
-        or !$? or die "$_\n\nCouldn't upgrade RT";
+    run("curl $url | tar xzp")
+        or die "Couldn't download and extract RT ($url)";
+    run("cd rt-4.* && ./configure $rt_opts && sudo make install")
+        or die "Couldn't upgrade RT";
 }
 
 
@@ -104,21 +104,23 @@ foreach my $module (@UPDATE) {
     my $repo = $REPOS{ $module };
     print "Getting $repo...\n";
     if ( $repo =~ /^svn/ ) {
-        ($_ = `svn export --quiet --non-interactive --force $repo $module`)
-            or !$? or die "$_\n\nCouldn't export repo";
+        run("svn export --quiet --non-interactive --force $repo $module")
+            or die "Couldn't export repo";
     } else {
-        ($_ = `git clone --quiet $repo $module`)
-            or !$? or die "$_\n\nCouldn't export repo";
+        run("git clone --quiet $repo $module")
+            or die "Couldn't export repo";
     }
 
     print "Installing $module...\n";
-    ($_ = `cd $module && $perl ./Makefile.PL && make && sudo make install`)
-        or !$? or die "$_\n\nCouldn't install module";
+    run("cd $module && $perl ./Makefile.PL && make && sudo make install")
+        or die "Couldn't install module";
 
     for my $patch (<$module/patches/*.patch>) {
         print "Patching RT with $patch...\n";
-        ($_ = `sudo patch --forward -p1 -d $rthome < $patch`)
-            or !$? or die "$_\n\nCouldn't patch RT";
+        run("sudo patch --forward -p1 -d $rthome < $patch",
+            ignore_exit => 1,
+            fail_on     => qr/FAILED/)
+                or warn "Couldn't apply patch $patch.  Please apply it manually.\n";
     }
 
     rmtree($module);
@@ -128,14 +130,14 @@ foreach my $module (@UPDATE) {
 # adjust bugs-per-dist.data and queue-addresses
 foreach my $path (qw(/local/plugins/RT-Extension-rt_cpan_org/html/Public/bugs-per-dist.data /local/plugins/RT-Extension-rt_cpan_org/html/NoAuth/cpan)) {
     my $f = $rthome . $path;
-    `touch $f` unless -e $f;
-    ($_ = `chown -R rtcpan:rtcpan $f`)
-        or !$? or die "$_\n\nCouldn't change owner of '$f'";
+    run("touch $f") unless -e $f;
+    run("chown -R rtcpan:rtcpan $f")
+        or warn "Couldn't change owner of '$f'. Please fix the owner manually.\n";
 }
 
 # clean mason cache
-($_ = `rm -fr $rthome/var/mason_data/obj/`)
-    or !$? or die "$_\n\nCouldn't clean mason cache";
+run("rm -fr $rthome/var/mason_data/obj/")
+    or warn "Couldn't clean mason cache\n";
 
 END { chdir ".." }
 
@@ -148,3 +150,26 @@ sub skip($) {
     return 0;
 }
 
+sub run {
+    my $cmd     = shift;
+    my %args    = @_;
+    my $stdout  = `$cmd`;
+    my $failed  = $args{ignore_exit} ? 0 : $?;
+
+    $failed = 1 if $args{fail_on}
+        and $stdout =~ /$args{fail_on}/;
+
+    if ($failed) {
+        warn "  Command: $cmd\n";
+        if    ($? == -1) { warn "  Failed to execute: $cmd\n" }
+        elsif ($? & 127) { warn "  Child died with signal ", $? & 127, "\n" }
+        else             { warn "  Command exited with ", $? >> 8, "\n" }
+        if ($stdout) {
+            warn "  Command output:\n";
+            warn "    $_\n" for split /\n/, $stdout;
+        }
+        return 0;
+    } else {
+        return 1;
+    }
+}

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list