GEM2DEB(1)

πŸ’Ž GEM2DEB(1) πŸ’Ž

okay bestie, pull up a chair 🫢 this is gem2deb from section 1 of the manual, and she's about to turn your cute little Ruby gem into a whole Debian package. no cap.


✨ NAME ✨

gem2deb β€” converts Rubygems' .gem file into Debian package πŸ’…


🌸 SYNOPSIS 🌸

gem2deb [OPTIONS] GEMNAME (to download the gem with gem fetch)

gem2deb [OPTIONS] GEMFILE (to use a local .gem file)

so like β€” either you hand her a GEMNAME and she goes and fetches it with gem fetch, or you hand her an actual local GEMFILE. either way she eats. πŸ“


πŸ’– DESCRIPTION πŸ’–

so gem2deb takes your gem, turns it into a Debian source package, and then tries to build it. the whole thing is a multi-step situation, like a little ritual. let's break it down:

step one β€” she converts the gem file into a tar.gz archive, and inside there's a metadata.yml file holding the Gem specification. this is literally the same thing gem2tgz does. iconic behavior.

step two β€” she unpacks that tar.gz archive and preps a Debian source package, guessing a lot of the defaults from the files inside the archive, or from the Gem specification. this is equivalent to what dh-make-ruby does. now ngl, gem2deb can't figure out every single parameter, for obvious reasons πŸ™ˆ so pls pls pls go search for the "FIXME" string inside the debian/ directory. she left you notes bestie, read them. the generated Debian source package uses dh_ruby to build the package.

step three β€” she tries to build the source and binary packages using dpkg-buildpackage. main character energy fr fr.


✨ OPTIONS ✨

  • -t, --only-tarball β€” stop right after creating the tar.gz archive. that's it, that's the whole job.
  • -s, --only-source-dir β€” stop after preparing the Debian source package directory. do not attempt to build the package.
  • -S, --only-debian-source β€” only build a Debian source package, no binary packages. source-only era πŸ’…
  • -d, --no-check-builddeps β€” don't check build dependencies when building the package. equivalent to the option with the same name in dpkg-buildpackage(1).
  • -p PACKAGE, --package PACKAGE β€” specify the package name (default: ruby-*). this gets passed to dh-make-ruby. see dh-make-ruby(1).
  • -g, --git β€” import the resulting source package, if there is one, into a git repository under the current directory. the git repo gets named after the source package (so yes, it's influenced by --package πŸ‘€).

heads up though: --only-tarball or --only-source-dir will prevent this, because they make gem2deb stop early. girl's gone, she can't import anything.

the import uses gbp import-dsc --pristine-tar (see gbp-import-dsc(1)), so for this to work you need git-buildpackage and pristine-tar installed. no downloads, no import πŸ’€

  • --purge β€” after building the package, remove all the files that gem2deb produced. all of them. source tarballs, Debian package artifacts (.dsc, .deb, .changes etc), and yes β€” even the source directory itself. lowkey ruthless. this is useful for example when you use it together with --git.
  • --no-wnpp-check β€” stops dh-make-ruby from checking WNPP reports to get the number of a possible ITP (intend to package) bug report. by default dh-make-ruby does check those reports, which requires an Internet access. so if you're offline-ish, this is your girl.
  • -o, --offline β€” prevents dh-make-ruby from accessing the internet at all. zero wifi, zero problems ✨
  • -h, --help β€” displays gem2deb usage information. when in doubt, ask her.
  • -v, --version β€” displays gem2deb version information. know your queen's number πŸ‘‘

πŸ¦‹ HOW THE .GEM -> .TGZ CONVERSION WORKS πŸ¦‹

okay so a gem named mygem-0.1.0.gem gets converted into a tarball with (approximately) these steps:

mkdir mygem-0.1.0
cd mygem-0.1.0
tar xfm /absolute/path/to/mygem-0.1.0.gem
tar xzfm data.tar.gz
zcat metadata.gz > metadata.yml
rm -f data.tar.gz metadata.gz
cd ..
tar czf mygem-0.1.0.tar.gz mygem-0.1.0
rm -rf mygem-0.1.0

look at her go 😭 so clean. so organized.

🌈 the generated tarball has the following properties 🌈

  • Files β€” it contains all the files the gem contains. every single one. no crumbs left behind πŸ“
  • Metadata β€” it contains the gem metadata in a file named metadata.yml inside the mygem-0.1.0 directory.

πŸ‘‘ SEE ALSO πŸ‘‘

dh_ruby(1)


Copyright (c) 2011, Lucas Nussbaum <lucas@debian.org>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.


and that's the whole page bestie πŸŽ€ slay. this was gem2deb(1), version dated 2026-05-15 β€” thanks for reading, mwah πŸ’–βœ¨

πŸ“¦ where this page comes from