4
1
mirror of https://github.com/QuasarApp/CQtDeployer.git synced 2025-05-05 22:19:36 +00:00

ref fix case sensitivity of checked libraries

This commit is contained in:
Andrei Yankovich 2021-08-31 11:42:45 +03:00
parent 65a765fed3
commit f7576405e6
10 changed files with 79 additions and 60 deletions

@ -221,7 +221,7 @@ bool iDistribution::collectInfo(const DistroModule& pkg,
bashShortCutsArray += "\"" + targetInfo.getRunScriptFile() + "\"";
}
if (fileinfo.suffix().compare("exe", ONLY_WIN_CASE_INSENSIATIVE) == 0 || fileinfo.suffix().isEmpty()) {
if (fileinfo.suffix().compare("exe", Qt::CaseInsensitive) == 0 || fileinfo.suffix().isEmpty()) {
if (cmdArray.size() > initSize) {
cmdArray += ",";
bashArray += " ";

@ -149,7 +149,7 @@ void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res, QSet<QS
if (!scanedLib.isValid()) {
QSet<LibInfo> listDep = {};
if (!lib._name.compare(dep.value()._name, ONLY_WIN_CASE_INSENSIATIVE))
if (!lib._name.compare(dep.value()._name, DeployCore::getCaseSensitivity(lib._name)))
continue;
recursiveDep(*dep, listDep, libStack);

@ -14,12 +14,6 @@
#define DISTRO_DIR QString("DistributionKit")
#ifdef Q_OS_WIN
#define ONLY_WIN_CASE_INSENSIATIVE Qt::CaseInsensitive
#else
#define ONLY_WIN_CASE_INSENSIATIVE Qt::CaseSensitive
#endif
#if defined(DEPLOY_LIBRARY)
# define DEPLOYSHARED_EXPORT Q_DECL_EXPORT
#else

@ -105,12 +105,12 @@ DeployCore::QtModule DeployCore::getQtModule(const QString& path) {
void DeployCore::addQtModule(DeployCore::QtModule &module, const QString &path) {
QuasarAppUtils::Params::log("Current module " + QString::number(module),
QuasarAppUtils::Debug);
QuasarAppUtils::Debug);
auto mod = getQtModule(path);
QuasarAppUtils::Params::log("Add new module from path " + path +
" module value " + QString::number(mod),
QuasarAppUtils::Debug);
" module value " + QString::number(mod),
QuasarAppUtils::Debug);
module = static_cast<DeployCore::QtModule>(
@ -251,15 +251,15 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"deb", "-deb"}, "",
"Create the deb package for deployment programm"
" You can specify the path to your own debian template.",
"cqtdeployer -deb path/to/myCustom/DEBIAN."
"Create the deb package for deployment programm"
" You can specify the path to your own debian template.",
"cqtdeployer -deb path/to/myCustom/DEBIAN."
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"deploySystem"}, "",
"Deploys all libraries."
" Not recomendet because there may be conflicts with system libraries"
" (on snap version you need to turn on permission)"
"Deploys all libraries."
" Not recomendet because there may be conflicts with system libraries"
" (on snap version you need to turn on permission)"
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"noQt"}, "",
@ -271,10 +271,10 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"getDefaultTemplate"}, "",
"Extracts defaults deb or qif templates."
" All templates extract into targetDirectory."
" For change target directory use the targetDir option.",
"cqtdeployer -bin myExecutable getDefaultTemplate qif deb."
"Extracts defaults deb or qif templates."
" All templates extract into targetDirectory."
" For change target directory use the targetDir option.",
"cqtdeployer -bin myExecutable getDefaultTemplate qif deb."
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"noHashSum"}, "",
@ -302,10 +302,10 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
help.insert(group, {QuasarAppUtils::OptionData{
{"-confFile"}, "{params}",
"The path to the json file with all deployment configurations. Using this file,"
" you can add the necessary options, thereby simplifying the command invocation in the console."
" However, the parameters in Kansol have a higher priority than in the file."
" For more info about this flag see https://github.com/QuasarApp/CQtDeployer/wiki/DeployConfigFileEn"
"The path to the json file with all deployment configurations. Using this file,"
" you can add the necessary options, thereby simplifying the command invocation in the console."
" However, the parameters in Kansol have a higher priority than in the file."
" For more info about this flag see https://github.com/QuasarApp/CQtDeployer/wiki/DeployConfigFileEn"
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-qmlDir"}, "{params}",
@ -336,8 +336,8 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
{"-extraLibs"}, "{list,params}",
"Sets the mask of the library name for forced copying.",
"\"-extraLib mySql\" - forces to copy all libraries whose names contain mySql to the project folder."
" This option is case-insensitive on Windows and case-sensitive on other platforms."
" This option will only search libraries in system environments similar to **deploySystem**."
" This option is case-insensitive on Windows and case-sensitive on other platforms."
" This option will only search libraries in system environments similar to **deploySystem**."
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-customScript"}, "{scriptCode}",
@ -364,9 +364,9 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-runScript"}, "{list,parems}",
"forces cqtdeployer swap default run script to new from the arguments of option."
" This option copy all content from input file and insert all code into runScript.sh or .bat",
"cqtdeployer -runScript \"myTargetMame;path/to/my/myCustomLaunchScript.sh,myTargetSecondMame;path/to/my/mySecondCustomLaunchScript.sh\""
"forces cqtdeployer swap default run script to new from the arguments of option."
" This option copy all content from input file and insert all code into runScript.sh or .bat",
"cqtdeployer -runScript \"myTargetMame;path/to/my/myCustomLaunchScript.sh,myTargetSecondMame;path/to/my/mySecondCustomLaunchScript.sh\""
}});
group = "Part 3 Control of packages options";
@ -374,7 +374,7 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
help.insert(group, {QuasarAppUtils::OptionData{
{"-targetPackage"}, "{package;tar1,package;tar2}",
"Creates a new package and adds 'tar1 and tar2' to it. "
"If you want configure the package that do not have any targets use the allowEmptyPackages option."
"If you want configure the package that do not have any targets use the allowEmptyPackages option."
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-qmlOut"}, "{package;path,path}",
@ -408,7 +408,7 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
help.insert(group, {QuasarAppUtils::OptionData{
{"-name"}, "{package;val,val}",
"Sets name for a package."
"If this if you do not specify a package, the value will be assigned to the default package ("")"
"If this if you do not specify a package, the value will be assigned to the default package ("")"
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-description"}, "{package;val,val}",
@ -466,16 +466,16 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-enablePlugins"}, "{package;val1;val2,SingeleVa}",
"Enables additional plugins for distribution."
" By default disabled next plugins: " + PluginsParser::defaultForbidenPlugins().join(',') + " if you want enable"
" it then use '-enablePlugins " + PluginsParser::defaultForbidenPlugins().join(',') + "' option"
"Enables additional plugins for distribution."
" By default disabled next plugins: " + PluginsParser::defaultForbidenPlugins().join(',') + " if you want enable"
" it then use '-enablePlugins " + PluginsParser::defaultForbidenPlugins().join(',') + "' option"
}});
help.insert(group, {QuasarAppUtils::OptionData{
{"-disablePlugins"}, "{package;val1;val2,SingeleVal}",
"Disables plugins for distribution. "
"You can disable any plugin of your Qt build, just see the yourQtFolder/plugins forlder for available plugins."
" Example if you want disable qxcb plugin: -disablePlugins qxcb."
" Note that the name of the plugin is indicated without its extension"
"Disables plugins for distribution. "
"You can disable any plugin of your Qt build, just see the yourQtFolder/plugins forlder for available plugins."
" Example if you want disable qxcb plugin: -disablePlugins qxcb."
" Note that the name of the plugin is indicated without its extension"
}});
group = "Part 6 QtInstallFramework options";
@ -589,7 +589,7 @@ QString DeployCore::findProcess(const QString &env, const QString& proc) {
auto files = QDir(path).entryInfoList(QDir::NoDotAndDotDot | QDir::Files);
for (const auto& bin : files) {
if (bin.baseName().compare(proc, ONLY_WIN_CASE_INSENSIATIVE) == 0) {
if (bin.baseName().compare(proc, DeployCore::getCaseSensitivity()) == 0) {
return bin.absoluteFilePath();
}
}
@ -605,7 +605,7 @@ QStringList DeployCore::debugExtensions() {
bool DeployCore::isDebugFile(const QString &file) {
auto debug = debugExtensions();
for (const auto& debugEx: debug) {
if (file.contains(debugEx, ONLY_WIN_CASE_INSENSIATIVE)) {
if (file.contains(debugEx, Qt::CaseInsensitive)) {
return true;
}
}
@ -752,11 +752,11 @@ QtMajorVersion DeployCore::isQtLibName(const QString &lib) {
}
QString fileName = info.fileName();
if (fileName.contains("Qt4", ONLY_WIN_CASE_INSENSIATIVE)) {
if (fileName.contains("Qt4", getCaseSensitivity(fileName))) {
isQt = QtMajorVersion::Qt4;
} else if (fileName.contains("Qt5", ONLY_WIN_CASE_INSENSIATIVE)) {
} else if (fileName.contains("Qt5", getCaseSensitivity(fileName))) {
isQt = QtMajorVersion::Qt5;
} else if (fileName.contains("Qt6", ONLY_WIN_CASE_INSENSIATIVE)) {
} else if (fileName.contains("Qt6", getCaseSensitivity(fileName))) {
isQt = QtMajorVersion::Qt6;
}
@ -774,8 +774,8 @@ bool DeployCore::isExtraLib(const QString &lib) {
}
bool DeployCore::isAlienLib(const QString &lib) {
return lib.contains("/opt/", ONLY_WIN_CASE_INSENSIATIVE) ||
lib.contains("/PROGRAM FILES", ONLY_WIN_CASE_INSENSIATIVE);
return lib.contains("/opt/", Qt::CaseSensitive) ||
lib.contains("/PROGRAM FILES", Qt::CaseInsensitive);
}
bool DeployCore::isAllowedLib(const QString &lib) {
@ -920,6 +920,25 @@ QFileInfo DeployCore::findItem(const QString &bin) {
}
return QFileInfo(bin);
}
Qt::CaseSensitivity DeployCore::getCaseSensitivity(const QString &checkedFile) {
if (checkedFile.isEmpty()) {
#ifdef Q_OS_WIN
return Qt::CaseInsensitive;
#else
return Qt::CaseSensitive;
#endif
}
QString sufix = QFileInfo(checkedFile).completeSuffix();
if (sufix.compare("dll", Qt::CaseInsensitive) == 0 ||
sufix.compare("exe", Qt::CaseInsensitive)) {
return Qt::CaseInsensitive;
}
return Qt::CaseSensitive;
};
QString DeployCore::systemLibsFolderName() {

@ -303,6 +303,12 @@ public:
*/
static QFileInfo findItem(const QString &file);
/**
* @brief getCaseSensitivity This method return case sensitivity for a @a checkedFile. Usualy return Qt::CaseSensiativy exept windows binaryes files like a dll and exe.
* @param checkedFile This is checked file. By default empty value.
* @return Qt CaseSensitivity value
*/
static Qt::CaseSensitivity getCaseSensitivity(const QString& checkedFile = "");
};
#define internalError() DeployCore::printInternalError(__FUNCTION__, __FILE__, __LINE__)

@ -390,7 +390,7 @@ void Extracter::extractLib(const QString &file,
for (const auto &line : data.getAllDep()) {
if (mask.size() && !line.getName().contains(mask, ONLY_WIN_CASE_INSENSIATIVE)) {
if (mask.size() && !line.getName().contains(mask, DeployCore::getCaseSensitivity())) {
continue;
}

@ -178,7 +178,7 @@ bool FileManager::fileActionPrivate(const QString &file, const QString &target,
bool copy = !masks;
if (masks) {
for (const auto &mask : qAsConst(*masks)) {
if (info.absoluteFilePath().contains(mask, ONLY_WIN_CASE_INSENSIATIVE)) {
if (info.absoluteFilePath().contains(mask, DeployCore::getCaseSensitivity())) {
copy = true;
break;
}
@ -263,7 +263,7 @@ bool FileManager::smartCopyFile(const QString &file,
bool ifFileTarget) {
auto config = DeployCore::_config;
if (file.contains(config->getTargetDir(), ONLY_WIN_CASE_INSENSIATIVE)) {
if (file.contains(config->getTargetDir(), DeployCore::getCaseSensitivity())) {
if (!moveFile(file, target, mask)) {
QuasarAppUtils::Params::log("Failed to move the file. Trying to copy it");
@ -309,7 +309,7 @@ bool FileManager::copyFolder(const QString &from,
if (!force) {
QString skipFilter = "";
for (const auto &i: filter) {
if (item.fileName().contains(i, ONLY_WIN_CASE_INSENSIATIVE)) {
if (item.fileName().contains(i, DeployCore::getCaseSensitivity())) {
skipFilter = i;
break;
}
@ -496,7 +496,7 @@ bool FileManager::copyFiles(const QStringList &source,
QString skipFilter = "";
for (const auto &i: filter) {
if (info.fileName().contains(i, ONLY_WIN_CASE_INSENSIATIVE)) {
if (info.fileName().contains(i, DeployCore::getCaseSensitivity())) {
skipFilter = i;
break;
}

@ -27,7 +27,7 @@ void IgnoreRule::addRule(const IgnoreData &rule) {
}
bool IgnoreRule::check(const LibInfo &info, const QString& ignoreLabel) const {
if (info.fullPath().contains(ignoreLabel, ONLY_WIN_CASE_INSENSIATIVE)) {
if (info.fullPath().contains(ignoreLabel, DeployCore::getCaseSensitivity())) {
QuasarAppUtils::Params::log(info.fullPath() + " ignored by filter" + ignoreLabel);
return true;
}

@ -86,11 +86,11 @@ bool QtDir::isQt(QString path) const {
path = PathUtils::fixPath(path);
return
(!libs.isEmpty() && path.contains(libs, ONLY_WIN_CASE_INSENSIATIVE)) ||
(!bins.isEmpty() && path.contains(bins, ONLY_WIN_CASE_INSENSIATIVE)) ||
(!libexecs.isEmpty() && path.contains(libexecs, ONLY_WIN_CASE_INSENSIATIVE)) ||
(!plugins.isEmpty() && path.contains(plugins, ONLY_WIN_CASE_INSENSIATIVE)) ||
(!qmls.isEmpty() && path.contains(qmls, ONLY_WIN_CASE_INSENSIATIVE)) ||
(!translations.isEmpty() && path.contains(translations, ONLY_WIN_CASE_INSENSIATIVE)) ||
(!resources.isEmpty() && path.contains(resources, ONLY_WIN_CASE_INSENSIATIVE));
(!libs.isEmpty() && path.contains(libs, DeployCore::getCaseSensitivity())) ||
(!bins.isEmpty() && path.contains(bins, DeployCore::getCaseSensitivity())) ||
(!libexecs.isEmpty() && path.contains(libexecs, DeployCore::getCaseSensitivity())) ||
(!plugins.isEmpty() && path.contains(plugins, DeployCore::getCaseSensitivity())) ||
(!qmls.isEmpty() && path.contains(qmls, DeployCore::getCaseSensitivity())) ||
(!translations.isEmpty() && path.contains(translations, DeployCore::getCaseSensitivity())) ||
(!resources.isEmpty() && path.contains(resources, DeployCore::getCaseSensitivity()));
}

@ -20,7 +20,7 @@ ModulesQt513::~ModulesQt513() {
QSet<QString> ModulesQt513::ignoreFilter(const QSet<QString> &input, const QString &filter) const {
QSet<QString> res;
for (auto& val : input) {
if (!val.contains(filter, ONLY_WIN_CASE_INSENSIATIVE)) {
if (!val.contains(filter, DeployCore::getCaseSensitivity())) {
res.insert(val);
}
}