[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Let's discuss big changes in Ruby packaging for squeeze+1



Hi Marcelo,

Sorry to delay.

So currently repack.sh is getting call with debian/watch file
(uscan --force-download --rename --destdir ../tarballs). 

It was a fix for subversion when you download upstream source and keep it in ../tarballs  before running svn-buildpackage.

 I haven't said that it will work as it is, but yes we can take this and modified as per our need. :)



Thanks
Deepak
.

On Thu, Apr 22, 2010 at 7:03 PM, Marcelo E. Magallon <mmagallo@debian.org> wrote:
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



--
Deepak Tripathi
E3 71V3 8Y C063 (We Live By Code)
http://deepaktripathi.blogspot.com


Reply to: