.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "DH_RUBY 1" .TH DH_RUBY 1 2024-04-08 "" "" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME dh_ruby \- debhelper build system for Ruby software .SH SYNOPSIS .IX Header "SYNOPSIS" \&\fBdh_ruby\fR [\fIOPTIONS\fR] .SH DESCRIPTION .IX Header "DESCRIPTION" \&\fBdh_ruby\fR is a Debhelper build system for Ruby software. It will automatically build and install files contained in Ruby packages, trying to work as close to Rubygems as possible but respecting Debian standards for Ruby packages. .PP dh_ruby can automatically run your tests against all supported Ruby versions, see the "FILES" section below. .PP See dh_ruby \-\-help for details. .SH "SOURCE PACKAGE LAYOUT" .IX Header "SOURCE PACKAGE LAYOUT" \&\fBdh_ruby\fR supports two different source package styles: single-binary source packages, and multi-binary source packages. .SS "Single-binary layout" .IX Subsection "Single-binary layout" The default layout is the \fBsingle-binary\fR layout. This is the layout used by most Ruby packages upstream, i.e. Ruby code in \fIlib\fR/, executable programs in \&\fIbin\fR/, etc. Packages imported from Rubygems using \fBgem2deb\|(1)\fR will have this layout. .PP When using this layout, \fBdh_ruby\fR will install files (Ruby code, executables, gemspecs) to the \fIfirst binary package\fR listed in \&\fIdebian/control\fR. .SS "Multi-binary layout" .IX Subsection "Multi-binary layout" \&\fBgem2deb\fR version \fI0.4.0\fR introduced support for the \fBmulti-binary\fR layout. This layout should be used when you have a set of different Ruby packages maintained upstream in a single VCS, and you decide that you also want to maintain a single source package in Debian having the different components as separate binary packages. .PP In this layout, the source package contains the separate components in subdirectories where each of them will use the standard Ruby layout (\fIlib\fR/, \fIbin\fR/, etc). .PP This layout does not support creating separate binary packages from the same root directory. For those cases, see the documentation on \&\fIDH_RUBY_USE_DH_AUTO_INSTALL_DESTDIR\fR below. .PP To indicate that you want to use a multi-binary layout, we have to 1) list your multiple binary packages in \fIdebian/control\fR as usual, and add an extra-field called \fIX\-DhRuby-Root\fR to each binary package stanza, indicating which directory has to be used as the root for that binary package. .PP An example: .PP .Vb 2 \& Source: mymultibinarypackage \& [...] \& \& Package: ruby\-foo \& X\-DhRuby\-Root: path/to/foo \& [...] \& \& Package: ruby\-bar \& X\-DhRuby\-Root: path/to/bar .Ve .PP The corresponding source package should be layed out like this: .PP .Vb 11 \& foo/ \& foo.gemspec \& lib/ \& foo.rb \& bin/foo \& bar/ \& bar.gemspec \& lib/ \& bar.rb \& bin/ \& bar .Ve .PP Important notes about multi-binary packages and the usage of \&\fIX\-DhRuby-Root\fR: .IP \(bu 4 If your package uses the multi-binary layout, it must include `\fIgem2deb\fR (>= 0.4.0~)` in \fIBuild-Depends\fR. .Sp \&\fBVersion 0.4.0 had a bug in the support for native extensions\fR in multi-binary packages, so if your package uses the multi-binary feature and at least one of the sub-components has native extensions, you must use `\fIgem2deb\fR (>= 0.4.1~)` in \fIBuild-Depends\fR instead. .IP \(bu 4 The path indicated in \fIX\-DhRuby-Root\fR, as you have probably guessed by now, must be relative to the root of the source package. .IP \(bu 4 If any binary package declares a \fIX\-DhRuby-Root\fR field, all other binary packages that don't have one will be ignored by \fBdh_ruby\fR. .SH OPTIONS .IX Header "OPTIONS" .IP "\fB\-\-clean\fR, \fB\-\-configure\fR, \fB\-\-build\fR, \fB\-\-test\fR, \fB\-\-install\fR" 4 .IX Item "--clean, --configure, --build, --test, --install" Commands called by debhelper at various steps of the build process. .IP \fB\-\-print\-supported\fR 4 .IX Item "--print-supported" Prints the supported Ruby versions. .IP "\fB\-h\fR, \fB\-\-help\fR" 4 .IX Item "-h, --help" Displays \fBdh_ruby\fR usage information. .IP "\fB\-v\fR, \fB\-\-version\fR" 4 .IX Item "-v, --version" Displays \fBdh_ruby\fR version information. .IP \fB\-\-gem\-install\fR 4 .IX Item "--gem-install" This option indicates that the build should use the \fBgem\fR command to install the files, instead of the homegrown installer. Native packages will be installed to \fI/usr/lib/$ARCH/rubygems\-integration/$RUBY_VERSION\fR, while pure Ruby packages will be installed to \fI/usr/share/rubygems\-integration/all\fR. .Sp There is an internal include list of directories from the source package that need to be installed, but we can't possibly know all possibilities: if a package needs to install a directory that is not automatically installed, use \&\fIDH_RUBY_GEM_INSTALL_INCLUDE\fR. If you want to exclude a directory from being installed, use \fIDH_RUBY_GEM_INSTALL_EXCLUDE\fR. Note that for using those variables, you need to build depend on gem2deb (>= 1.6~). .SH "COMPATIBILITY LEVELS" .IX Header "COMPATIBILITY LEVELS" dh_ruby reuses the \fBdebhelper\fR(7) compatibility levels for introducing behavior changes that might be backwards-incompatible. .IP v14 4 .IX Item "v14" This level is still open for development; use with caution. .Sp Changes from v13 are: .Sp Packages are built and tested when executing the \fBbuild\fR target of \&\fIdebian/rules\fR. The build is done as part of \fBdh_auto_build\fR, and the tests are run as part of \fBdh_auto_test\fR. The installation into debian/ is performed during the \fBinstall\fR target, i.e. during \fBdh_auto_install\fR. This means that you can intercept the build between these steps using targets such \&\fBexecute_after_dh_auto_build\fR, \fBoverride_dh_auto_build\fR, \&\fBoverride_dh_auto_test\fR, \fBexecute_before_dh_auto_install\fR etc. .IP v13 4 .IX Item "v13" This is the recommended mode of operation. .Sp This was the current compatibility level at the point where this mechanism was introduced. So even packages with compatibility levels lower than 13 use this mode. .Sp In this this compatibility level, dh_ruby exhibits its classic behavior. In particular, packages are built, installed and tested during the \&\fBdh_auto_install\fR phase of the build process, i.e. when dpkg-buildpackage is invoking the \fBinstall\fR target of \fIdebian/rules\fR. .SH "SUBSTITUTION VARIABLES" .IX Header "SUBSTITUTION VARIABLES" .IP \fI${ruby:Depends}\fR 4 .IX Item "${ruby:Depends}" ${ruby:Depends} will expand to the runtime dependencies of the package. This is determined by taking the runtime dependencies from the Rubygems metadata, and then mapping them to Debian package names. .Sp The relevant packages must be installed during the package build for the mapping to be successful (normally they should be hardcoded in the Build-Depends: field). .SH "ENVIRONMENT VARIABLES" .IX Header "ENVIRONMENT VARIABLES" .IP \fIDH_RUBY\fR 4 .IX Item "DH_RUBY" Use this variable to pass command line parameters to dh_ruby. For example in debian/rules: .Sp .Vb 1 \& export DH_RUBY = \-\-gem\-install .Ve .IP \fIDH_RUBY_IGNORE_TESTS\fR 4 .IX Item "DH_RUBY_IGNORE_TESTS" This is a space-separated list of tests that dh_ruby will ignore during package build. The available test names are the names of all supported Ruby versions (you can list them with `dh_ruby \-\-print\-supported`). .Sp If set to "all", all tests will be ignored during the package build. .IP \fIDH_RUBY_USE_DH_AUTO_INSTALL_DESTDIR\fR 4 .IX Item "DH_RUBY_USE_DH_AUTO_INSTALL_DESTDIR" If this variable is defined (to anything), dh_ruby will respect the directory informed by \fBdh_auto_install\fR\|(1), usually \fIdebian/tmp\fR. By default, gem2deb will install files to debian/\fIpackage\fR, where \fIpackage\fR is the first binary package listed in debian/control. .Sp This is useful for multi-binary source packages that don't conform to the supported layout (i.e. separate subdirectories each with \fIlib\fR/, \&\fIbin\fR/ etc). Using this, all files will be installed to \fIdebian/tmp\fR, and you can them distribute them into separate binary packages by using \&\fIdebian/$package.install\fR files or explicit shell calls in \&\fIdebian/rules\fR. .Sp Mixing \fIDH_RUBY_USE_DH_AUTO_INSTALL_DESTDIR\fR and multi-binary layout is not supported. .IP \fIDH_RUBY_GEMSPEC\fR 4 .IX Item "DH_RUBY_GEMSPEC" Determines which file contain the gem specification with package metadata. By default, dh_ruby will read metadata from a .gemspec file in the root of source package directory. You can use this variable to override that if you want to provide custom metadata for the Debian package. .Sp In the case there are more than one .gemspec in the source package root, you will \fIneed\fR to use DH_RUBY_GEMSPEC to instruct dh_ruby about which one to use. .IP \fIDH_RUBY_GEM_INSTALL_INCLUDE\fR. 4 .IX Item "DH_RUBY_GEM_INSTALL_INCLUDE." When using \-\-gem\-install, this variable adds \fBfiles\fR to the list of files that need to be installed. Entries must be separated by spaces, and can be either exact filenames, of glob expressions (e.g. \fI*.txt\fR, \fIfoo/*\fR). .Sp Directories cannot be added directly, only files. If you want to include an entire directory, say \fIfoo\fR, use a glob expression like \fIfoo/*\fR. .Sp Note that by default all top-level files are automatically excluded, except \&\fIVERSION*\fR which is used by some packages. If you need a top-level file to be installed, you need to explicit list it as included. .IP \fIDH_RUBY_GEM_INSTALL_EXCLUDE\fR. 4 .IX Item "DH_RUBY_GEM_INSTALL_EXCLUDE." When using \-\-gem\-install, this variable adds files to the list of files that SHOULD NOT be installed. Entries must be separated by spaces, and must be either specific filenames, or glob expressions (e.g. \fI*.txt\fR). .Sp Directories cannot be excluded directly. To exclude an entire directory, use a glob expression such as \fIfoo/*\fR. .SH FILES .IX Header "FILES" .IP "debian/\fIruby\-test\-files.yaml\fR, debian/\fIruby\-tests.rake\fR, debian/\fIruby\-tests.rb\fR" 4 .IX Item "debian/ruby-test-files.yaml, debian/ruby-tests.rake, debian/ruby-tests.rb" Theses files can be used to explicitly tell dh_ruby how to run the tests in your package. When running the tests, dh_ruby will automatically set RUBYLIB to include the appropriate directories where the package files were installed in your package to make sure the tests use them instead of the files in the source directory. .Sp \&\fBYour package can only contain at most one of these files.\fR .Sp debian/\fIruby\-test\-files.yaml\fR must contain a YAML document with a list of test files to be run. If the package metadata contains an explicit list of test files, \fBgem2deb\fR\|(1) will automatically generate this file for you. Example from ruby-mime-types: .Sp .Vb 3 \& \-\-\- \& \- test/test_mime_type.rb \& \- test/test_mime_types.rb .Ve .Sp debian/\fIruby\-tests.rake\fR can be used to run the tests with \fBrake\fR\|(1). You can use anything you would use in a regular Rakefile, but you must define a default task. gem2deb includes a utility test task that makes it easier for you by creating a default task automatically. Example: .Sp .Vb 4 \& require \*(Aqgem2deb/rake/testtask\*(Aq \& Gem2Deb::Rake::TestTask.new do |t| \& t.test_files = FileList[\*(Aqtest/*_test.rb\*(Aq] \& end .Ve .Sp You can also use the equivalent RSpec task: .Sp .Vb 4 \& require \*(Aqgem2deb/rake/spectask\*(Aq \& Gem2Deb::Rake::RSpecTask.new do |spec| \& spec.pattern = \*(Aq./spec/**/*_spec.rb\*(Aq \& end .Ve .Sp If debian/\fIruby\-tests.rb\fR exists, it will be run with each supported Ruby version, and must finish with a exit status of \fI0\fR, otherwise dh_ruby assumes the tests failed. A simple example: .Sp .Vb 7 \& require \*(Aqtest/unit\*(Aq \& require \*(Aqmypackage\*(Aq # if \*(Aqmypackage.rb\*(Aq or \*(Aqmypackage.so\*(Aq was not installed properly, this will fail \& class MyPackageTest < Test::Unit::TestCase \& def test_features \& assert_equal 4, MyPackage.sum(2,2) \& end \& end .Ve .IP "debian/tests/assets (directory)" 4 .IX Item "debian/tests/assets (directory)" For Rails assets packages (ruby\-rails\-assets\-*), the presence of this directory will cause the Rails assets smoke test to be run. During the test run, this directory will be copied into under app/ in a freshly created rails application, and `bundle exec rake assets:precompile` will be called. .Sp \&\fBdebian/tests/assets\fR should contain example usage of the given package, e.g.: .RS 4 .IP \fBdebian/tests/assets/javascripts/application.js\fR 4 .IX Item "debian/tests/assets/javascripts/application.js" .PD 0 .IP \fBdebian/tests/assets/stylesheets/application.scss\fR 4 .IX Item "debian/tests/assets/stylesheets/application.scss" .RE .RS 4 .PD .Sp In the above example, those files will be copied at the following location in the test Rails app: .IP \fBapp/assets/javascripts/application.js\fR 4 .IX Item "app/assets/javascripts/application.js" .PD 0 .IP \fBapp/assets/stylesheets/application.scss\fR 4 .IX Item "app/assets/stylesheets/application.scss" .RE .RS 4 .PD .Sp \&\fBNote\fR: any dependencies needed to run this smoke test must be specified explicitly as package build dependencies. .RE .IP debian/\fIdh_ruby.mk\fR 4 .IX Item "debian/dh_ruby.mk" If this file is present, dh_ruby will call \fBmake\fR passing it as the makefile during the build, in the \fIclean\fR, \fIbuild\fR, and \fIinstall\fR steps, like this: .RS 4 .IP "clean: \fBmake \-f debian/dh_ruby.mk clean\fR" 4 .IX Item "clean: make -f debian/dh_ruby.mk clean" .PD 0 .IP "build: \fBmake \-f debian/dh_ruby.mk\fR" 4 .IX Item "build: make -f debian/dh_ruby.mk" .IP "install: \fBmake \-f debian/dh_ruby.mk install\fR" 4 .IX Item "install: make -f debian/dh_ruby.mk install" .RE .RS 4 .PD .Sp If you want the upstream Makefile to be used, just make \fIdebian/dh_ruby.mk\fR a symlink to \fI../Makefile\fR. .RE .IP debian/\fIdh_ruby.rake\fR 4 .IX Item "debian/dh_ruby.rake" If this file is present, dh_ruby will call \fBrake\fR passing it as the rakefile during the build, in the \fIclean\fR, \fIbuild\fR, and \fIinstall\fR steps, like this: .RS 4 .IP "clean: \fBrake \-f debian/dh_ruby.rake clean\fR" 4 .IX Item "clean: rake -f debian/dh_ruby.rake clean" .PD 0 .IP "build: \fBrake \-f debian/dh_ruby.rake\fR" 4 .IX Item "build: rake -f debian/dh_ruby.rake" .IP "install: \fBrake \-f debian/dh_ruby.rake install\fR" 4 .IX Item "install: rake -f debian/dh_ruby.rake install" .RE .RS 4 .PD .Sp If you want the upstream Rakefile to be used, just make \fIdebian/dh_ruby.rake\fR a symlink to \fI../Rakefile\fR. .RE .IP debian/\fIgemspec\fR 4 .IX Item "debian/gemspec" If this file exists, it will be used as the package gemspec, regardless of \&\fImetadata.yml\fR and any \fI*.gemspec\fR that exists in the upstream source. Using this is only advised on single-binary source packages, and the behavior of this feature is undefined for multi-binary source packages (see \fBSOURCE PACKAGE LAYOUT\fR above). .Sp If debian/\fIgemspec\fR is a symlink, it will first be expanded, and then the symlink target will be used as a gemspec. .Sp Hint: for packages with multiple gemspec, you can have debian/\fIgemspec\fR as a symlink pointing to the one you want to use. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBgem2deb\fR(1) .SH "COPYRIGHT AND AUTHORS" .IX Header "COPYRIGHT AND AUTHORS" Copyright (c) 2011, Lucas Nussbaum .PP 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. .PP 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. .PP You should have received a copy of the GNU General Public License along with this program. If not, see .