From a6f636f74cb931b881275e930567ad18eb975a55 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 9 Mar 2023 17:36:31 +0300 Subject: Add pkg-bindist implementation for Fedora --- bpkg/pkg-bindist.cli | 190 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 186 insertions(+), 4 deletions(-) (limited to 'bpkg/pkg-bindist.cli') diff --git a/bpkg/pkg-bindist.cli b/bpkg/pkg-bindist.cli index cdbb10c..843fb09 100644 --- a/bpkg/pkg-bindist.cli +++ b/bpkg/pkg-bindist.cli @@ -35,8 +35,8 @@ namespace bpkg \cb{config.install.*} variables) to match the distribution's layout. Then it generates any necessary distribution package metadata files based on the information from the package \cb{manifest} files. Finally, it invokes - the distribution-specified command to produce the binary package. Unless - overrident with the \cb{--architecture} and \cb{--distribution} options, + the distribution-specific command to produce the binary package. Unless + overridden with the \cb{--architecture} and \cb{--distribution} options, the binary package is generated for the host architecture using the host's standard system package manager. Additional command line variables (, normally \cb{config.*}) can be passed to the build system during @@ -117,7 +117,7 @@ namespace bpkg bool --debian-prepare-only { "Prepare all the package metadata files (\cb{control}, \cb{rules}, etc) - but do not invoke \cb{bpkg-buildpackage} to generate the binary + but do not invoke \cb{dpkg-buildpackage} to generate the binary package, printing its command line instead unless requested to be quiet. Implies \cb{--keep-output}." } @@ -186,7 +186,8 @@ namespace bpkg { "", "Alternative \cb{Architecture} \cb{control} file field value for - the main binary package. The default is \cb{any}." + the main binary package, normally \cb{all} (architecture-independent). + The default is \cb{any} (architecture-dependent)." } string --debian-main-langdep @@ -220,6 +221,186 @@ namespace bpkg } }; + class pkg_bindist_fedora_options + { + "\h|FEDORA DESCRIPTION| + + The Fedora binary packages are generated by producing the standard RPM + spec file and then invoking \cb{rpmbuild(8)} to build the binary package + from that. While this approach is normally used to build packages from + source, this implementation \"pretends\" that this is what's happening by + overriding a number of RPM spec file sections to invoke the \cb{build2} + build system on the required packages directly in their \cb{bpkg} + configuration locations. + + The \cb{rpmdevtools} Fedora package must be installed before invocation. + Typical invocation: + + \ + bpkg build libhello + bpkg test libhello + bpkg bindist libhello + \ + + The resulting binary packages are placed into the standard \cb{rpmbuild} + output directory (normally \c{\b{~/rpmbuild/RPMS/}\i{arch}\b{/}}). + + Unless the \cb{--recursive} option is specified, dependencies of the + specified package are translated to dependencies in the resulting binary + package using names and versions that refer to packages that would be + generated by the \cb{pkg-bindist} command (called \"non-native\" + packages). If instead you would like certain dependencies to refer to + binary packages provided by the distribution (called \"native\" + packages), then you need to arrange for them to be built as system (see + \l{bpkg-pkg-build(1)} for details). For example, if our \cb{libhello} has + a dependency on \cb{libsqlite3} and we would like the binary package for + \cb{libhello} to refer to \cb{sqlite-libs} from Fedora (or alike), then + the \cb{pkg-build} command would need to be (\cb{--sys-install} is + optional): + + \ + bpkg build --sys-install libhello ?sys:libsqlite3 + \ + + Such a package with native dependencies can then be installed (including + any missing native dependencies) using the \cb{dnf install} command. + For example: + + \ + dnf install libhello-1.2.3-1.fc35.x86_64.rpm \ + libhello-devel-1.2.3-1.fc35.x86_64.rpm + \ + + See \l{bpkg#bindist-mapping-fedora-produce Fedora Package Mapping for + Production} for details on \cb{bpkg} to Fedora package name and version + mapping. + " + + "\h|PKG-BINDIST FEDORA OPTIONS|" + + bool --fedora-prepare-only + { + "Prepare the RPM spec file but do not invoke \cb{rpmbuild} to generate + the binary package, printing its command line instead unless requested + to be quiet." + } + + string --fedora-buildflags = "assign" + { + "", + "Package build flags (\cb{%{build_*flags\}} macros) usage mode. Valid + values are \cb{assign} (use the build flags instead of + configured), \cb{append} (use the build flags in addition to + configured, putting them last), \cb{prepend} (use the build flags in + addition to configured, putting them first), and \cb{ignore} (ignore + build flags). The default mode is \cb{assign}. Note that compiler mode + options, if any, are used as configured." + } + + strings --fedora-build-option + { + "", + "Additional option to pass to the \cb{rpmbuild} program. If specified, + these options must be consistent with the query options + (\cb{--fedora-query-option}) to result in identical macro + expansions. Repeat this option to specify multiple build options." + } + + strings --fedora-query-option + { + "", + "Additional option to pass to the \cb{rpm} program. This program is used + to query RPM macro values which affect the binary package. If + specified, these options must be consistent with the build options + (\cb{--fedora-build-option}) to result in identical macro expansions. + Repeat this option to specify multiple query options." + } + + string --fedora-dist-tag + { + "", + "Alternative distribution tag to use in the binary package release. If + empty value is specified, then no distribution tag is included. The + default is a value that identifies the distribution being used to build + the package, for example, \cb{fc35} for Fedora 35 or \cb{el8} for RHEL + 8." + } + + string --fedora-packager + { + "", + "Alternative \cb{Packager} RPM spec file directive value. The default is + the \cb{package-email} value from package \cb{manifest}. If empty value + is specified, then the \cb{Packager} directive is omitted from the spec + file." + } + + string --fedora-build-arch + { + "", + "\cb{BuildArch} RPM spec file directive value for the main binary + package, normally \cb{noarch} (architecture-independent). By default + the directive is omitted, assuming that the package is + architecture-dependent." + } + + strings --fedora-main-langreq + { + "", + "Override the language runtime dependencies (such as \cb{glibc}, + \cb{libstdc++}, etc) of the main binary package by replacing the + corresponding \cb{Requires} RPM spec file directives. If empty value is + specified then no language runtime dependencies are specified. Repeat + this option to specify multiple language runtime dependencies." + } + + strings --fedora-devel-langreq + { + "", + "Override the language runtime dependencies (such as \cb{glibc-devel}, + \cb{libstdc++-devel}, etc) of the development (\cb{-devel}) binary + package by replacing the corresponding \cb{Requires} RPM spec file + directives. If empty value is specified then no language runtime + dependencies are specified. Repeat this option to specify multiple + language runtime dependencies." + } + + strings --fedora-stat-langreq + { + "", + "Override the language runtime dependencies (such as \cb{glibc-static}, + \cb{libstdc++-static}, etc) of the static libraries (\cb{-static}) + binary package by replacing the corresponding \cb{Requires} RPM spec + file directives. If empty value is specified then no language runtime + dependencies are specified. Repeat this option to specify multiple + language runtime dependencies." + } + + strings --fedora-main-extrareq + { + "", + "Extra dependency to add to the main binary package as an additional + \cb{Requires} RPM spec file directive. Repeat this option to specify + multiple extra dependencies." + } + + strings --fedora-devel-extrareq + { + "", + "Extra dependency to add to the development (\cb{-devel}) binary package + as an additional \cb{Requires} RPM spec file directive. Repeat this + option to specify multiple extra dependencies." + } + + strings --fedora-stat-extrareq + { + "", + "Extra dependency to add to the static libraries (\cb{-static}) binary + package as an additional \cb{Requires} RPM spec file directive. Repeat + this option to specify multiple extra dependencies." + } + }; + class pkg_bindist_archive_options { "\h|ARCHIVE DESCRIPTION| @@ -407,6 +588,7 @@ namespace bpkg // class pkg_bindist_options: configuration_options, pkg_bindist_debian_options, + pkg_bindist_fedora_options, pkg_bindist_archive_options { "\h|PKG-BINDIST COMMON OPTIONS|" -- cgit v1.1