[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] pallet 1.2.1

Stephen Touset

5/1/2007 5:53:00 PM

I've been writing a multiplatform packaging tool for the company I work
for, dubbed "pallet". I recently got the go-ahead to release it on
RubyForge under the LGPL, so have spent the past day or so getting it up
on there.

Essentially, pallet lets you use a simple Rakefile stanza (akin to the
existing gemspec stanza) to define multiple packaging formats. Right now,
gem and dpkg are the only formats supported, although adding .tar.gz
should be trivial, and .rpm should be simple enough for anyone who's built
an RPM.

An example of the format, from pallet's own Rakefile:

Pallet.new('pallet', Pallet::VERSION) do |p|

p.author = 'Stephen Touset'
p.email = 'stouset@damballa.com'
p.summary = 'Automated packaging tool for different languages and OSes'

p.packages << Pallet::Gem.new(p) do |gem|
gem.depends = ['rake']
gem.requirements = ['fakeroot', 'dpkg-dev']
gem.files.include FileList['share/**/*']
end

p.packages << Pallet::Deb.new(p) do |deb|
deb.architecture = 'all'
deb.depends = ['rake', 'fakeroot', 'dpkg-dev']
deb.files = [InstallSpec['lib', '/usr/lib/ruby/1.8'],
InstallSpec['share', '/usr/share/pallet'],]
deb.commands.document = 'rake doc'
end

end

It doesn't support every single possible feature of every packaging
system, but it's close enough for 99% of projects. Nearly thirty of our
own internal software projects were ported over to it as part of our build
system in a matter of hours by two developers with no previous experience
with either the packaging systems or pallet.

One nice ability is that it should require no more than maybe ten lines to
build a Debian package that simply contains a gem that is
installed/uninstalled from rubygems by postinst/prerm scripts in the
Debian package. In a future release, I expect to make this a trivial
use-case, through something like

p.packages << Pallet::Deb.new(p, :include => :gem)

It is extensively rdoc'd, available as "pallet" from rubygems, and can be
downloaded as a dpkg or a gem from http://rubyforge.org/projec...

Happy packing!

--
Stephen Touset <stephen@touset.org>
17 Answers

Stephen Touset

5/1/2007 6:02:00 PM

0

On Tue, 01 May 2007 12:53:18 -0500, Stephen Touset wrote:

> I've been writing a multiplatform packaging tool for the company I work
> for, dubbed "pallet". I recently got the go-ahead to release it on
> RubyForge under the LGPL, so have spent the past day or so getting it up
> on there.

As part of this release, I'd like to extend a (limited) offer to
personally package up a few -- maybe five to ten, time-willing -- willing
open source projects. Please reply to this message if you have a project or
library that would benefit from being packaged as a .deb (preferably also
a .gem). Higher-profile projects will be dealt with first.

Since I didn't include it in the original post, I want to clarify that
pallet can be used to package software from _any_ language and integrate
into any build system -- not just Ruby using Rake. Most of the projects we
have at the company I developed this for are written in C built with
Makefiles or Java build with ant. None of these required any extra
effort by our developers to package.

--
Stephen Touset <stephen@touset.org>

benjohn

5/2/2007 8:40:00 AM

0

Stephen:

> On Tue, 01 May 2007 12:53:18 -0500, Stephen Touset wrote:
>
>> I've been writing a multiplatform packaging tool for the company I
>> work
>> for, dubbed "pallet". I recently got the go-ahead to release it on
>> RubyForge under the LGPL, so have spent the past day or so getting it
>> up
>> on there.

*snip*

> Since I didn't include it in the original post, I want to clarify that
> pallet can be used to package software from _any_ language and integrate
> into any build system -- not just Ruby using Rake. Most of the projects
> we
> have at the company I developed this for are written in C built with
> Makefiles or Java build with ant. None of these required any extra
> effort by our developers to package.

This sounds extremely interesting Stephen: I would expect quite a lots
of interst, but there don't seem to be replies on the list. I wonder if
people haven't quite understood what you've released? Is it some kind of
meta package description that can be compiled in to vareious different
kinds of package? Or have I got completely the wrong end of the stick?

:-)

Cheers,
Benjohn



Brian Candler

5/2/2007 9:46:00 AM

0

On Wed, May 02, 2007 at 02:55:07AM +0900, Stephen Touset wrote:
> Essentially, pallet lets you use a simple Rakefile stanza (akin to the
> existing gemspec stanza) to define multiple packaging formats. Right now,
> gem and dpkg are the only formats supported, although adding .tar.gz
> should be trivial, and .rpm should be simple enough for anyone who's built
> an RPM.

I'd definitely be interested in RPM.

Right now I'm using a different approach: gem2spec takes a gem and turns it
into an RPM spec file. Unlike the native .deb packages you're generating
under Pallet, the components are installed under /usr/lib/ruby/gems/1.8 not
/usr/lib/ruby/1.8.

$ rpm -ql rubygem-rake
/usr/bin/rake
/usr/lib/ruby/gems/1.8/cache/rake-0.7.1.gem
/usr/lib/ruby/gems/1.8/doc/rake-0.7.1
/usr/lib/ruby/gems/1.8/doc/rake-0.7.1/rdoc
/usr/lib/ruby/gems/1.8/doc/rake-0.7.1/rdoc/classes
/usr/lib/ruby/gems/1.8/doc/rake-0.7.1/rdoc/classes/CompositePublisher.html
...
/usr/lib/ruby/gems/1.8/doc/rake-0.7.1/ri
/usr/lib/ruby/gems/1.8/doc/rake-0.7.1/ri/CompositePublisher
/usr/lib/ruby/gems/1.8/doc/rake-0.7.1/ri/CompositePublisher/add-i.yaml
...
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/CHANGES
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/MIT-LICENSE
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/README
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/Rakefile
.
/usr/lib/ruby/gems/1.8/gems/rake-0.7.1/test/test_test_task.rb
/usr/lib/ruby/gems/1.8/specifications/rake-0.7.1.gemspec

