diff --git a/lib/debian.rb b/lib/debian.rb index 128e5c1..c1e49ad 100644 --- a/lib/debian.rb +++ b/lib/debian.rb @@ -140,15 +140,17 @@ module Debian def load(debfile) info = '' ar = Debian::Ar.new(debfile) - ar.open('control.tar.gz') {|ctz| - Debian::Utils::gunzip(ctz) {|ct| - Debian::Utils::tar(ct, Debian::Utils::TAR_EXTRACT, '*/control'){|fp| - info = fp.readlines.join("") + reader = lambda { |ctz| + Debian::Utils::gunzip(ctz) { |ct| + Debian::Utils::tar(ct, Debian::Utils::TAR_EXTRACT, '*/control') { |fp| + info = fp.readlines.join("") fp.close - } + } ct.close - } + } } + ar.open('control.tar.gz', &reader) + ar.open('control.tar.gz/', &reader) if info.empty? ar.close deb = Deb.new(info) deb.filename = File.expand_path(debfile, Dir.getwd)