Skip to content

Commit

Permalink
Policy: automatically add libstdc++ in requires
Browse files Browse the repository at this point in the history
instead of ignoring it.
* fixes #278
  • Loading branch information
korli committed Sep 6, 2024
1 parent 63d44b8 commit 5e5a2b4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
13 changes: 7 additions & 6 deletions HaikuPorter/Package.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ def populatePackagingDir(self, port):
def makeHpkg(self, requiresUpdater):
"""Create a package suitable for distribution"""

packageFile = self.hpkgDir + '/' + self.hpkgName
if os.path.exists(packageFile):
os.remove(packageFile)

# policy check, add some requires
self.policy.checkPackage(self, packageFile)

if (requiresUpdater and self.type != PackageType.SOURCE):
requiresList = self.recipeKeys['REQUIRES']
self.recipeKeys['UPDATED_REQUIRES'] \
Expand All @@ -224,10 +231,6 @@ def makeHpkg(self, requiresUpdater):
self._generatePackageInfo(self.packagingDir + '/.PackageInfo',
[requiresName], getOption('quiet'), False, True, self.architecture)

packageFile = self.hpkgDir + '/' + self.hpkgName
if os.path.exists(packageFile):
os.remove(packageFile)

# mimeset the files that shall go into the package
info('mimesetting files for package ' + self.hpkgName + ' ...')
dataDir = os.path.join(self.packagingDir, 'data')
Expand All @@ -252,8 +255,6 @@ def makeHpkg(self, requiresUpdater):
output = check_output([Configuration.getPackageCommand(), 'create', packageFile],
cwd=self.packagingDir).decode('utf-8')
info(output)
# policy check
self.policy.checkPackage(self, packageFile)

# Clean up after ourselves
shutil.rmtree(self.packagingDir)
Expand Down
13 changes: 9 additions & 4 deletions HaikuPorter/Policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,17 @@ def _checkLibraryDependenciesOfFile(self, dirPath, path):
for library in libraries:
if self._isMissingLibraryDependency(library, dirPath, rpath):
if (library.startswith('libgcc') or
library.startswith('libstdc++') or
library.startswith('libsupc++')):
continue
self._violation('"%s" needs library "%s", but the '
'package doesn\'t seem to declare that as a '
'requirement' % (path, library))
if (library.startswith('libstdc++')):
suffixIndex = library.find('.so')
resolvableName = self._normalizeResolvableName(
'lib:' + library[:suffixIndex] + self.secondaryArchSuffix)
self.package.recipeKeys['REQUIRES'] += [ resolvableName ]
else:
self._violation('"%s" needs library "%s", but the '
'package doesn\'t seem to declare that as a '
'requirement' % (path, library))

def _isMissingLibraryDependency(self, library, dirPath, rpath):
if library.startswith('_APP_'):
Expand Down

0 comments on commit 5e5a2b4

Please sign in to comment.