Skip to content

Commit

Permalink
Merge branch 'master' into refactor_generator
Browse files Browse the repository at this point in the history
  • Loading branch information
lennonwoo authored Aug 10, 2019
2 parents 8c23028 + 07d8f1c commit 0321b00
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 34 deletions.
4 changes: 4 additions & 0 deletions bloom/generators/rpm/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ def generate_package(self, package, os_version):
execute_command('git rm -rf ' + ' '.join("'{}'".format(t) for t in template_files))
# Add changes to the rpm folder
execute_command('git add ' + self.package_manager)
# 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 {0} files for {1}"'
.format(self.package_manager, os_version))
Expand Down
37 changes: 20 additions & 17 deletions bloom/generators/rpm/templates/catkin/template.spec.em
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
%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)/.*$

Name: @(Package)
Version: @(Version)
Release: @(Inc)%{?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]
Expand All @@ -12,35 +15,35 @@ License: @(License)
@(Description)

%prep
%setup -q
%autosetup

%build
# 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
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" \

make %{?_smp_mflags}
%cmake3 \
-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

%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)
Expand Down
37 changes: 20 additions & 17 deletions bloom/generators/rpm/templates/cmake/template.spec.em
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
%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)/.*$

Name: @(Package)
Version: @(Version)
Release: @(Inc)%{?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]
Expand All @@ -12,35 +15,35 @@ License: @(License)
@(Description)

%prep
%setup -q
%autosetup

%build
# 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
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" \

make %{?_smp_mflags}
%cmake3 \
-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

%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)
Expand Down

0 comments on commit 0321b00

Please sign in to comment.