diff --git a/HaikuPorter/Package.py b/HaikuPorter/Package.py index 986b7db..3c1f9bc 100644 --- a/HaikuPorter/Package.py +++ b/HaikuPorter/Package.py @@ -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'] \ @@ -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') @@ -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) diff --git a/HaikuPorter/Policy.py b/HaikuPorter/Policy.py index 8ed30cf..81fcf81 100644 --- a/HaikuPorter/Policy.py +++ b/HaikuPorter/Policy.py @@ -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_'):