commit 777bab010a84734a7428a836158745b1ca1c3eaa Author: Nicolas Vigier boklm@torproject.org Date: Sat Apr 25 14:32:27 2020 +0200
Bug 33991: Remove unused features
For simplification, we remove some unused features. Those features can still be reimplemented externally if needed.
For example, the "rbm rpm" command can be replaced with "rbm build --step rpm" and a definition of an rpm step in rbm.conf.
We remove the following options: - version_command - rpm - rpmbuild - srpm - rpmspec - rpm_rel - debian_create - deb - deb_src - use_pbuilder - debian_revision
And the following commands: - rpmspec - rpm - srpm - deb-src - deb - pkg - publish --- NEWS | 5 ++ doc/Makefile | 7 -- doc/clioptions_deb.asc | 7 -- doc/clioptions_publish.asc | 2 - doc/documentation.asc | 7 -- doc/features.asc | 13 ---- doc/options_deb.asc | 36 --------- doc/options_pkg.asc | 6 -- doc/options_publish.asc | 5 -- doc/options_rpm.asc | 25 ------ doc/rbm-deb-src.asc | 40 ---------- doc/rbm-deb.asc | 40 ---------- doc/rbm-pkg.asc | 33 -------- doc/rbm-publish.asc | 97 ------------------------ doc/rbm-rpm.asc | 36 --------- doc/rbm-rpmspec.asc | 25 ------ doc/rbm-srpm.asc | 36 --------- doc/rbm-usage.asc | 8 +- doc/rbm_cli.asc | 4 - doc/rbm_config.asc | 32 ++------ doc/rbm_input_files.asc | 14 ++-- doc/rbm_remote.asc | 9 +-- doc/rbm_steps.asc | 12 +-- doc/rbm_targets.asc | 35 ++++----- doc/rbm_templates.asc | 8 +- doc/rbm_tutorial.asc | 42 +++++++++-- doc/version.asc | 11 +-- lib/RBM.pm | 42 ++--------- lib/RBM/DefaultConfig.pm | 167 +---------------------------------------- packages/.gitignore | 2 - packages/keyring/boklm.gpg | Bin 3479 -> 0 bytes packages/projects/rbm/config | 10 --- packages/projects/rbm/rbm.spec | 29 ------- packages/rbm.conf | 2 - rbm | 59 +-------------- test.pl | 8 +- 36 files changed, 103 insertions(+), 811 deletions(-)
diff --git a/NEWS b/NEWS index e54f988..9358901 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +- Remove the version_command, rpm, srpm, rpmbuild, rpmspec, rpm_rel, + debian_create, deb, deb_src, use_pbuilder, and debian_revision options, + as well as the rpmspec, rpm, srpm, deb-src, deb, pkg, and the publish + commands. All of these features can still be implemented externally. + - Add the target_append and target_prepend input_files options
- Add the build_log_append option diff --git a/doc/Makefile b/doc/Makefile index 593ecba..8564a19 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -27,14 +27,7 @@ MAN1_ASC += rbm.asc MAN1_ASC += rbm-usage.asc MAN1_ASC += rbm-tar.asc MAN1_ASC += rbm-showconf.asc -MAN1_ASC += rbm-srpm.asc -MAN1_ASC += rbm-rpm.asc -MAN1_ASC += rbm-rpmspec.asc MAN1_ASC += rbm-fetch.asc -MAN1_ASC += rbm-deb-src.asc -MAN1_ASC += rbm-deb.asc -MAN1_ASC += rbm-pkg.asc -MAN1_ASC += rbm-publish.asc MAN1_ASC += rbm-build.asc
MAN7_ASC += rbm_tutorial.asc diff --git a/doc/clioptions_deb.asc b/doc/clioptions_deb.asc deleted file mode 100644 index 69f8bdc..0000000 --- a/doc/clioptions_deb.asc +++ /dev/null @@ -1,7 +0,0 @@ - --use-pbuilder:: - --no-use-pbuilder:: - Whether to use pbuilder when building debian packages - - --debsign-keyid=<key id>:: - The id of the key to sign debian packages with. Set to 0 for no - signature. diff --git a/doc/clioptions_publish.asc b/doc/clioptions_publish.asc deleted file mode 100644 index 5f797cd..0000000 --- a/doc/clioptions_publish.asc +++ /dev/null @@ -1,2 +0,0 @@ ---publish-src-dir:: - The directory containing the files that are going to be published. diff --git a/doc/documentation.asc b/doc/documentation.asc index 82b5e62..4c5c9bc 100644 --- a/doc/documentation.asc +++ b/doc/documentation.asc @@ -15,12 +15,5 @@ rbm commands : - link:rbm-tar.html[rbm-tar(1)] - link:rbm-showconf.html[rbm-showconf(1)] - link:rbm-build.html[rbm-build(1)] -- link:rbm-srpm.html[rbm-srpm(1)] -- link:rbm-rpm.html[rbm-rpm(1)] -- link:rbm-rpmspec.html[rbm-rpmspec(1)] - link:rbm-fetch.html[rbm-fetch(1)] -- link:rbm-deb-src.html[rbm-deb-src(1)] -- link:rbm-deb.html[rbm-deb(1)] -- link:rbm-pkg.html[rbm-pkg(1)] -- link:rbm-publish.html[rbm-publish(1)]
diff --git a/doc/features.asc b/doc/features.asc index f6f9116..ec68cbc 100644 --- a/doc/features.asc +++ b/doc/features.asc @@ -10,19 +10,6 @@ package creation:: Create binary or source packages from any git or mercurial revision using a simple command.
-packages upload:: - Upload the packages that you have built to a repository and - update metadata. - -multi-os support:: - RPM and debian packages are currently supported. Support for - more packaging systems could easily be added. Using package - templates and the http://www.template-toolkit.org/%5BTemplate - Toolkit], you can make different packages for different - distributions using the same files. The syntax of this templating - system is much more clear and powerful than the RPM macros - syntax. - remote builds:: Build your software on a remote server with ssh, or in a local chroot using a different OS. For instance if you are using diff --git a/doc/options_deb.asc b/doc/options_deb.asc deleted file mode 100644 index 12b4a30..0000000 --- a/doc/options_deb.asc +++ /dev/null @@ -1,36 +0,0 @@ -debian_revision:: - The package revision used in debian packages. By default, when - the option +pkg_rel+ is defined, this is what is used. Otherwise - a revision containing the number of commits since the last git - tag, and the hash of the commit is used. - -deb_src:: - This is the script that is used to create the debian source - package. By default it will use the debian files listed in the - option +debian_files+ and create the source package with - dpkg-source. - -deb:: - This is the script that is used to create the debian packages. - By default it will use the debian files listed in the option - +debian_files+ and build the package using debuild or pdebuild - depending on whether the +use_pbuilder+ option is set. The - packages will be signed using the key defined in the option - +debsign_keyid+. - -debian_files:: - This is an array containing the files to create in the debian - directory. Each item in the array is an hash, with the following - two keys : +name+ is the file name in the debian directory of - the file to create, and +content+ is the content of the file. - The filename and content are processed as template, so for - instance if you want to store the content of a file in a separate - file, you can use the INCLUDE directive. - -use_pbuilder:: - If set to a true value, pbuilder will be used to build the - debian packages. - -debsign_keyid:: - This is the gpg key that will be used to sign the debian packages. - Set to 0 if you don't want to sign the packages. diff --git a/doc/options_pkg.asc b/doc/options_pkg.asc deleted file mode 100644 index 8542973..0000000 --- a/doc/options_pkg.asc +++ /dev/null @@ -1,6 +0,0 @@ -pkg_type:: - This is the name of the option that will be used by the +pkg+ - command as the script to build the package. This can be +rpm+ - or +deb+ for rpm and debian packages. This option is usually - set in distribution specific configuration as it depends on the - distribution being used. diff --git a/doc/options_publish.asc b/doc/options_publish.asc deleted file mode 100644 index 43d494c..0000000 --- a/doc/options_publish.asc +++ /dev/null @@ -1,5 +0,0 @@ -publish:: - This is the content of the script that is used to upload the - packages or files to a repository. This script will be executed - from the directory containing the files to publish. This option - has no default value. diff --git a/doc/options_rpm.asc b/doc/options_rpm.asc deleted file mode 100644 index b7a7489..0000000 --- a/doc/options_rpm.asc +++ /dev/null @@ -1,25 +0,0 @@ -rpm_rel:: - RPM package release number. The default is to use the option - +pkg_rel+ if defined, otherwise use a release number containing - the number of commits since the last git tag, and the hash of - the commit used. - -rpmspec:: - This is the content of the rpm spec file, used by the +rpm+ and - +srpm+ commands. The default is to include the template file named - +project.spec+ (with +project+ replaced by the project's name). - -rpmbuild:: - This is the content of the script to build a rpm or srpm. It is - using the +rpmbuild_action+ option to select the build action - ('-bs' to build a source package, or '-ba' to build all packages). - -rpm:: - This is the script that is used to build an rpm package, in the - +rpm+ command. By default it is using the +rpmbuild+ option with - the '-ba' action. - -srpm:: - This is the script that is used to build a source rpm package, - in the +srpm+ command. By default it is using the +rpmbuild+ - option with the '-bs' action. diff --git a/doc/rbm-deb-src.asc b/doc/rbm-deb-src.asc deleted file mode 100644 index d0212ea..0000000 --- a/doc/rbm-deb-src.asc +++ /dev/null @@ -1,40 +0,0 @@ -rbm-deb-src(1) -============== - -NAME ----- -rbm-deb-src - Create debian source package - - -SYNOPSIS --------- -[verse] -'rbm deb-src' <project> [options] - -DESCRIPTION ------------ - -Create a debian source package for the selected project. - -This is equivalent to running 'rbm build --step deb_src <project>'. - -CONFIGURATION OPTIONS ---------------------- - -The following configuration options are related to Debian packages : - -include::options_deb.asc[] - -See link:rbm_config.html[rbm_config(7)] for all other options. - -COMMAND LINE OPTIONS --------------------- -The command line options related to Debian packages are : - -include::clioptions_deb.asc[] - -See link:rbm_cli.html[rbm_cli(7)] for all other options. - -SEE ALSO --------- -link:rbm.html[rbm(1)] diff --git a/doc/rbm-deb.asc b/doc/rbm-deb.asc deleted file mode 100644 index 0544b89..0000000 --- a/doc/rbm-deb.asc +++ /dev/null @@ -1,40 +0,0 @@ -rbm-deb(1) -========== - -NAME ----- -rbm-deb - Build a debian package - - -SYNOPSIS --------- -[verse] -'rbm deb' <project> [options] - -DESCRIPTION ------------ - -Build a debian package. - -This is equivalent to running 'rbm build --step deb <project>'. - -CONFIGURATION OPTIONS ---------------------- - -The following configuration options are related to Debian packages : - -include::options_deb.asc[] - -See link:rbm_config.html[rbm_config(7)] for all other options. - -COMMAND LINE OPTIONS --------------------- -The command line options related to Debian packages are : - -include::clioptions_deb.asc[] - -See link:rbm_cli.html[rbm_cli(7)] for all other options. - -SEE ALSO --------- -link:rbm.html[rbm(1)] diff --git a/doc/rbm-pkg.asc b/doc/rbm-pkg.asc deleted file mode 100644 index 23ddaa9..0000000 --- a/doc/rbm-pkg.asc +++ /dev/null @@ -1,33 +0,0 @@ -rbm-pkg(1) -========== - -NAME ----- -rbm-pkg - Build a package - - -SYNOPSIS --------- -[verse] -'rbm pkg' <project> [options] - -DESCRIPTION ------------ - -Build a package for the selected project. Depending on configuration or -selected distribution, this can be an rpm, deb or other type of package. - -CONFIGURATION OPTIONS ---------------------- - -include::options_pkg.asc[] - -See link:rbm_config.html[rbm_config(7)] for all other options. - -COMMAND LINE OPTIONS --------------------- -See link:rbm_cli.html[rbm_cli(7)]. - -SEE ALSO --------- -link:rbm.html[rbm(1)] diff --git a/doc/rbm-publish.asc b/doc/rbm-publish.asc deleted file mode 100644 index f8ad50f..0000000 --- a/doc/rbm-publish.asc +++ /dev/null @@ -1,97 +0,0 @@ -rbm-publish(1) -============== - -NAME ----- -rbm-publish - Publish some packages or files - - -SYNOPSIS --------- -[verse] -'rbm publish' <project> [--publish-src-dir=<dir>] [options] - -DESCRIPTION ------------ - -Build a package and publish it. See link:rbm-pkg.html[rbm-pkg(1)] -for details about how the package is built. - -If the option '--publish-src-dir' is used, then the package is not built, -and instead the packages or files present in that directory are published. - -CONFIGURATION OPTIONS ---------------------- - -include::options_publish.asc[] - -See link:rbm_config.html[rbm_config(7)] for all other options. - -COMMAND LINE OPTIONS --------------------- -The command line options related to publish are : - -include::clioptions_publish.asc[] - -See link:rbm_cli.html[rbm_cli(7)] for all other options. - -EXAMPLES --------- - -In this example, we want to publish packages for Mageia and Debian. On -Mageia, the repository metadata are generated using 'genhdlist2'. On -Debian the new package is included in the repository using 'reprepro'. - -The rbm configuration looks like this : ----- -targets: - Mageia: - repo_dir: /path/to/mageia/repo - publish: | - #!/bin/sh - cp -va noarch/*.rpm [% c('repo_dir') %] - genhdlist2 [% c('repo_dir') %] - Debian: - repo_dir: /path/to/debian/repo - publish: | - #!/bin/sh - reprepro -b [% c('repo_dir') %] include \ - [% c('lsb_release/codename') %] *.changes ----- - -If we want to upload the packages on a remote server, before including -them on the repository, this can be done like this : - ----- -targets: - Debian: - repo_dir: /path/to/debian/repo - publish: | - #!/bin/sh - reprepro -b [% c('repo_dir') %] include \ - [% c('lsb_release/codename') %] *.changes -steps: - publish: - ssh_host: publish_server.somedomain - remote_exec: "[% c('remote_ssh') %]" ----- - -An alternative could be to generate the repository locally, and add an -rsync command at the end of the 'publish' script to upload the repository -to your publication server : - ----- -targets: - Debian: - local_repo: /path/to/debian/repo - publish: | - #!/bin/sh - reprepro -b [% c('local_repo') %] include \ - [% c('lsb_release/codename') %] *.changes - rsync -avH --delete [% c('local_repo') %] publish_server.somedomain:/repo ----- - -SEE ALSO --------- -link:rbm.html[rbm(1)], -link:rbm-pkg.html[rbm-pkg(1)] diff --git a/doc/rbm-rpm.asc b/doc/rbm-rpm.asc deleted file mode 100644 index 75f1886..0000000 --- a/doc/rbm-rpm.asc +++ /dev/null @@ -1,36 +0,0 @@ -rbm-rpm(1) -========== - -NAME ----- -rbm-rpm - Build an rpm package - - -SYNOPSIS --------- -[verse] -'rbm rpm' <project> [options] - -DESCRIPTION ------------ - -Build an rpm package for the selected project. - -This is equivalent to running 'rbm build --step rpm <project>'. - -CONFIGURATION OPTIONS ---------------------- - -The following configuration options are related to rpm packages : - -include::options_rpm.asc[] - -See link:rbm_config.html[rbm_config(7)] for all other options. - -COMMAND LINE OPTIONS --------------------- -See link:rbm_cli.html[rbm_cli(7)]. - -SEE ALSO --------- -link:rbm.html[rbm(1)] diff --git a/doc/rbm-rpmspec.asc b/doc/rbm-rpmspec.asc deleted file mode 100644 index ea06427..0000000 --- a/doc/rbm-rpmspec.asc +++ /dev/null @@ -1,25 +0,0 @@ -rbm-rpmspec(1) -============== - -NAME ----- -rbm-rpmspec - Create a rpm spec file - - -SYNOPSIS --------- -[verse] -'rbm rpmspec' <project> [options] - -DESCRIPTION ------------ - -Create an rpm spec file for the selected project. - -OPTIONS -------- -See link:rbm_cli.html[rbm_cli(7)]. - -SEE ALSO --------- -link:rbm.html[rbm(1)] diff --git a/doc/rbm-srpm.asc b/doc/rbm-srpm.asc deleted file mode 100644 index bc2a28c..0000000 --- a/doc/rbm-srpm.asc +++ /dev/null @@ -1,36 +0,0 @@ -rbm-srpm(1) -=========== - -NAME ----- -rbm-srpm - Create source rpm package - - -SYNOPSIS --------- -[verse] -'rbm srpm' <project> [options] - -DESCRIPTION ------------ - -Create a source rpm package for the select project. - -This is equivalent to running 'rbm build --step srpm <project>'. - -CONFIGURATION OPTIONS ---------------------- - -The following configuration options are related to rpm packages : - -include::options_rpm.asc[] - -See link:rbm_config.html[rbm_config(7)] for all other options. - -COMMAND LINE OPTIONS --------------------- -See link:rbm_cli.html[rbm_cli(7)]. - -SEE ALSO --------- -link:rbm.html[rbm(1)] diff --git a/doc/rbm-usage.asc b/doc/rbm-usage.asc index bd74d2f..400acd0 100644 --- a/doc/rbm-usage.asc +++ b/doc/rbm-usage.asc @@ -22,10 +22,10 @@ EXAMPLES --------
---- -$ rbm usage rpm - => man rbm-rpm -$ rbm deb --help - => man rbm-deb +$ rbm usage build + => man rbm-build +$ rbm fetch --help + => man rbm-fetch $ rbm --help tar => man rbm-tar ---- diff --git a/doc/rbm_cli.asc b/doc/rbm_cli.asc index 0e6828c..03ed511 100644 --- a/doc/rbm_cli.asc +++ b/doc/rbm_cli.asc @@ -71,10 +71,6 @@ The following options can be set on the command line :
include::clioptions_tar.asc[]
-include::clioptions_deb.asc[] - -include::clioptions_publish.asc[] - SEE ALSO -------- link:rbm.html[rbm(1)], diff --git a/doc/rbm_config.asc b/doc/rbm_config.asc index 111b115..4c65a73 100644 --- a/doc/rbm_config.asc +++ b/doc/rbm_config.asc @@ -181,14 +181,6 @@ version:: Version number of the software. This is used to create the tarball, and as the package version number.
-version_command:: - A command to run in the checked out source tree to determine - the version, if the +version+ option is not set. The command - should print the version on stdout. - -pkg_rel:: - Package release number. - distribution:: The name of the distribution for which you wish to build a package. The syntax is +distribution-release+. This value is used by the @@ -242,9 +234,9 @@ input_files_paths::
timestamp:: This is the UNIX timestamp, set as modification time on files - created such as the sources tarball and rpm spec file. The - default is to use the commit time of the commit used. If set to - 0 it will use the current time. + created such as the sources tarball. The default is to use the + commit time of the commit used. If set to 0 it will use the + current time.
notmpl:: An array containing a list of options that should not be @@ -253,29 +245,21 @@ notmpl::
step:: The value of this option is the name of the build script we are - going to be running ('deb' if building a Debian package, 'rpm' - if building an rpm, etc ...). This can be useful in the - +input_files+ definition, if you want to enable an input file - only for some type of package. This option should be used read - only. + going to be running (by default 'build', but you could have an + other one for publishing your build, or for different types of + packaging). This option should be used read only. If you want + to change it, use the --step command line option, or the + +pkg_type+ option.
steps:: The steps definitions. See link:rbm_steps.html[rbm_steps(7)] for details.
-include::options_rpm.asc[] - -include::options_deb.asc[] - -include::options_pkg.asc[] - build:: This is the content of the build script used by the +build+ command. The default is to include the template file named +build+.
-include::options_publish.asc[] - include::options_misc.asc[]
In addition to the configuration options listed here, you are free to diff --git a/doc/rbm_input_files.asc b/doc/rbm_input_files.asc index de47638..55aaebf 100644 --- a/doc/rbm_input_files.asc +++ b/doc/rbm_input_files.asc @@ -68,12 +68,14 @@ project:: The name of an other project to build, to create the file. The content of the file descriptor is used as options for the build of this project. You can add config options such as +version+, - +git_hash+ or +target+ to configure the build. The build is run - with an equivalent of 'rbm pkg', so you should define the - +pkg_type+ option if you want to select the type of build. The - command line options are not forwarded. The name of the current - project is available to that other project in the +origin_project+ - option. + +git_hash+ or +target+ to configure the build. The command line + options are not forwarded. The name of the current project is + available to that other project in the +origin_project+ option. + +pkg_type:: + When the input file is an other project, this option can be + used to select a different type of build (which we call a step). + This is equivalent to the --step command line option.
target:: An array defining the build targets for the selected project. If this diff --git a/doc/rbm_remote.asc b/doc/rbm_remote.asc index 479062a..81de98f 100644 --- a/doc/rbm_remote.asc +++ b/doc/rbm_remote.asc @@ -95,15 +95,12 @@ REMOTE BUILD WITH SSH ---------------------
Some predefined +remote_*+ templates are available and can be enabled -by setting the +remote_ssh+ option to 1. For instance if you want to -build your debian packages on a remote node with ssh, add the following -lines to your configuration : +by setting the +remote_ssh+ option to 1. For instance you can add the +following lines to your configuration:
---- ssh_host: some_hostname -steps: - deb_src: - remote_ssh: 1 +remote_ssh: 1 ----
The following options will be used: diff --git a/doc/rbm_steps.asc b/doc/rbm_steps.asc index b02891b..191dd19 100644 --- a/doc/rbm_steps.asc +++ b/doc/rbm_steps.asc @@ -25,9 +25,10 @@ CONFIGURATION
The first way to have a different option value depending on the curernt step is to use the IF/ELSE template directives and the +step+ option. -The +step+ option contains the name of the current step. For instance -if you want to use a different git tag or branch for rpm and debian -packages, you could do: +The +step+ option contains the name of the current step. For instance, +assuming that you defined rpm and deb steps for building rpm and +debian packages, if you want to use a different git tag or branch +depending on the type of package, you could do: ---- git_hash: | [% IF c('step') == 'rpm' -%] @@ -85,11 +86,10 @@ steps: If the value of a step is not a hash containing options, but a string, then this name is used as step name. This can be used to alias a step configuration to an other step. For instance you usually want to use -the same options for the rpm and srpm scripts. The default configuration -includes the following steps aliases: +the same options for the rpm and srpm scripts, which can be done with +the following step alias:
- srpm: rpm -- deb-src: deb
PRE AND POST SCRIPTS diff --git a/doc/rbm_targets.asc b/doc/rbm_targets.asc index fdcccca..d50aff3 100644 --- a/doc/rbm_targets.asc +++ b/doc/rbm_targets.asc @@ -31,25 +31,25 @@ target. As an example we could define the following targets :
- the 'dev' target, for daily development, from the master branch. You - don't to use pbuilder, so you can have your package built more quickly. - You don't want to sign the packages. And you want this target to be the - default. + want to automatically fetch from the git repository before each build, + and you want to check that the commit used is signed by a key from the + developers.gpg keyring.
- the 'release' target, for building packages for a new release. You - want to use pbuilder to make sure it is built in a clean chroot. You - only want to build them from gpg signed tags. You want to sign the - packages with a specific key. + only want to build them from gpg signed tags, signed by the key from + the release.gpg keyring.
In such case, the following targets configuration could be used : ---- targets: dev: git_hash: master - use_pbuilder: 0 + fetch: 1 + commit_gpg_id: 1 + gpg_keyring: developers.gpg release: - use_pbuilder: 1 - debsign_keyid: 123456 tag_gpg_id: 1 + gpg_keyring: release.gpg ----
If the value of a target is not a hash containing options, but a string @@ -65,11 +65,12 @@ targets: notarget: dev dev: git_hash: master - use_pbuilder: 0 + fetch: 1 + commit_gpg_id: 1 + gpg_keyring: developers.gpg release: - use_pbuilder: 1 - debsign_keyid: 123456 tag_gpg_id: 1 + gpg_keyring: release.gpg ----
In this example we extend the 'release' target as 'release_1' to add a @@ -80,9 +81,8 @@ targets: - git_hash_version_1 - release release: - use_pbuilder: 1 - debsign_keyid: 123456 tag_gpg_id: 1 + gpg_keyring: release.gpg git_hash_version_1: git_hash: version-1.0 ---- @@ -96,15 +96,16 @@ times, and in this case they will be used in the order given on the command line. If no target is selected, then the 'notarget' target is used.
-For example, if you want to build a debian package for 'dev' target : +For example, if you want to build a debian package (assuming that you +defined a 'deb' step for that) for the 'dev' target: ---- -$ rbm deb --target dev +$ rbm build --step deb --target dev ----
If you want to build a debian package for the 'release' target, using the '0.1.2.3' tag: ---- -$ rbm deb --target release --git-hash 0.1.2.3 +$ rbm build --step deb --target release --git-hash 0.1.2.3 ----
Sometime, an option in one project will use the value of an option from diff --git a/doc/rbm_templates.asc b/doc/rbm_templates.asc index 2f72c94..4c1a619 100644 --- a/doc/rbm_templates.asc +++ b/doc/rbm_templates.asc @@ -32,13 +32,7 @@ template files can be added in the directory +projects_dir/common+, to be included from any of the other templates.
There are different template files : -By default, the following template files are used : - -- the rpm spec file template, named +project.spec+ (replacing +project+ - with the project's name). This is used when you use the +rpmspec+, - +srpm+ +rpm+, or +build+ commands. This creates the +rpmspec+ option. - If you don't want to use this file, just replace the +rpmspec+ option - by something else. +By default, the following template file is used, but you can add more:
- the build script template, named +build+. This template is used to create a build script, that is executed when you use the +build+ diff --git a/doc/rbm_tutorial.asc b/doc/rbm_tutorial.asc index 9471034..2728478 100644 --- a/doc/rbm_tutorial.asc +++ b/doc/rbm_tutorial.asc @@ -82,16 +82,18 @@ the software, for any git commit. By default, rbm will use the latest tag on which a commit is based as the version number. Sometimes it works, when the project uses version numbers as tags, but this is not always the case. Alternatively, you can -define the 'version_command' option with a shell script or command that +define a 'var/version_command' option with a shell script or command that will print the version number.
-For tor, we will use the 'version_command' option. The version of the +For tor, we will use a 'var/version_command' option. The version of the software is defined in the ChangeLog file, so we will use a simple command to get it. The tor config file now look like this :
---- git_url: https://git.torproject.org/tor.git -version_command: perl -ne 'if (m/^Changes in version ([^-]+)-.*$/) { print "$1\n"; exit }' < ChangeLog +version: '[% exec(c("var/version_command")) %]' +var: + version_command: perl -ne 'if (m/^Changes in version ([^-]+)-.*$/) { print "$1\n"; exit }' < ChangeLog ----
Using the 'showconf' command, we can check the value of the 'version' @@ -123,17 +125,41 @@ Created /home/boklm/rbm/out/tor-0.2.4.17.tar.xz Building an rpm package -----------------------
-TODO +In order to build rpm packages, you will need to define an rpm step +(see link:rbm_steps.html[rbm_steps(7)]) in rbm.conf. + +The rbm.conf file should define an +rpm+ option containing the commands +to build an rpm package: +---- +rpm: | + #!/bin/bash + [ here the commands for building an rpm package ] +---- + +Unfortunately, this part of the tutorial, with details about the +definition of the rpm step has not been written yet. + +You should be able to start a build with the 'build' command and +the '--step' option: +---- +$ rbm build --step rpm tor +----
Building a debian package -------------------------
-TODO +Similarly to the rpm package, building debian packages will require that +you define a deb step in rbm.conf. This part of the tutorial has not +been written yet.
-Using a remote build server ---------------------------- +Using a build container +-----------------------
-TODO +Using the remote options (see link:rbm_remote.html[rbm_remote(7)]) you +can do the builds inside containers. Unfortunately this part of the +tutorial has not been written yet. However you can look at the +Tor Browser build repository for an example: +https://gitweb.torproject.org/builders/tor-browser-build.git/
SEE ALSO -------- diff --git a/doc/version.asc b/doc/version.asc index 9082ff0..bdbc71a 100644 --- a/doc/version.asc +++ b/doc/version.asc @@ -1,13 +1,4 @@
The version of the software used to create the tarball and the packages -can be set with the 'version' option. If the version is not explicitely -set, then it is determined automatically in the following way : - -- If the +version_command+ option is set, then the value of this option - is run in the checked out source tree, and the output is used as the - version. - -- If the +version_command+ is not set, or if running the command failed, - then the most recent tag (as returned by git-describe) is used as - version. +should be set with the 'version' option.
diff --git a/lib/RBM.pm b/lib/RBM.pm index 2666e72..1294b4e 100644 --- a/lib/RBM.pm +++ b/lib/RBM.pm @@ -686,17 +686,6 @@ sub process_template { return $output; }
-sub rpmspec { - my ($project, $dest_dir) = @_; - $dest_dir //= create_dir(rbm_path(project_config($project, 'output_dir'))); - valid_project($project); - my $timestamp = project_config($project, 'timestamp'); - my $rpmspec = project_config($project, 'rpmspec') - || exit_error "Undefined config for rpmspec"; - path("$dest_dir/$project.spec")->spew_utf8($rpmspec); - utime $timestamp, $timestamp, "$dest_dir/$project.spec" if $timestamp; -} - sub projectslist { keys %{$config->{projects}}; } @@ -1020,20 +1009,13 @@ sub build_run { valid_project($project); $options = { %$options, build_id => Data::UUID->new->create_str }; my $old_cwd = getcwd; - my $srcdir = project_config($project, 'build_srcdir', $options); - my $use_srcdir = $srcdir; - my $tmpdir = File::Temp->newdir(get_tmp_dir($project, $options) + my $srcdir = File::Temp->newdir(get_tmp_dir($project, $options) . '/rbm-XXXXX'); my @cfiles; - if ($use_srcdir) { - @cfiles = ($srcdir); - } else { - $srcdir = $tmpdir->dirname; - my $tarfile = maketar($project, $options, $srcdir); - push @cfiles, $tarfile if $tarfile; - push @cfiles, copy_files($project, $srcdir); - push @cfiles, input_files('copy', $project, $options, $srcdir); - } + my $tarfile = maketar($project, $options, $srcdir); + push @cfiles, $tarfile if $tarfile; + push @cfiles, copy_files($project, $srcdir); + push @cfiles, input_files('copy', $project, $options, $srcdir); my ($remote_tmp_src, $remote_tmp_dst, %build_script); my @scripts = ('pre', $script_name, 'post'); my %scripts_root = ( pre => 1, post => 1); @@ -1083,7 +1065,7 @@ sub build_run { goto EXIT; } @scripts = grep { $build_script{$_} } @scripts; - push @cfiles, @scripts unless $use_srcdir; + push @cfiles, @scripts; foreach my $s (@scripts) { path("$srcdir/$s")->spew_utf8($build_script{$s}); chmod 0700, "$srcdir/$s"; @@ -1185,17 +1167,5 @@ sub build_pkg { build_run($project, project_config($project, 'pkg_type', $options), $options); }
-sub publish { - my ($project) = @_; - project_config($project, 'publish', { error_if_undef => 1 }); - my $publish_src_dir = project_config($project, 'publish_src_dir'); - if (!$publish_src_dir) { - $publish_src_dir = File::Temp->newdir(get_tmp_dir($project) - . '/rbm-XXXXXX'); - build_pkg($project, { norec => { output_dir => $publish_src_dir } }); - } - build_run($project, 'publish', { build_srcdir => $publish_src_dir }); -} - 1; # vim: expandtab sw=4 diff --git a/lib/RBM/DefaultConfig.pm b/lib/RBM/DefaultConfig.pm index a4c1e5c..c19d160 100644 --- a/lib/RBM/DefaultConfig.pm +++ b/lib/RBM/DefaultConfig.pm @@ -15,23 +15,6 @@ use Cwd qw(getcwd); use IO::CaptureOutput qw(capture_exec); use File::Temp;
-sub git_describe { - my ($project, $options) = @_; - my $git_hash = RBM::project_config($project, 'git_hash', $options) - || RBM::exit_error('No git_hash specified'); - my %res; - $RBM::config->{projects}{$project}{describe} = {}; - my $old_cwd = getcwd; - RBM::git_clone_fetch_chdir($project, $options); - my ($stdout, $stderr, $success, $exit_code) - = capture_exec('git', 'describe', '--long', $git_hash); - if ($success) { - @res{qw(tag tag_reach hash)} = $stdout =~ m/^(.+)-(\d+)-g([^-\n]+)$/; - } - chdir($old_cwd); - return $success ? %res : undef; -} - sub lsb_release { my ($project, $options) = @_; my $distribution = RBM::project_config($project, 'distribution', $options); @@ -123,12 +106,11 @@ our %default_config = ( git_clone_dir => 'git_clones', hg_clone_dir => 'hg_clones', fetch => 'if_needed', - rpmspec => '[% SET tmpl = project _ ".spec"; INCLUDE $tmpl -%]', + pkg_type => 'build', build => '[% INCLUDE build -%]', build_log => '-', build_log_append => '1', notmpl => [ qw(projects_dir) ], - describe => &git_describe, abbrev_length => '12', abbrev => '[% IF c("git_url"); @@ -155,56 +137,7 @@ our %default_config = ( return '946684800'; }, debug => 0, - version => <<END, -[%- - IF c('version_command'); - exec(c('version_command')); - ELSIF c(['describe', 'tag']); - c(['describe', 'tag']); - ELSE; - exit_error('No version specified'); - END; --%] -END -#### -#### -#### - pkg_type => 'build', - rpm => '[% c("rpmbuild", { rpmbuild_action => "-ba" }) %]', - srpm => '[% c("rpmbuild", { rpmbuild_action => "-bs" }) %]', -#### -#### -#### - rpmbuild => <<END, -[% USE date -%] -#!/bin/sh -set -e -x -srcdir=$(pwd) -cat > '[% project %].spec' << 'RBM_END_RPM_SPEC' -[% c('rpmspec') %] -RBM_END_RPM_SPEC -touch -m -t [% date.format(c('timestamp'), format = '%Y%m%d%H%M') %] [% project %].spec -rpmbuild [% c('rpmbuild_action', {error_if_undef => 1}) %] --define "_topdir $srcdir" \ - --define "_sourcedir $srcdir" \ - --define '_srcrpmdir [% dest_dir %]' \ - --define '_rpmdir [% dest_dir %]' \ - --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \ - "$srcdir/[% project %].spec" -END -#### -#### -#### - rpm_rel => <<OPT_END, -[%- - IF c('pkg_rel').defined; - GET c('pkg_rel'); - ELSIF c('describe/tag_reach'); - GET '1.' _ c('describe/tag_reach') _ '.g' _ c('describe/hash'); - ELSE; - GET '1.g' _ c('abbrev'); - END; --%] -OPT_END + version => "[%- exit_error('No version specified'); -%]", #### #### #### @@ -224,87 +157,6 @@ exec [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@ GPGEND #### #### -#### - debian_create => <<DEBEND, -[%- - FOREACH f IN c('debian_files'); - GET 'cat > ' _ tmpl(f.name) _ " << 'END_DEBIAN_FILE'\n"; - GET tmpl(f.content); - GET "\nEND_DEBIAN_FILE\n\n"; - END; --%] -DEBEND -#### -#### -#### - deb_src => <<DEBEND, -#!/bin/sh -set -e -x -[% SET tarfile = project _ '-' _ c('version') _ '.tar.' _ c('compress_tar') -%] -tar xvf [% tarfile %] -mv [% tarfile %] [% dest_dir %]/[% project %]_[% c('version') %].orig.tar.[% c('compress_tar') %] -cd [% project %]-[% c('version') %] -builddir=$(pwd) -mkdir debian debian/source -cd debian -[% c('debian_create') %] -cd [% dest_dir %] -dpkg-source -b "$builddir" -DEBEND -#### -#### -#### - deb => <<DEBEND, -#!/bin/sh -set -e -x -[% SET tarfile = project _ '-' _ c('version') _ '.tar.' _ c('compress_tar') -%] -tar xvf [% tarfile %] -mv [% tarfile %] [% project %]_[% c('version') %].orig.tar.[% c('compress_tar') %] -cd [% project %]-[% c('version') %] -builddir=$(pwd) -mkdir debian debian/source -cd debian -[% c('debian_create') %] -cd .. -ls .. -[% IF c('debsign_keyid'); - pdebuild_sign = '--debsign-k ' _ c('debsign_keyid'); - debuild_sign = '-k' _ c('debsign_keyid'); -ELSE; - pdebuild_sign = ''; - debuild_sign = '-uc -us'; -END -%] -[% IF c('use_pbuilder') -%] -pdebuild [% pdebuild_sign %] --buildresult [% dest_dir %] -[% ELSE -%] -debuild [% debuild_sign %] -cd .. -rm -f build -for file in * -do - if [ -f "$file" ] - then - mv "$file" [% dest_dir %] - fi -done -[% END -%] -DEBEND -#### -#### -#### - debian_revision => <<OPT_END, -[%- -IF c('pkg_rel'); - GET c('pkg_rel').defined; -ELSIF c('describe/tag_reach'); - GET '1.' _ c('describe/tag_reach') _ '~g' _ c('describe/hash'); -ELSE; - GET '1'; -END; --%] -OPT_END -#### -#### #### ssh_remote_exec => <<OPT_END, [%- @@ -519,19 +371,6 @@ OPT_END #### #### lsb_release => &lsb_release, - pkg_type => sub { - my ($project, $options) = @_; - my $distro = RBM::project_config($project, 'lsb_release/id', $options); - my %pkg_types = qw( - Fedora rpm - CentOS rpm - Mageia rpm - openSuSe rpm - Debian deb - Ubuntu deb - ); - return $pkg_types{$distro}; - }, install_package => sub { my ($project, $options) = @_; my $distro = RBM::project_config($project, 'lsb_release/id', $options); @@ -606,8 +445,6 @@ ZIP_END input_files_id => sub { RBM::input_files('input_files_id', @_); }, input_files_paths => sub { RBM::input_files('getfpaths', @_); }, steps => { - srpm => 'rpm', - 'deb-src' => 'deb', }, suexec => 'sudo -- [% c("suexec_cmd") %]', hg => 'hg [% c("hg_opt") %]', diff --git a/packages/.gitignore b/packages/.gitignore deleted file mode 100644 index 16833ae..0000000 --- a/packages/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -git_clones -out diff --git a/packages/keyring/boklm.gpg b/packages/keyring/boklm.gpg deleted file mode 100644 index c878f59..0000000 Binary files a/packages/keyring/boklm.gpg and /dev/null differ diff --git a/packages/projects/rbm/config b/packages/projects/rbm/config deleted file mode 100644 index 44e497c..0000000 --- a/packages/projects/rbm/config +++ /dev/null @@ -1,10 +0,0 @@ -git_url: 'file://[% c("basedir") %]/..' -git_hash: master -compress_tar: xz -commit_gpg_id: 1 -summary: Tool to generate packages from a git repository, using templates -description: | - rbm is a tool to generate some packages from a git repository, using - package templates. -url: http://rbm.boklm.eu/ -gpg_keyring: boklm.gpg diff --git a/packages/projects/rbm/rbm.spec b/packages/projects/rbm/rbm.spec deleted file mode 100644 index 37b2941..0000000 --- a/packages/projects/rbm/rbm.spec +++ /dev/null @@ -1,29 +0,0 @@ -Name: [% project %] -Version: [% c('version') %] -Release: [% c('rpm_rel') %]%{?dist} -Source: %{name}-%{version}.tar.[% c('compress_tar') %] -Summary: [% c('summary') %] -URL: [% c('url') %] -License: CC0 -Group: Text tools -BuildRequires: asciidoc -BuildArch: noarch -%description -[% c('description') -%] - -%prep -%setup -q - -%build - -%install -make perldir=%{perl_vendorlib} DESTDIR=%{buildroot} install - -%files -%doc README.md COPYING -%{_bindir}/%{name} -%{perl_vendorlib}/RBM.pm -%{perl_vendorlib}/RBM/DefaultConfig.pm -%{_mandir}/man1/rbm.1* -%{_mandir}/man1/rbm-*.1* -%{_mandir}/man7/rbm_*.7* diff --git a/packages/rbm.conf b/packages/rbm.conf deleted file mode 100644 index b34b34d..0000000 --- a/packages/rbm.conf +++ /dev/null @@ -1,2 +0,0 @@ -compress_tar: xz -output_dir: "out/[% project %]" diff --git a/rbm b/rbm index 6b31185..764141e 100755 --- a/rbm +++ b/rbm @@ -21,38 +21,10 @@ my %actions = ( run => &tar, descr => 'Create source tarball', }, - rpmspec => { - run => &rpmspec, - descr => 'Create rpm spec file', - }, - rpm => { - run => sub { build_script('rpm', @_) }, - descr => 'Build an rpm package', - }, - srpm => { - run => sub { build_script('srpm', @_) }, - descr => 'Create source rpm file', - }, - 'deb-src' => { - run => sub { build_script('deb_src', @_) }, - descr => 'Create debian source package', - }, - 'deb' => { - run => sub { build_script('deb', @_) }, - descr => 'Create debian package', - }, build => { run => sub { build_script('build', @_) }, descr => 'Build project with a custom build script', }, - pkg => { - run => &pkg, - descr => 'Build a package', - }, - publish => { - run => &publish, - descr => 'Publish a package', - }, showconf => { run => &show_conf, descr => 'Show configuration', @@ -91,10 +63,9 @@ sub usageexit { sub set_options { my @options = qw(distribution=s version=s tag-gpg-id=s@ commit-gpg-id=s@ projects-dir=s git-clone-dir=s git-hash=s output-dir=s - compress_tar=s pkg-rel=s timestamp=i fetch! - gpg-keyring=s gpg-keyring-dir=s gpg-args=s gpg-bin=s - sysconf-file=s debsign-keyid=s use-pbuilder! - step=s target=s@ publish-src-dir=s debug! hg-clone-dir=s + compress_tar=s timestamp=i fetch! gpg-keyring=s + gpg-keyring-dir=s gpg-args=s gpg-bin=s sysconf-file=s + step=s target=s@ debug! hg-clone-dir=s hg-hash=s localconf-file=s build-log=s); my %val; Getopt::Long::GetOptionsFromArray(@_, %val, @options) || exit 1; @@ -158,14 +129,6 @@ sub tar { RBM::maketar($args->[0]); }
-sub rpmspec { - usageexit($_[0]) unless @_ >= 2; - shift; - my $args = set_options(@_); - usageexit('rpmspec') unless @$args == 1; - RBM::rpmspec($args->[0]); -} - sub print_projects { usageexit($_[0]) unless @_ == 1; print join("\n", RBM::projectslist()), "\n"; @@ -181,22 +144,6 @@ sub build_script { RBM::build_pkg($args->[0], { pkg_type => $script_name }); }
-sub pkg { - usageexit($_[0]) unless @_ >= 2; - my $cmd = shift; - my $args = set_options(@_); - usageexit($cmd) unless @$args == 1; - RBM::build_pkg($args->[0]); -} - -sub publish { - usageexit($_[0]) unless @_ >= 2; - my $cmd = shift; - my $args = set_options(@_); - usageexit($cmd) unless @$args == 1; - RBM::publish($args->[0]); -} - if (@ARGV == 0 || !$actions{$ARGV[0]}) { usage(); exit 1; diff --git a/test.pl b/test.pl index dfca8ee..6c99cf0 100755 --- a/test.pl +++ b/test.pl @@ -134,14 +134,14 @@ my @tests = ( expected => 'aZa AZa aZa', }, { - name => 'srpm step', - step => 'srpm', + name => 'rpm step', + step => 'rpm', config => [ 'c', 'option_rpm' ], expected => '1', }, { - name => 'deb-src step', - step => 'deb-src', + name => 'deb step', + step => 'deb', config => [ 'c', 'option_deb' ], expected => '1', },
tbb-commits@lists.torproject.org