diff --git a/lib/cpp-subprocess b/lib/cpp-subprocess index 05c76a5..6931e3d 160000 --- a/lib/cpp-subprocess +++ b/lib/cpp-subprocess @@ -1 +1 @@ -Subproject commit 05c76a531180298a8404bdf5fccb71137c62cd76 +Subproject commit 6931e3d69fb36e6eae099585646e54ac644bf99c diff --git a/src/core/appdir.cpp b/src/core/appdir.cpp index e185fcd..6d6fdc1 100644 --- a/src/core/appdir.cpp +++ b/src/core/appdir.cpp @@ -250,7 +250,7 @@ namespace linuxdeploy { } // search for copyright file for file and deploy it to AppDir - bool deployCopyrightFiles(const bf::path& from, const std::string& logPrefix = "") { + bool deployCopyrightFiles(const bf::path& from) { if (disableCopyrightFilesDeployment) return true; @@ -262,7 +262,7 @@ namespace linuxdeploy { if (copyrightFiles.empty()) return false; - ldLog() << logPrefix << LD_NO_SPACE << "Deploying copyright files for file" << from << std::endl; + ldLog() << "Deploying copyright files for file" << from << std::endl; for (const auto& file : copyrightFiles) { std::string targetDir = file.string(); @@ -294,22 +294,12 @@ namespace linuxdeploy { return to; } - std::string getLogPrefix(int recursionLevel) { - std::string logPrefix; - for (int i = 0; i < recursionLevel; i++) - logPrefix += " "; - return logPrefix; - } - - bool deployElfDependencies(const bf::path& path, int recursionLevel = 0) { - auto logPrefix = getLogPrefix(recursionLevel); - - ldLog() << logPrefix << LD_NO_SPACE << "Deploying dependencies for ELF file" << path << std::endl; + bool deployElfDependencies(const bf::path& path) { + ldLog() << "Deploying dependencies for ELF file" << path << std::endl; try { - for (const auto &dependencyPath : elf::ElfFile(path).traceDynamicDependencies()) { - if (!deployLibrary(dependencyPath, recursionLevel + 1)) + for (const auto &dependencyPath : elf::ElfFile(path).traceDynamicDependencies()) + if (!deployLibrary(dependencyPath, false, false)) return false; - } } catch (const elf::DependencyNotFoundError& e) { ldLog() << LD_ERROR << e.what() << std::endl; return false; @@ -334,20 +324,18 @@ namespace linuxdeploy { return stripPath; } - bool deployLibrary(const bf::path& path, int recursionLevel = 0, bool forceDeploy = false, const bf::path& destination = bf::path()) { - auto logPrefix = getLogPrefix(recursionLevel); - + bool deployLibrary(const bf::path& path, bool forceDeploy = false, bool deployDependencies = true, const bf::path& destination = bf::path()) { if (!forceDeploy && hasBeenVisitedAlready(path)) { - ldLog() << LD_DEBUG << logPrefix << LD_NO_SPACE << "File has been visited already:" << path << std::endl; + ldLog() << LD_DEBUG << "File has been visited already:" << path << std::endl; return true; } if (!bf::exists(path)) { - ldLog() << LD_ERROR << logPrefix << LD_NO_SPACE << "Cannot deploy non-existing library file:" << path << std::endl; + ldLog() << LD_ERROR << "Cannot deploy non-existing library file:" << path << std::endl; return false; } - static auto isInExcludelist = [&logPrefix](const bf::path& fileName) { + static auto isInExcludelist = [](const bf::path& fileName) { for (const auto& excludePattern : generatedExcludelist) { // simple string match is faster than using fnmatch if (excludePattern == fileName) @@ -360,7 +348,7 @@ namespace linuxdeploy { case FNM_NOMATCH: break; default: - ldLog() << LD_ERROR << logPrefix << LD_NO_SPACE << "fnmatch() reported error:" << fnmatchResult << std::endl; + ldLog() << LD_ERROR << "fnmatch() reported error:" << fnmatchResult << std::endl; return false; } } @@ -369,7 +357,7 @@ namespace linuxdeploy { }; if (!forceDeploy && isInExcludelist(path.filename())) { - ldLog() << logPrefix << LD_NO_SPACE << "Skipping deployment of blacklisted library" << path << std::endl; + ldLog() << "Skipping deployment of blacklisted library" << path << std::endl; // mark file as visited visitedFiles.insert(path); @@ -381,7 +369,7 @@ namespace linuxdeploy { // create a directory bf::path libraryDir = appDirPath / "usr" / (getLibraryDirName(path) + "/"); - ldLog() << logPrefix << LD_NO_SPACE << "Deploying shared library" << path; + ldLog() << "Deploying shared library" << path; if (!destination.empty()) ldLog() << " (destination:" << destination << LD_NO_SPACE << ")"; ldLog() << std::endl; @@ -395,7 +383,7 @@ namespace linuxdeploy { // in case destinationPath is a directory, deployFile will give us the deployed file's path actualDestination = deployFile(path, actualDestination); - deployCopyrightFiles(path, logPrefix); + deployCopyrightFiles(path); std::string rpath = "$ORIGIN"; @@ -423,10 +411,10 @@ namespace linuxdeploy { stripOperations.insert(actualDestination); - if (!deployElfDependencies(path, recursionLevel)) - return false; - - return true; + if (!deployDependencies) + return true; + + return deployElfDependencies(path); } bool deployExecutable(const bf::path& path, const boost::filesystem::path& destination) { @@ -625,11 +613,11 @@ namespace linuxdeploy { } bool AppDir::deployLibrary(const bf::path& path, const bf::path& destination) { - return d->deployLibrary(path, 0, false, destination); + return d->deployLibrary(path, false, true, destination); } bool AppDir::forceDeployLibrary(const bf::path& path, const bf::path& destination) { - return d->deployLibrary(path, 0, true, destination); + return d->deployLibrary(path, true, true, destination); } bool AppDir::deployExecutable(const bf::path& path, const boost::filesystem::path& destination) { diff --git a/src/core/generate-excludelist.sh b/src/core/generate-excludelist.sh index 6c698b9..d92cb13 100644 --- a/src/core/generate-excludelist.sh +++ b/src/core/generate-excludelist.sh @@ -18,7 +18,7 @@ log_prefix="-- [$(basename $0)]" echo "$log_prefix downloading excludelist from GitHub" url="https://raw.githubusercontent.com/probonopd/AppImages/master/excludelist" -blacklisted=($(wget --quiet "$url" -O - | sort | uniq | grep -v "^#.*" | grep "[^-\s]")) +blacklisted=($(wget --quiet "$url" -O - | sed 's|#.*||g' | sort | uniq)) # sanity check if [ "$blacklisted" == "" ]; then