Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor generator #539

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b63931b
get_package_data return list, reuse it
lennonwoo Jun 8, 2019
05363ff
reuse post_rebase in release generator
lennonwoo Jun 9, 2019
41037cb
change resolver into class's staticmethod
lennonwoo Jun 9, 2019
0495da6
use common Inc and package system
lennonwoo Jun 9, 2019
fba38ed
put class relate method to where it belongs
lennonwoo Jun 9, 2019
0c9693d
PackageSystemGenerator for collecting common process arguemnt function
lennonwoo Jun 12, 2019
c10869f
common function when generate packages files
lennonwoo Jun 12, 2019
95cc65b
deal with specific part of template operation
lennonwoo Jul 3, 2019
1f5a705
use pacakge manager as base generator's name
lennonwoo Jun 15, 2019
0e1c8c0
refactor RpmGenerator
lennonwoo Jun 15, 2019
452fece
add set_default_distros test
lennonwoo Jun 16, 2019
263275f
test place template files logic added
lennonwoo Jun 16, 2019
d2ef245
check_all_key_are_valid function test added
lennonwoo Jun 16, 2019
d1aa11c
test common part of substitutions
lennonwoo Jun 16, 2019
8c23028
add missed rosdistro in super's get_subs_hooks
lennonwoo Jul 3, 2019
87123ef
Drop 'Group' value from RPM spec templates
cottsay Apr 22, 2019
5db12cc
Use 'autosetup' macro in RPM spec files
cottsay Apr 23, 2019
ff203da
Use 'make_*' macros in RPM spec files
cottsay Apr 23, 2019
fd52e5c
Use more standard 4-space indentation in RPM spec files
cottsay Apr 23, 2019
68583c4
Disable dependency generation in RPM spec files
cottsay Apr 23, 2019
24eb6d4
Disable automagic byte compilation in RPM spec files
cottsay Apr 23, 2019
6bb0248
Use 'cmake3' macro in RPM spec files
cottsay Apr 23, 2019
95afe33
Always create archive of sources when building RPM (#540)
cottsay Jul 18, 2019
970380e
Merge remote-tracking branch 'origin/master' into HEAD
lennonwoo Aug 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
760 changes: 758 additions & 2 deletions bloom/generators/common.py

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions bloom/generators/debian/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .generator import DebianGenerator
from .generator import sanitize_package_name
from .generator import format_depends
from .generator import format_description

__all__ = ['DebianGenerator', 'sanitize_package_name']
__all__ = ['DebianGenerator', 'format_description', 'format_depends']
28 changes: 19 additions & 9 deletions bloom/generators/debian/generate_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@
from bloom.logging import fmt
from bloom.logging import info

from bloom.generators.debian.generator import generate_substitutions_from_package
from bloom.generators.debian.generator import place_template_files
from bloom.generators.debian.generator import process_template_files
from bloom.generators.common import generate_substitutions_from_package
from bloom.generators.common import place_template_files
from bloom.generators.common import process_template_files

from bloom.generators.debian.generator import DebianGenerator
from bloom.generators.debian.generator import format_description
from bloom.generators.debian.generator import format_depends

from bloom.util import get_distro_list_prompt

Expand Down Expand Up @@ -80,13 +84,18 @@ def prepare_arguments(parser):


def get_subs(pkg, os_name, os_version, ros_distro, native=False):
return generate_substitutions_from_package(
subs = generate_substitutions_from_package(
pkg,
os_name,
os_version,
ros_distro,
native=native
format_description,
format_depends,
)
subs = DebianGenerator.get_subs_hook(subs, pkg, ros_distro)
# Debian Package Format
subs['format'] = 'native' if native else 'quilt'
return subs


def main(args=None, get_subs_fn=None):
Expand Down Expand Up @@ -120,20 +129,21 @@ def main(args=None, get_subs_fn=None):
fmt("Generating debs for @{cf}%s:%s@| for package(s) %s" %
(os_name, os_version, [p.name for p in pkgs_dict.values()])))

package_manager = DebianGenerator.package_manager
for path, pkg in pkgs_dict.items():
template_files = None
try:
subs = get_subs_fn(pkg, os_name, os_version, ros_distro, args.native)
if _place_template_files:
# Place template files
place_template_files(path, pkg.get_build_type())
place_template_files(path, pkg.get_build_type(), package_manager)
if _process_template_files:
# Just process existing template files
template_files = process_template_files(path, subs)
template_files = process_template_files(path, subs, package_manager)
if not _place_template_files and not _process_template_files:
# If neither, do both
place_template_files(path, pkg.get_build_type())
template_files = process_template_files(path, subs)
place_template_files(path, pkg.get_build_type(), package_manager)
template_files = process_template_files(path, subs, package_manager)
if template_files is not None:
for template_file in template_files:
os.remove(os.path.normpath(template_file))
Expand Down
Loading