From 5a7d94fc43c81845e9bdbb95a60fdaf99d41edc2 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Mon, 22 Apr 2019 16:59:18 -0700 Subject: [PATCH 1/8] Drop 'Group' value from RPM spec templates Neither Fedora or RHEL 7+ use this value. If another distribution were to be supported for RPM generation in Bloom that can take advantage of this value, we should find a better way to add it instead of hard- coding it into the template. Signed-off-by: Scott K Logan --- bloom/generators/rpm/templates/catkin/template.spec.em | 1 - bloom/generators/rpm/templates/cmake/template.spec.em | 1 - 2 files changed, 2 deletions(-) diff --git a/bloom/generators/rpm/templates/catkin/template.spec.em b/bloom/generators/rpm/templates/catkin/template.spec.em index a65a2a81..c3100fd2 100644 --- a/bloom/generators/rpm/templates/catkin/template.spec.em +++ b/bloom/generators/rpm/templates/catkin/template.spec.em @@ -3,7 +3,6 @@ Version: @(Version) Release: @(RPMInc)%{?dist} Summary: ROS @(Name) package -Group: Development/Libraries License: @(License) @[if Homepage and Homepage != '']URL: @(Homepage)@\n@[end if]Source0: %{name}-%{version}.tar.gz @[if NoArch]@\nBuildArch: noarch@\n@[end if] diff --git a/bloom/generators/rpm/templates/cmake/template.spec.em b/bloom/generators/rpm/templates/cmake/template.spec.em index a65a2a81..c3100fd2 100644 --- a/bloom/generators/rpm/templates/cmake/template.spec.em +++ b/bloom/generators/rpm/templates/cmake/template.spec.em @@ -3,7 +3,6 @@ Version: @(Version) Release: @(RPMInc)%{?dist} Summary: ROS @(Name) package -Group: Development/Libraries License: @(License) @[if Homepage and Homepage != '']URL: @(Homepage)@\n@[end if]Source0: %{name}-%{version}.tar.gz @[if NoArch]@\nBuildArch: noarch@\n@[end if] From 76b0d632739957ab326823f6a995300962f74b36 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Mon, 22 Apr 2019 17:04:32 -0700 Subject: [PATCH 2/8] Use 'autosetup' macro in RPM spec files Supported in RPM 4.11 and newer: https://rpm.org/user_doc/autosetup.html Signed-off-by: Scott K Logan --- bloom/generators/rpm/templates/catkin/template.spec.em | 2 +- bloom/generators/rpm/templates/cmake/template.spec.em | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bloom/generators/rpm/templates/catkin/template.spec.em b/bloom/generators/rpm/templates/catkin/template.spec.em index c3100fd2..416d3b09 100644 --- a/bloom/generators/rpm/templates/catkin/template.spec.em +++ b/bloom/generators/rpm/templates/catkin/template.spec.em @@ -11,7 +11,7 @@ License: @(License) @(Description) %prep -%setup -q +%autosetup %build # In case we're installing to a non-standard location, look for a setup.sh diff --git a/bloom/generators/rpm/templates/cmake/template.spec.em b/bloom/generators/rpm/templates/cmake/template.spec.em index c3100fd2..416d3b09 100644 --- a/bloom/generators/rpm/templates/cmake/template.spec.em +++ b/bloom/generators/rpm/templates/cmake/template.spec.em @@ -11,7 +11,7 @@ License: @(License) @(Description) %prep -%setup -q +%autosetup %build # In case we're installing to a non-standard location, look for a setup.sh From f282c260ccd06b4d5ff1b6422258554956f1aed0 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Mon, 22 Apr 2019 17:11:57 -0700 Subject: [PATCH 3/8] Use 'make_*' macros in RPM spec files ...rather than assuming that the make executable is 'make'. Signed-off-by: Scott K Logan --- bloom/generators/rpm/templates/catkin/template.spec.em | 5 ++--- bloom/generators/rpm/templates/cmake/template.spec.em | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/bloom/generators/rpm/templates/catkin/template.spec.em b/bloom/generators/rpm/templates/catkin/template.spec.em index 416d3b09..b4348cad 100644 --- a/bloom/generators/rpm/templates/catkin/template.spec.em +++ b/bloom/generators/rpm/templates/catkin/template.spec.em @@ -31,15 +31,14 @@ mkdir -p obj-%{_target_platform} && cd obj-%{_target_platform} -DSETUPTOOLS_DEB_LAYOUT=OFF \ -DCATKIN_BUILD_BINARY_PACKAGE="1" \ -make %{?_smp_mflags} +%make_build %install # In case we're installing to a non-standard location, look for a setup.sh # in the install tree that was dropped by catkin, and source it. It will # set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi -cd obj-%{_target_platform} -make %{?_smp_mflags} install DESTDIR=%{buildroot} +%make_install -C obj-%{_target_platform} %files @(InstallationPrefix) diff --git a/bloom/generators/rpm/templates/cmake/template.spec.em b/bloom/generators/rpm/templates/cmake/template.spec.em index 416d3b09..b4348cad 100644 --- a/bloom/generators/rpm/templates/cmake/template.spec.em +++ b/bloom/generators/rpm/templates/cmake/template.spec.em @@ -31,15 +31,14 @@ mkdir -p obj-%{_target_platform} && cd obj-%{_target_platform} -DSETUPTOOLS_DEB_LAYOUT=OFF \ -DCATKIN_BUILD_BINARY_PACKAGE="1" \ -make %{?_smp_mflags} +%make_build %install # In case we're installing to a non-standard location, look for a setup.sh # in the install tree that was dropped by catkin, and source it. It will # set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi -cd obj-%{_target_platform} -make %{?_smp_mflags} install DESTDIR=%{buildroot} +%make_install -C obj-%{_target_platform} %files @(InstallationPrefix) From 30407f03920ffe95d0f506893848c5847bbaabfa Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Mon, 22 Apr 2019 17:13:17 -0700 Subject: [PATCH 4/8] Use more standard 4-space indentation in RPM spec files Also move terminating '..' to the end to make it easier to patch cmake arguments and less likely that the make arguments accidentally get added to the end of the cmake arguments. Signed-off-by: Scott K Logan --- .../rpm/templates/catkin/template.spec.em | 23 ++++++++++--------- .../rpm/templates/cmake/template.spec.em | 23 ++++++++++--------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/bloom/generators/rpm/templates/catkin/template.spec.em b/bloom/generators/rpm/templates/catkin/template.spec.em index b4348cad..efe40c9e 100644 --- a/bloom/generators/rpm/templates/catkin/template.spec.em +++ b/bloom/generators/rpm/templates/catkin/template.spec.em @@ -19,17 +19,18 @@ License: @(License) # set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi mkdir -p obj-%{_target_platform} && cd obj-%{_target_platform} -%cmake .. \ - -UINCLUDE_INSTALL_DIR \ - -ULIB_INSTALL_DIR \ - -USYSCONF_INSTALL_DIR \ - -USHARE_INSTALL_PREFIX \ - -ULIB_SUFFIX \ - -DCMAKE_INSTALL_LIBDIR="lib" \ - -DCMAKE_INSTALL_PREFIX="@(InstallationPrefix)" \ - -DCMAKE_PREFIX_PATH="@(InstallationPrefix)" \ - -DSETUPTOOLS_DEB_LAYOUT=OFF \ - -DCATKIN_BUILD_BINARY_PACKAGE="1" \ +%cmake \ + -UINCLUDE_INSTALL_DIR \ + -ULIB_INSTALL_DIR \ + -USYSCONF_INSTALL_DIR \ + -USHARE_INSTALL_PREFIX \ + -ULIB_SUFFIX \ + -DCMAKE_INSTALL_LIBDIR="lib" \ + -DCMAKE_INSTALL_PREFIX="@(InstallationPrefix)" \ + -DCMAKE_PREFIX_PATH="@(InstallationPrefix)" \ + -DSETUPTOOLS_DEB_LAYOUT=OFF \ + -DCATKIN_BUILD_BINARY_PACKAGE="1" \ + .. %make_build diff --git a/bloom/generators/rpm/templates/cmake/template.spec.em b/bloom/generators/rpm/templates/cmake/template.spec.em index b4348cad..efe40c9e 100644 --- a/bloom/generators/rpm/templates/cmake/template.spec.em +++ b/bloom/generators/rpm/templates/cmake/template.spec.em @@ -19,17 +19,18 @@ License: @(License) # set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi mkdir -p obj-%{_target_platform} && cd obj-%{_target_platform} -%cmake .. \ - -UINCLUDE_INSTALL_DIR \ - -ULIB_INSTALL_DIR \ - -USYSCONF_INSTALL_DIR \ - -USHARE_INSTALL_PREFIX \ - -ULIB_SUFFIX \ - -DCMAKE_INSTALL_LIBDIR="lib" \ - -DCMAKE_INSTALL_PREFIX="@(InstallationPrefix)" \ - -DCMAKE_PREFIX_PATH="@(InstallationPrefix)" \ - -DSETUPTOOLS_DEB_LAYOUT=OFF \ - -DCATKIN_BUILD_BINARY_PACKAGE="1" \ +%cmake \ + -UINCLUDE_INSTALL_DIR \ + -ULIB_INSTALL_DIR \ + -USYSCONF_INSTALL_DIR \ + -USHARE_INSTALL_PREFIX \ + -ULIB_SUFFIX \ + -DCMAKE_INSTALL_LIBDIR="lib" \ + -DCMAKE_INSTALL_PREFIX="@(InstallationPrefix)" \ + -DCMAKE_PREFIX_PATH="@(InstallationPrefix)" \ + -DSETUPTOOLS_DEB_LAYOUT=OFF \ + -DCATKIN_BUILD_BINARY_PACKAGE="1" \ + .. %make_build From ac6bbf5a41ef5a16829b597cff11cde691e95a8b Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Mon, 22 Apr 2019 17:17:23 -0700 Subject: [PATCH 5/8] Disable dependency generation in RPM spec files There are two classes of issues here: 1. ROS packages often provide libraries which are also provided by the operating system. If an operating system declares a dependency on that library, we don't want the package manager to install the ROS package instead of the system package. 2. Many ROS packages don't install libraries in a way that the 'provides' portion of dependency generation can detect, so when another ROS package takes a dependency on that library, the automatic dependency can't be met and the downstream package cannot be installed. More info on RPM dependency generation: https://rpm.org/user_doc/dependency_generators.html Signed-off-by: Scott K Logan --- bloom/generators/rpm/templates/catkin/template.spec.em | 3 +++ bloom/generators/rpm/templates/cmake/template.spec.em | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bloom/generators/rpm/templates/catkin/template.spec.em b/bloom/generators/rpm/templates/catkin/template.spec.em index efe40c9e..bcf59a00 100644 --- a/bloom/generators/rpm/templates/catkin/template.spec.em +++ b/bloom/generators/rpm/templates/catkin/template.spec.em @@ -1,3 +1,6 @@ +%global __provides_exclude_from ^@(InstallationPrefix)/.*$ +%global __requires_exclude_from ^@(InstallationPrefix)/.*$ + Name: @(Package) Version: @(Version) Release: @(RPMInc)%{?dist} diff --git a/bloom/generators/rpm/templates/cmake/template.spec.em b/bloom/generators/rpm/templates/cmake/template.spec.em index efe40c9e..bcf59a00 100644 --- a/bloom/generators/rpm/templates/cmake/template.spec.em +++ b/bloom/generators/rpm/templates/cmake/template.spec.em @@ -1,3 +1,6 @@ +%global __provides_exclude_from ^@(InstallationPrefix)/.*$ +%global __requires_exclude_from ^@(InstallationPrefix)/.*$ + Name: @(Package) Version: @(Version) Release: @(RPMInc)%{?dist} From f700982d801d5a8b62522a5b4aa513ae10ba2217 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Mon, 22 Apr 2019 17:28:07 -0700 Subject: [PATCH 6/8] Disable automagic byte compilation in RPM spec files The BRP Python bytecompiler will always use the sytem's default Python interpreter, which may not be the interpreter we're targeting. Safest option is to disable the automagic byte compilation altogether. Note that this doesn't mean that python files won't ever be compiled, it just means that the catch-all policy at the end of the process won't attempt to compile anything which hasn't already been compiled. Signed-off-by: Scott K Logan --- bloom/generators/rpm/templates/catkin/template.spec.em | 1 + bloom/generators/rpm/templates/cmake/template.spec.em | 1 + 2 files changed, 2 insertions(+) diff --git a/bloom/generators/rpm/templates/catkin/template.spec.em b/bloom/generators/rpm/templates/catkin/template.spec.em index bcf59a00..4a0c78f7 100644 --- a/bloom/generators/rpm/templates/catkin/template.spec.em +++ b/bloom/generators/rpm/templates/catkin/template.spec.em @@ -1,3 +1,4 @@ +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') %global __provides_exclude_from ^@(InstallationPrefix)/.*$ %global __requires_exclude_from ^@(InstallationPrefix)/.*$ diff --git a/bloom/generators/rpm/templates/cmake/template.spec.em b/bloom/generators/rpm/templates/cmake/template.spec.em index bcf59a00..4a0c78f7 100644 --- a/bloom/generators/rpm/templates/cmake/template.spec.em +++ b/bloom/generators/rpm/templates/cmake/template.spec.em @@ -1,3 +1,4 @@ +%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') %global __provides_exclude_from ^@(InstallationPrefix)/.*$ %global __requires_exclude_from ^@(InstallationPrefix)/.*$ From 38cef838f9f8750699695a259ec7cbd85c3d2a18 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Mon, 22 Apr 2019 17:33:52 -0700 Subject: [PATCH 7/8] Use 'cmake3' macro in RPM spec files This change shouldn't modify the behavior in Fedora, where all current releases define 'cmake3' to be the same as 'cmake'. In RHEL 7, where cmake 2 is the default, we need to use the 'cmake3' macro to use the supplamental 'cmake3' executable instead of the system default. All current ROS releases except Indigo have a *minimum* cmake requirement of 3. Signed-off-by: Scott K Logan --- bloom/generators/rpm/templates/catkin/template.spec.em | 2 +- bloom/generators/rpm/templates/cmake/template.spec.em | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bloom/generators/rpm/templates/catkin/template.spec.em b/bloom/generators/rpm/templates/catkin/template.spec.em index 4a0c78f7..f669229c 100644 --- a/bloom/generators/rpm/templates/catkin/template.spec.em +++ b/bloom/generators/rpm/templates/catkin/template.spec.em @@ -23,7 +23,7 @@ License: @(License) # set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi mkdir -p obj-%{_target_platform} && cd obj-%{_target_platform} -%cmake \ +%cmake3 \ -UINCLUDE_INSTALL_DIR \ -ULIB_INSTALL_DIR \ -USYSCONF_INSTALL_DIR \ diff --git a/bloom/generators/rpm/templates/cmake/template.spec.em b/bloom/generators/rpm/templates/cmake/template.spec.em index 4a0c78f7..f669229c 100644 --- a/bloom/generators/rpm/templates/cmake/template.spec.em +++ b/bloom/generators/rpm/templates/cmake/template.spec.em @@ -23,7 +23,7 @@ License: @(License) # set things like CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi mkdir -p obj-%{_target_platform} && cd obj-%{_target_platform} -%cmake \ +%cmake3 \ -UINCLUDE_INSTALL_DIR \ -ULIB_INSTALL_DIR \ -USYSCONF_INSTALL_DIR \ From 07d8f1c8783989beb4c6f2f5aeae4388f2b38f80 Mon Sep 17 00:00:00 2001 From: Scott K Logan Date: Thu, 18 Jul 2019 15:35:16 -0700 Subject: [PATCH 8/8] Always create archive of sources when building RPM (#540) The SCM plugin for mock will create an archive of the sources if either this marker file is present in the root of the project or the `write_tar` option is specified in mock's configuration. The way bloom works, we always want to archive the sources, but this isn't the default configuration of the SCM plugin. Writing this marker file means one less configuration is necessary when consuming the release repo to build the RPMs with mock. Signed-off-by: Scott K Logan --- bloom/generators/rpm/generator.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bloom/generators/rpm/generator.py b/bloom/generators/rpm/generator.py index 871f7b13..ddb676d5 100644 --- a/bloom/generators/rpm/generator.py +++ b/bloom/generators/rpm/generator.py @@ -781,8 +781,10 @@ def generate_rpm(self, package, rpm_distro, rpm_dir='rpm'): template_files = process_template_files('.', subs) # Remove any residual template files execute_command('git rm -rf ' + ' '.join("'{}'".format(t) for t in template_files)) - # Add changes to the rpm folder - execute_command('git add ' + rpm_dir) + # Add marker file to tell mock to archive the sources + open('.write_tar', 'a').close() + # Add marker file changes to the rpm folder + execute_command('git add .write_tar ' + rpm_dir) # Commit changes execute_command('git commit -m "Generated RPM files for ' + rpm_distro + '"')