[DRE-maint] Let's discuss big changes in Ruby packaging for squeeze+1

Marcelo E. Magallon mmagallo at debian.org
Thu Apr 22 13:33:56 UTC 2010


On Thu, Apr 22, 2010 at 09:35:14AM +0530, Deepak Tripathi wrote:

> 2) I have already created a script repack.sh to convert
> gemtotar format. we can use this (if it is not buggy). its
> available in svn[2]. let me know your input.

 Looking at the script, I'm not sure about its purpose:

#!/bin/sh
# Repackage upstream source to exclude non-distributable files
# should be called as "repack.sh --upstream-source <ver>
# <downloaded file> (for example, via uscan)

set -e
set -u

VER="$2"
FILE="$3"
PKG=`dpkg-parsechangelog|grep ^Source:|sed 's/^Source: //'`

 Does it need an already existing Debian package, or am I
 misunderstanding something?

 Also:

# Create an extra directory to cope with rootless tarballs
UP_BASE="$DIR/unpack"
mkdir "$UP_BASE"
gem unpack "$FILE" --target "$UP_BASE"

 If I try for example:

 $ gem unpack caper-0.2.0.gem --target $PWD/test-dir
 ERROR:  While executing gem ... (Gem::FilePermissionError)
     You don't have write permissions into the /var/lib/gems/1.8 directory.

 and test-dir/caper-0.2.0 gets created, but it's empty.

 When I was exploring a similar idea, I was thinking of going
 with:

 DIR=`basename "$gem" .gem`
 mkdir "$DIR"
 tar xOf "$gem" data.tar.gz | tar -C "$DIR" -xzf -

 And using the gem metadata to extract things like the gem name,
 version, etc.

 But then I realised that it's better to use Rubygem's library,
 which allows for something like:

    require 'rubygems/format'
    format = Gem::Format.from_file_by_path ARGV.first
    spec = format.spec
    puts "Gem: #{spec.name} (#{spec.version})"
    format.file_entries.each do |entry, data|
       # entry['path'] is the file's path
       # entry['mode'] is the file's mode
       # data contains the actual file data

       # you only need to add sanity checks and filters here and
       # write data to entry['path']
    end

 It's a real pity that the gem spec does not include the license
 information in a machine readable format.

 Cheers,

 Marcelo



More information about the Pkg-ruby-extras-maintainers mailing list