Skip to content

Commit

Permalink
ebuild: patches are now applied via PATCHES variable
Browse files Browse the repository at this point in the history
  • Loading branch information
gentoo90 committed Sep 24, 2023
1 parent 6dd99a3 commit eec9701
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
13 changes: 4 additions & 9 deletions superflore/generators/ebuild/ebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,10 @@ def get_ebuild_text(self, distributor, license_text):

# Patch source if needed.
if self.has_patches:
# TODO(allenh1): explicitly list patches
ret += "\nsrc_prepare() {\n"
ret += " cd ${P}\n"
ret += " EPATCH_SOURCE=\"${FILESDIR}\""
ret += " EPATCH_SUFFIX=\"patch\" \\\n"
ret += " EPATCH_FORCE=\"yes\" epatch\n"
if self.build_type in ['catkin', 'cmake']:
ret += " ros-cmake_src_prepare\n"
ret += "}\n"
ret += "\nPATCHES=(\n"
for patch in self.patches:
ret += " \"${{FILESDIR}}/{}\"\n".format(patch)
ret += ")\n"

# source configuration
if self.name == 'opencv3':
Expand Down
2 changes: 1 addition & 1 deletion superflore/generators/ebuild/gen_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def regenerate_pkg(overlay, pkg, distro, preserve_existing=False):
patches = None
if os.path.exists(patch_path):
patches = [
f for f in glob.glob('%s/*.patch' % patch_path)
f for f in glob.glob('*.patch', root_dir=patch_path)
]
if pkg not in pkg_names:
raise RuntimeError("Unknown package '%s'" % (pkg))
Expand Down
10 changes: 2 additions & 8 deletions tests/test_ebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,13 @@ def test_has_patches(self):
ebuild = self.get_ebuild()
ebuild.has_patches = True;
got_text = ebuild.get_ebuild_text('Open Source Robotics Foundation', 'BSD')
self.assertTrue('EPATCH_SOURCE="${FILESDIR}"' in got_text)
self.assertTrue('EPATCH_SUFFIX="patch"' in got_text)
self.assertTrue('EPATCH_FORCE="yes"' in got_text)
self.assertTrue('epatch' in got_text)
self.assertTrue('PATCHES=(' in got_text)

def test_lacks_patches(self):
"""Test Non-Patched Code Generation"""
ebuild = self.get_ebuild()
got_text = ebuild.get_ebuild_text('Open Source Robotics Foundation', 'BSD')
self.assertFalse('EPATCH_SOURCE="${FILESDIR}"' in got_text)
self.assertFalse('EPATCH_SUFFIX="patch"' in got_text)
self.assertFalse('EPATCH_FORCE="yes"' in got_text)
self.assertFalse('epatch' in got_text)
self.assertFalse('PATCHES=(' in got_text)

def test_opencv3_filter_flags(self):
"""Test Filter Flags for OpenCV3"""
Expand Down

0 comments on commit eec9701

Please sign in to comment.