[SCM] Debian Qt/KDE packaging tools branch, master, updated. debian/0.15.1

Modestas Vainius modax at alioth.debian.org
Sat Jun 30 11:01:52 UTC 2012


Gitweb-URL: http://git.debian.org/?p=pkg-kde/pkg-kde-tools.git;a=commitdiff;h=8778e8b

The following commit has been merged in the master branch:
commit 8778e8b4935f93323807b79525298c441c6fb4fd
Author: Modestas Vainius <modax at debian.org>
Date:   Sat Jun 30 13:49:57 2012 +0300

    pkgkde-getbuildlogs: support gzip Content-Encoding.
    
    https://buildd.debian.org/ no longer supports deflate encoding.
---
 debian/changelog    |    3 +++
 pkgkde-getbuildlogs |   37 ++++++++++++++++++++++++-------------
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2448196..0362954 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ pkg-kde-tools (0.15.1~pre1) UNRELEASED; urgency=low
   [ Pino Toscano ]
   * Extend the workaround for cmake bug #653916 also to CFLAGS.
 
+  [ Modestas Vainius ]
+  * pkgkde-getbuildlogs: support gzip Content-Encoding.
+
  -- Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>  Sat, 16 Jun 2012 13:21:40 +0200
 
 pkg-kde-tools (0.15.0) unstable; urgency=low
diff --git a/pkgkde-getbuildlogs b/pkgkde-getbuildlogs
index fa2be1f..61e192d 100755
--- a/pkgkde-getbuildlogs
+++ b/pkgkde-getbuildlogs
@@ -24,6 +24,7 @@ use File::Copy qw();
 use File::Temp qw();
 use File::Spec;
 use IO::Uncompress::Inflate qw(inflate);
+use IO::Uncompress::Gunzip qw(gunzip);
 
 # Load extra modules (from libwww-perl and its dependencies)
 INIT {
@@ -131,24 +132,34 @@ sub fetch_log {
 
 	info "Fetching build log to $filename ...";
 	my $request = HTTP::Request->new(GET => $uri);
-	$request->header("Accept-Encoding" => "deflate, identity");
+	$request->header("Accept-Encoding" => "gzip, deflate, identity");
 	$browser->show_progress(1);
 	$tmpfile1->close();
 	my $response = $browser->request($request, $tmpfile1->filename);
 	if ($response->is_success()) {
-	    my $is_deflated = $response->header("Content-Encoding");
-	    $is_deflated = defined $is_deflated && $is_deflated eq "deflate";
-	    # Inflate contents if needed
-	    if ($is_deflated) {
-		push @status, "deflate";
-		if (inflate($tmpfile1->filename => $tmpfile2, BinModeOut => 1)) {
-		    $tmpfile2->close();
-		    ($tmpfile1, $tmpfile2) = ($tmpfile2, $tmpfile1);
-		    open($tmpfile2, ">:utf8", $tmpfile2->filename) or
-			syserr "unable to reopen temporary file";
-		    $ok = 1;
+	    # Inflate/gunzip contents if needed
+	    my $content_encoding = $response->header("Content-Encoding");
+	    if (defined $content_encoding) {
+		my $uncompress_func;
+		if ($content_encoding eq "deflate") {
+		    push @status, "deflate";
+		    $uncompress_func = \&inflate;
+		} elsif ($content_encoding eq "gzip") {
+		    push @status, "gzip";
+		    $uncompress_func = \&gunzip;
 		} else {
-		    unlink $filename;
+		    push @status, "unsupported content encoding: $content_encoding";
+		}
+		if (defined $uncompress_func) {
+		    if (&$uncompress_func($tmpfile1->filename => $tmpfile2, BinModeOut => 1)) {
+			$tmpfile2->close();
+			($tmpfile1, $tmpfile2) = ($tmpfile2, $tmpfile1);
+			open($tmpfile2, ">:utf8", $tmpfile2->filename) or
+			    syserr "unable to reopen temporary file";
+			$ok = 1;
+		    } else {
+			unlink $filename;
+		    }
 		}
 	    } else {
 		$ok = 1;

-- 
Debian Qt/KDE packaging tools



More information about the pkg-kde-commits mailing list