From 717eebcaf7679f7abac40d745820444251d0f68a Mon Sep 17 00:00:00 2001 From: probonopd Date: Fri, 17 Nov 2017 17:50:44 +0100 Subject: [PATCH] Fix bugs as per https://github.com/probonopd/linuxdeployqt/issues/184#issuecomment-345293540 Thanks @tresf --- tools/linuxdeployqt/shared.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/linuxdeployqt/shared.cpp b/tools/linuxdeployqt/shared.cpp index e77ffa4..cff4fad 100644 --- a/tools/linuxdeployqt/shared.cpp +++ b/tools/linuxdeployqt/shared.cpp @@ -291,7 +291,7 @@ bool copyCopyrightFile(QString libPath){ } QString dpkgQueryPath; - dpkgQueryPath = QStandardPaths::findExecutable("dpkg"); + dpkgQueryPath = QStandardPaths::findExecutable("dpkg-query"); if(dpkgQueryPath == ""){ LogNormal() << "dpkg-query not found, hence not deploying copyright files"; return false; @@ -301,19 +301,17 @@ bool copyCopyrightFile(QString libPath){ /* Find out which package the file being deployed belongs to */ - QString program = "dpkg"; QStringList arguments; arguments << "-S" << libPath; QProcess *myProcess = new QProcess(); - myProcess->start(program, arguments); + myProcess->start(dpkgPath, arguments); myProcess->waitForFinished(); QString strOut = myProcess->readAllStandardOutput().split(':')[0]; if(strOut == "") return false; /* Find out the copyright file in that package */ - program = "dpkg-query"; arguments << "-L" << strOut; - myProcess->start(program, arguments); + myProcess->start(dpkgQueryPath, arguments); myProcess->waitForFinished(); strOut = myProcess->readAllStandardOutput(); @@ -321,8 +319,10 @@ bool copyCopyrightFile(QString libPath){ foreach (QString outputLine, outputLines) { if((outputLine.contains("usr/share/doc")) && (outputLine.contains("/copyright")) && (outputLine.contains(" "))){ - copyrightFilePath = outputLine.split(' ')[1]; - break; + // copyrightFilePath = outputLine.split(' ')[1]; // This is not working on multiarch systems; see https://github.com/probonopd/linuxdeployqt/issues/184#issuecomment-345293540 + QStringList parts = outputLine.split(' '); + copyrightFilePath = parts[parts.size() - 1]; // Grab last element + break; } }