Skip to content

Commit

Permalink
feat: ability to specify the location of the pkg src
Browse files Browse the repository at this point in the history
  • Loading branch information
russkel committed Apr 2, 2024
1 parent 113fc40 commit b90cd20
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
8 changes: 5 additions & 3 deletions bloom/generators/debian/generate_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,19 @@ def prepare_arguments(parser):
add('--native', action='store_true', help="generate native package")
add('--ignore-shlibs-missing-info', default=False, action="store_true",
help="Ignore missing library info detected by shlibs")
add('--src-dir', help='Location of source directory in package')
return parser


def get_subs(pkg, os_name, os_version, ros_distro, deb_inc=0, native=False):
def get_subs(pkg, os_name, os_version, ros_distro, deb_inc=0, native=False, source_directory=None):
return generate_substitutions_from_package(
pkg,
os_name,
os_version,
ros_distro,
deb_inc=deb_inc,
native=native
native=native,
source_directory=source_directory
)


Expand Down Expand Up @@ -127,7 +129,7 @@ def main(args=None, get_subs_fn=None):
for path, pkg in pkgs_dict.items():
template_files = None
try:
subs = get_subs_fn(pkg, os_name, os_version, ros_distro, args.debian_inc, args.native)
subs = get_subs_fn(pkg, os_name, os_version, ros_distro, args.debian_inc, args.native, args.src_dir)
if _place_template_files:
# Place template files
place_template_files(path, pkg.get_build_type())
Expand Down
5 changes: 4 additions & 1 deletion bloom/generators/debian/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ def generate_substitutions_from_package(
peer_packages=None,
releaser_history=None,
fallback_resolver=None,
native=False
native=False,
source_directory=None
):
peer_packages = peer_packages or []
data = {}
Expand Down Expand Up @@ -344,6 +345,8 @@ def generate_substitutions_from_package(
data['Package'] = sanitize_package_name(package.name)
# Installation prefix
data['InstallationPrefix'] = installation_prefix
# Source directory
data['SourceDirectory'] = source_directory
# Resolve dependencies
evaluate_package_conditions(package, ros_distro)
depends = [
Expand Down
7 changes: 6 additions & 1 deletion bloom/generators/debian/templates/cmake/rules.em
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ export DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

@{
dh_arguments = ''
if SourceDirectory:
dh_arguments += f" -D{SourceDirectory}"
}@
%:
dh $@@ -v --buildsystem=cmake --builddirectory=.obj-$(DEB_HOST_GNU_TYPE)
dh $@@ -v --buildsystem=cmake --builddirectory=.obj-$(DEB_HOST_GNU_TYPE)@(dh_arguments)

override_dh_auto_configure:
# In case we're installing to a non-standard location, look for a setup.sh
Expand Down

0 comments on commit b90cd20

Please sign in to comment.