With Pallet, you can tell it what files to bundle together to build a
package. But what about the initial fetch/untar/configure/build/install
steps? It would be very attractive to write these once in ruby (or rake),
but I don't think Pallet provides rules for this. Are there existing
libraries of rake tasks to do these steps?

Regards,

Brian.

P.S. Another tool I've used occasionally is Debian's "alien" (e.g. to
install the oracle-instantclient RPMs on an Ubuntu box). I've never tried
using alien to convert a .deb to .rpm though.


Stephan Mueller

5/2/2007 1:54:00 PM

0

Hi Stephen,

* Stephen Touset <stephen@touset.org> [01.05.2007]:

> I've been writing a multiplatform packaging tool for the company I work
> for, dubbed "pallet". I recently got the go-ahead to release it on
> RubyForge under the LGPL, so have spent the past day or so getting it up
> on there.

oh, this is great! I just grabbed it and like it. :)

one small note:

the created debian files contain references to what i think is one of
your personal projects: non-free/damballa (see debian/files for
examples). Maybe this can be customized when you debianize a project.

Thanks a lot for making this public!


Cheers,

- Steph.

Tomas Pospisek

5/4/2007 8:26:00 AM

0

Stephen Touset

5/4/2007 4:04:00 PM

0

On May 2, 9:54 am, Stephan Mueller <d...@web.de> wrote:
> one small note:
>
> the created debian files contain references to what i think is one of
> your personal projects: non-free/damballa (see debian/files for
> examples). Maybe this can be customized when you debianize a project.

Oops. I still have a little work to do to remove some of the company-
specific assumptions. Thanks for the heads-up. Please let me know if
you find anything else!

--
Stephen Touset <stephen@touset.org>

Stephen Touset

5/4/2007 4:06:00 PM

0

On May 4, 4:25 am, Tomas Pospisek's Mailing Lists <t...@sourcepole.ch>
wrote:
> On Wed, 2 May 2007, Stephen Touset wrote:
> > I've been writing a multiplatform packaging tool for the company I work
> > for, dubbed "pallet".
> [...]
> > Right now, gem and dpkg are the only formats supported, although adding
> > .tar.gz should be trivial, and .rpm should be simple enough for anyone
> > who's built an RPM.
>
> Have you been talking to Debian's Ruby packagers? Mutating this into
> something like "rake dpkg", that would automagically turn any ruby gem
> into a Debian package would be brilliant :-o

I did send an email to the debian-ruby-extras mailing list, but
haven't heard anything back.

I'm about to start writing (time-willing) a Pallet::Gem2Deb module,
which should simply wrap around the Pallet::Deb builder. Basically,
feed it the task to build a gem, and it will handle the whole thing
for you -- including extracting relevant metadata from the Gem and
applying it automagically.

Stephen Touset

5/4/2007 10:40:00 PM

0

On Wed, 02 May 2007 18:46:15 +0900, Brian Candler wrote:
>
> Right now I'm using a different approach: gem2spec takes a gem and turns it
> into an RPM spec file. Unlike the native .deb packages you're generating
> under Pallet, the components are installed under /usr/lib/ruby/gems/1.8 not
> /usr/lib/ruby/1.8.
>
> *snip*
>
> With Pallet, you can tell it what files to bundle together to build a
> package. But what about the initial fetch/untar/configure/build/install
> steps? It would be very attractive to write these once in ruby (or rake),
> but I don't think Pallet provides rules for this. Are there existing
> libraries of rake tasks to do these steps?

Not of rake tasks, but you could easily write a rake task which downloads
the file to somewhere predictable.

--
Stephen Touset <stephen@touset.org>

Stephan Mueller

5/5/2007 4:38:00 PM

0

* stephen@touset.org <stephen@touset.org> [04.05.2007]:

> Oops. I still have a little work to do to remove some of the company-
> specific assumptions. Thanks for the heads-up. Please let me know if
> you find anything else!

i've using pallet now for 3 or 4 projects here and still like it. :) I
am thinking about enhance pallet in a way that allows it to rebuild all
debian package control files on the fly, when the user whishes to do so.
This would allow to get packages with an up-to-date package version etc.
without handediting these files. What do you think about that?

Maybe a simple template engine could be used to handle build these files
on the fly and give the package maintainer full control on this.


Cheers,

Steph

Brian Candler

5/5/2007 6:20:00 PM

0

On Sat, May 05, 2007 at 07:45:10AM +0900, Stephen Touset wrote:
> > With Pallet, you can tell it what files to bundle together to build a
> > package. But what about the initial fetch/untar/configure/build/install
> > steps? It would be very attractive to write these once in ruby (or rake),
> > but I don't think Pallet provides rules for this. Are there existing
> > libraries of rake tasks to do these steps?
>
> Not of rake tasks, but you could easily write a rake task which downloads
> the file to somewhere predictable.

Sure, but I was thinking of using it as a generic way to package third-party
software and use it to generate, say, .deb and .rpm

RPM is what I'm more familiar with. It has a 'spec' file which directs the
build. But it has sensible default macros for:
- untar source into a work directory
- apply patch(es)
- configure
- make
- make install

You can override any of these, but the defaults work in the majority of
cases.

Now, if I had to then package the same software as .deb, I'd have to write
(and first learn) Debian control files.

If I could specify the package building once - in Ruby - that would be
great.

Regards,

Brian.