From 709e14ecc1433da755e6d7be5cc98d493258c8e3 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Fri, 10 Apr 2015 22:09:18 +0300 Subject: [PATCH] Use Go native lzma implementation, so that there are no external dependencies. #142 --- Gomfile | 2 +- deb/deb.go | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Gomfile b/Gomfile index 6de98ab3..6656d2a0 100644 --- a/Gomfile +++ b/Gomfile @@ -15,7 +15,7 @@ gom 'github.com/smira/commander', :commit => 'f408b00e68d5d6e21b9f18bd310978dafc gom 'github.com/smira/flag', :commit => '357ed3e599ffcbd4aeaa828e1d10da2df3ea5107' gom 'github.com/smira/go-ftp-protocol/protocol', :commit => '066b75c2b70dca7ae10b1b88b47534a3c31ccfaa' gom 'github.com/smira/go-uuid/uuid', :commit => 'ed3ca8a15a931b141440a7e98e4f716eec255f7d' -gom 'github.com/smira/lzma', :commit => '2a7c55cad4a2d02ab972a03357db5760833a49bc' +gom 'github.com/uli-go/xz/lzma', :commit => 'e29b1fc5cb69750cf19ab6049d2238b274a2e39f' gom 'github.com/syndtr/gosnappy/snappy', :commit => 'ce8acff4829e0c2458a67ead32390ac0a381c862' gom 'github.com/syndtr/goleveldb/leveldb', :commit => '97e257099d2ab9578151ba85e2641e2cd14d3ca8' gom 'github.com/ugorji/go/codec', :commit => '71c2886f5a673a35f909803f38ece5810165097b' diff --git a/deb/deb.go b/deb/deb.go index f452cb50..58bc12e8 100644 --- a/deb/deb.go +++ b/deb/deb.go @@ -8,7 +8,7 @@ import ( "github.com/mkrautz/goar" "github.com/remyoudompheng/go-liblzma" "github.com/smira/aptly/utils" - "github.com/smira/lzma" + "github.com/uli-go/xz/lzma" "io" "os" "strings" @@ -141,8 +141,10 @@ func GetContentsFromDeb(packageFile string) ([]string, error) { defer unxz.Close() tarInput = unxz case "data.tar.lzma": - unlzma := lzma.NewReader(library) - defer unlzma.Close() + unlzma, err := lzma.NewReader(library) + if err != nil { + return nil, fmt.Errorf("unable to unlzma: %s", err) + } tarInput = unlzma default: return nil, fmt.Errorf("unsupported tar compression: %s", header.Name)