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

Policy: automatically add libstdc++ in requires #295

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 7 additions & 6 deletions HaikuPorter/Package.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,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 @@ -237,10 +244,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 @@ -265,8 +268,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
Loading