Accepting request 944220 from home:jirislaby:branches:graphics

- replace the revert by an upstream fix
  * add 0001-fixed-1488-getDirectoryList-failed-on-Linux-when-lib.patch
  * remove
    0001-Revert-AppImage-build-on-GitHub-Actions-with-go-appi.patch
    0002-Revert-RS_System-getDirectoryList-add-plugins-folder.patch
    0003-Revert-fix-RS_System-getDirectoryList-use-relative-p.patch

OBS-URL: https://build.opensuse.org/request/show/944220
OBS-URL: https://build.opensuse.org/package/show/graphics/librecad?expand=0&rev=63
This commit is contained in:
2022-01-06 12:03:32 +00:00
committed by Git OBS Bridge
parent 5a6fdaf1e6
commit fbbbf27993
6 changed files with 283 additions and 199 deletions

View File

@@ -1,83 +0,0 @@
From: Jiri Slaby <jslaby@suse.cz>
Date: Sat, 1 Jan 2022 17:34:34 +0100
Subject: Revert "AppImage - build on GitHub Actions, with go-appimage tool"
Patch-mainline: waiting for fix
References: paths fix
This reverts commit a64f1f481cd3316e9cce79beeeafd59faf67b703, it breaks
paths construction.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
librecad/src/lib/engine/rs_system.cpp | 12 +++++-------
librecad/src/lib/engine/rs_system.h | 2 +-
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/librecad/src/lib/engine/rs_system.cpp b/librecad/src/lib/engine/rs_system.cpp
index 2093f31c79a0..9103eff3302c 100644
--- a/librecad/src/lib/engine/rs_system.cpp
+++ b/librecad/src/lib/engine/rs_system.cpp
@@ -3,7 +3,6 @@
** This file is part of the LibreCAD project, a 2D CAD program
**
** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
-** Copyright (C) 2021 A. Stebich (librecad@mail.lordofbikes.de)
** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
**
**
@@ -61,6 +60,7 @@ void RS_System::init(const QString& appName, const QString& appVersion,
else {
this->appDir = appDir;
}
+ binDir = QCoreApplication::applicationDirPath();
RS_DEBUG->print("RS_System::init: System %s initialized.", appName.toLatin1().data());
RS_DEBUG->print("RS_System::init: App dir: %s", appDir.toLatin1().data());
@@ -570,20 +570,18 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) {
}
#ifdef Q_OS_UNIX
- RS_DEBUG->print( RS_Debug::D_ERROR, "RS_System::getDirectoryList: %s", appDir.toStdString().c_str());
+ RS_DEBUG->print( RS_Debug::D_ERROR, "RS_System::getDirectoryList: %s", binDir.toStdString().c_str());
// for AppImage use relative paths from executable
// from packet manager the executable is in /usr/bin
// in AppImage the executable is APPDIR/usr/bin
// so this should work for paket manager and AppImage distribution
- dirList.append( QDir::cleanPath( appDir + "/../share/doc/" + appDirName + "/" + subDirectory));
+ dirList.append( QDir::cleanPath( binDir + "/../share/doc/" + appDirName + "/" + subDirectory));
// Redhat style:
- dirList.append( QDir::cleanPath( appDir + "/../share/" + appDirName + "/" + subDirectory));
- // Debian style:
- dirList.append( QDir::cleanPath( appDir + "/../lib/" + appDirName + "/" + subDirectory));
+ dirList.append( QDir::cleanPath( binDir + "/../share/" + appDirName + "/" + subDirectory));
if (QStringLiteral( "plugins") == subDirectory) {
- dirList.append( QDir::cleanPath( appDir + "/../lib/" + appDirName));
+ dirList.append( QDir::cleanPath( binDir + "/../lib/" + appDirName));
}
#endif
diff --git a/librecad/src/lib/engine/rs_system.h b/librecad/src/lib/engine/rs_system.h
index 3342f63722b5..745ffdbde646 100644
--- a/librecad/src/lib/engine/rs_system.h
+++ b/librecad/src/lib/engine/rs_system.h
@@ -3,7 +3,6 @@
** This file is part of the LibreCAD project, a 2D CAD program
**
** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
-** Copyright (C) 2021 A. Stebich (librecad@mail.lordofbikes.de)
** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
**
**
@@ -198,6 +197,7 @@ protected:
QString appVersion;
QString appDirName;
QString appDir;
+ QString binDir;
QStringList languageList; //< List of available translations
bool initialized;
--
2.34.1

View File

@@ -0,0 +1,272 @@
From: Armin Stebich <home@mail.lordofbikes.de>
Date: Thu, 6 Jan 2022 11:36:44 +0100
Subject: fixed #1488, getDirectoryList() failed on Linux when librecad is in
$PATH
Git-repo: git://github.com/LibreCAD/LibreCAD.git
Git-commit: 8c3b652a8813588d67ef6bef17ea83ccc3b20f89
Patch-mainline: yes
References: paths fix
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
librecad/src/lib/engine/rs_system.cpp | 27 ++++---
librecad/src/lib/engine/rs_system.h | 15 +---
librecad/src/main/console_dxf2pdf/console_dxf2pdf.cpp | 61 ++++++++----------
librecad/src/main/main.cpp | 21 ++----
4 files changed, 57 insertions(+), 67 deletions(-)
--- a/librecad/src/lib/engine/rs_system.cpp
+++ b/librecad/src/lib/engine/rs_system.cpp
@@ -47,20 +47,20 @@ RS_System* RS_System::uniqueInstance = N
* @param appVersion Application version (e.g. "1.2.3")
* @param appDirName Application directory name used for
* subdirectories in /usr, /etc ~/.
- * @param appDir Absolute application directory (e.g. /opt/qcad)
- * defaults to current directory.
*/
-void RS_System::init(const QString& appName, const QString& appVersion,
- const QString& appDirName, const QString& appDir) {
+void RS_System::init(const QString& appName,
+ const QString& appVersion,
+ const QString& appDirName) {
this->appName = appName;
this->appVersion = appVersion;
this->appDirName = appDirName;
- if (appDir == "") {
- this->appDir = QDir::currentPath();
- }
- else {
- this->appDir = appDir;
- }
+ this->appDir = QCoreApplication::applicationDirPath();
+
+ // when appDir is not HOME or CURRENT dir, search appDir too in getDirectoryList()
+ externalAppDir = (!appDir.isEmpty()
+ && "/" != appDir
+ && getHomeDir() != appDir
+ && getCurrentDir() != appDir);
RS_DEBUG->print("RS_System::init: System %s initialized.", appName.toLatin1().data());
RS_DEBUG->print("RS_System::init: App dir: %s", appDir.toLatin1().data());
@@ -563,14 +563,15 @@ QStringList RS_System::getDirectoryList(
dirList.append( getHomeDir() + "/." + appDirName + "/" + subDirectory);
//local (application) directory has priority over other dirs:
- if (!appDir.isEmpty() && appDir!="/" && appDir!=getHomeDir()) {
- if (appDir != getCurrentDir() && subDirectory != QString( "plugins")) {// 17 Aug, 2011, Dongxu Li, do not look for plugins in the current folder, we should install plugins to system or ~/.LibreCAD/plugins/
+ if (!subDirectory.compare( "plugins")) {
+ // 17 Aug, 2011, Dongxu Li, do not look for plugins in the current folder,
+ // we should install plugins to system or ~/.librecad/plugins/
+ if (externalAppDir) {
dirList.append( appDir + "/" + subDirectory);
}
}
#ifdef Q_OS_UNIX
- RS_DEBUG->print( RS_Debug::D_ERROR, "RS_System::getDirectoryList: %s", appDir.toStdString().c_str());
// for AppImage use relative paths from executable
// from packet manager the executable is in /usr/bin
// in AppImage the executable is APPDIR/usr/bin
--- a/librecad/src/lib/engine/rs_system.h
+++ b/librecad/src/lib/engine/rs_system.h
@@ -63,8 +63,9 @@ public:
return uniqueInstance;
}
- void init(const QString& appName, const QString& appVersion,
- const QString& appDirName, const QString& appDir="");
+ void init(const QString& appName,
+ const QString& appVersion,
+ const QString& appDirName);
void initLanguageList();
void initAllLanguagesList();
@@ -86,13 +87,6 @@ public:
}
/**
- * @return Application directory.
- */
- QString getAppDir() {
- return appDir;
- }
-
- /**
* @return Application Data directory.
*/
QString getAppDataDir();
@@ -200,7 +194,8 @@ protected:
QString appDir;
QStringList languageList; //< List of available translations
- bool initialized;
+ bool initialized {false};
+ bool externalAppDir {false};
QList<QSharedPointer<RS_Locale> > allKnownLocales;
};
--- a/librecad/src/main/console_dxf2pdf/console_dxf2pdf.cpp
+++ b/librecad/src/main/console_dxf2pdf/console_dxf2pdf.cpp
@@ -3,6 +3,7 @@
** This file was created for the LibreCAD project, a 2D CAD program.
**
** Copyright (C) 2018 Alexander Pravdin <aledin@mail.ru>
+** Copyright (C) 2022 A. Stebich (librecad@mail.lordofbikes.de)
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
@@ -45,8 +46,6 @@ static void parseMarginsArg(QString, Pdf
int console_dxf2pdf(int argc, char* argv[])
{
- //QT_REQUIRE_VERSION(argc, argv, "5.2.1");
-
RS_DEBUG->setLevel(RS_Debug::D_NOTHING);
QApplication app(argc, argv);
@@ -55,78 +54,78 @@ int console_dxf2pdf(int argc, char* argv
QCoreApplication::setApplicationVersion(XSTR(LC_VERSION));
QFileInfo prgInfo(QFile::decodeName(argv[0]));
- QString prgDir(prgInfo.absolutePath());
RS_SETTINGS->init(app.organizationName(), app.applicationName());
- RS_SYSTEM->init(app.applicationName(), app.applicationVersion(),
- XSTR(QC_APPDIR), prgDir);
+ RS_SYSTEM->init( app.applicationName(), app.applicationVersion(), XSTR(QC_APPDIR));
QCommandLineParser parser;
- QString appDesc;
- QString librecad;
+ QStringList appDesc;
+ QString librecad( prgInfo.filePath());
if (prgInfo.baseName() != "dxf2pdf") {
- librecad = prgInfo.filePath();
- appDesc = "\ndxf2pdf usage: " + prgInfo.filePath()
- + " dxf2pdf [options] <dxf_files>\n";
+ librecad += " dxf2pdf"; // executable is not dxf2pdf, thus argv[1] must be 'dxf2pdf'
+ appDesc << "";
+ appDesc << "dxf2pdf " + QObject::tr( "usage: ") + librecad + QObject::tr( " [options] <dxf_files>");
}
- appDesc += "\nPrint a bunch of DXF files to PDF file(s).";
- appDesc += "\n\n";
- appDesc += "Examples:\n\n";
- appDesc += " " + librecad + " dxf2pdf *.dxf";
- appDesc += " -- print all dxf files to pdf files with the same names.\n";
- appDesc += "\n";
- appDesc += " " + librecad + " dxf2pdf -o some.pdf *.dxf";
- appDesc += " -- print all dxf files to 'some.pdf' file.";
- parser.setApplicationDescription(appDesc);
+ appDesc << "";
+ appDesc << "Print a bunch of DXF files to PDF file(s).";
+ appDesc << "";
+ appDesc << "Examples:";
+ appDesc << "";
+ appDesc << " " + librecad + QObject::tr( " *.dxf");
+ appDesc << " " + QObject::tr( "-- print all dxf files to pdf files with the same names.");
+ appDesc << "";
+ appDesc << " " + librecad + QObject::tr( " -o some.pdf *.dxf");
+ appDesc << " " + QObject::tr( "-- print all dxf files to 'some.pdf' file.");
+ parser.setApplicationDescription( appDesc.join( "\n"));
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption fitOpt(QStringList() << "a" << "fit",
- "Auto fit and center drawing to page.");
+ QObject::tr( "Auto fit and center drawing to page."));
parser.addOption(fitOpt);
QCommandLineOption centerOpt(QStringList() << "c" << "center",
- "Auto center drawing on page.");
+ QObject::tr( "Auto center drawing on page."));
parser.addOption(centerOpt);
QCommandLineOption grayOpt(QStringList() << "k" << "grayscale",
- "Print grayscale.");
+ QObject::tr( "Print grayscale."));
parser.addOption(grayOpt);
QCommandLineOption monoOpt(QStringList() << "m" << "monochrome",
- "Print monochrome (black/white).");
+ QObject::tr( "Print monochrome (black/white)."));
parser.addOption(monoOpt);
QCommandLineOption pageSizeOpt(QStringList() << "p" << "paper",
- "Paper size (Width x Height) in mm.", "WxH");
+ QObject::tr( "Paper size (Width x Height) in mm.", "WxH"));
parser.addOption(pageSizeOpt);
QCommandLineOption resOpt(QStringList() << "r" << "resolution",
- "Output resolution (DPI).", "integer");
+ QObject::tr( "Output resolution (DPI).", "integer"));
parser.addOption(resOpt);
QCommandLineOption scaleOpt(QStringList() << "s" << "scale",
- "Output scale. E.g.: 0.01 (for 1:100 scale).", "double");
+ QObject::tr( "Output scale. E.g.: 0.01 (for 1:100 scale)."), "double");
parser.addOption(scaleOpt);
QCommandLineOption marginsOpt(QStringList() << "f" << "margins",
- "Paper margins in mm (integer or float).", "L,T,R,B");
+ QObject::tr( "Paper margins in mm (integer or float)."), "L,T,R,B");
parser.addOption(marginsOpt);
QCommandLineOption pagesNumOpt(QStringList() << "z" << "pages",
- "Print on multiple pages (Horiz. x Vert.).", "HxV");
+ QObject::tr( "Print on multiple pages (Horiz. x Vert.)."), "HxV");
parser.addOption(pagesNumOpt);
QCommandLineOption outFileOpt(QStringList() << "o" << "outfile",
- "Output PDF file.", "file");
+ QObject::tr( "Output PDF file.", "file"));
parser.addOption(outFileOpt);
QCommandLineOption outDirOpt(QStringList() << "t" << "directory",
- "Target output directory.", "path");
+ QObject::tr( "Target output directory."), "path");
parser.addOption(outDirOpt);
- parser.addPositionalArgument("<dxf_files>", "Input DXF file(s)");
+ parser.addPositionalArgument(QObject::tr( "<dxf_files>"), QObject::tr( "Input DXF file(s)"));
parser.process(app);
--- a/librecad/src/main/main.cpp
+++ b/librecad/src/main/main.cpp
@@ -55,16 +55,13 @@ int main(int argc, char** argv)
{
QT_REQUIRE_VERSION(argc, argv, "5.2.1");
- // Check first two arguments in order to decide if we want to run librecad
- // as console dxf2pdf tool. On Linux we can create a link to librecad
- // executable and name it dxf2pdf. So, we can run either:
- //
- // librecad dxf2pdf [options] ...
- //
- // or just:
- //
- // dxf2pdf [options] ...
- //
+ /* Check first two arguments in order to decide if we want to run librecad
+ * as console dxf2pdf tool. On Linux we can create a link to librecad
+ * executable and name it dxf2pdf. So, we can run either:
+ * librecad dxf2pdf [options] ...
+ * or just:
+ * dxf2pdf [options] ...
+ */
for (int i = 0; i < qMin(argc, 2); i++) {
QString arg(argv[i]);
if (i == 0) {
@@ -206,10 +203,8 @@ int main(int argc, char** argv)
}
RS_DEBUG->print("param 0: %s", argv[0]);
- QFileInfo prgInfo( QFile::decodeName(argv[0]) );
- QString prgDir(prgInfo.absolutePath());
RS_SETTINGS->init(app.organizationName(), app.applicationName());
- RS_SYSTEM->init(app.applicationName(), app.applicationVersion(), XSTR(QC_APPDIR), prgDir);
+ RS_SYSTEM->init(app.applicationName(), app.applicationVersion(), XSTR(QC_APPDIR));
// parse command line arguments that might not need a launched program:
QStringList fileList = handleArgs(argc, argv, argClean);

View File

@@ -1,32 +0,0 @@
From: Jiri Slaby <jslaby@suse.cz>
Date: Sat, 1 Jan 2022 17:36:05 +0100
Subject: Revert "RS_System::getDirectoryList() - add plugins folder for
AppImage"
Patch-mainline: waiting for fix
References: paths fix
This reverts commit 7484ec976afbcb8624243e5dae338fbf0df1d9a2.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
librecad/src/lib/engine/rs_system.cpp | 4 ----
1 file changed, 4 deletions(-)
diff --git a/librecad/src/lib/engine/rs_system.cpp b/librecad/src/lib/engine/rs_system.cpp
index 9103eff3302c..b0a346303038 100644
--- a/librecad/src/lib/engine/rs_system.cpp
+++ b/librecad/src/lib/engine/rs_system.cpp
@@ -579,10 +579,6 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) {
// Redhat style:
dirList.append( QDir::cleanPath( binDir + "/../share/" + appDirName + "/" + subDirectory));
-
- if (QStringLiteral( "plugins") == subDirectory) {
- dirList.append( QDir::cleanPath( binDir + "/../lib/" + appDirName));
- }
#endif
#ifdef Q_OS_MAC
--
2.34.1

View File

@@ -1,81 +0,0 @@
From: Jiri Slaby <jslaby@suse.cz>
Date: Sat, 1 Jan 2022 17:36:28 +0100
Subject: Revert "fix: RS_System::getDirectoryList() - use relative paths for
AppImage"
Patch-mainline: waiting for fix
References: paths fix
This reverts commit e666fb172e3497dd00435ff435cc6d5177f3b8ee.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
librecad/src/lib/engine/rs_system.cpp | 20 ++++++++------------
librecad/src/lib/engine/rs_system.h | 1 -
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/librecad/src/lib/engine/rs_system.cpp b/librecad/src/lib/engine/rs_system.cpp
index b0a346303038..7437e0d44e2c 100644
--- a/librecad/src/lib/engine/rs_system.cpp
+++ b/librecad/src/lib/engine/rs_system.cpp
@@ -60,7 +60,6 @@ void RS_System::init(const QString& appName, const QString& appVersion,
else {
this->appDir = appDir;
}
- binDir = QCoreApplication::applicationDirPath();
RS_DEBUG->print("RS_System::init: System %s initialized.", appName.toLatin1().data());
RS_DEBUG->print("RS_System::init: App dir: %s", appDir.toLatin1().data());
@@ -544,7 +543,7 @@ QStringList RS_System::getFileList(const QString& subDirectory,
/**
* @return List of all directories in subdirectory 'subDirectory' in
- * all possible LibreCAD directories.
+ * all possible QCad directories.
*/
QStringList RS_System::getDirectoryList(const QString& _subDirectory) {
QStringList dirList;
@@ -569,22 +568,19 @@ QStringList RS_System::getDirectoryList(const QString& _subDirectory) {
}
}
-#ifdef Q_OS_UNIX
- RS_DEBUG->print( RS_Debug::D_ERROR, "RS_System::getDirectoryList: %s", binDir.toStdString().c_str());
- // for AppImage use relative paths from executable
- // from packet manager the executable is in /usr/bin
- // in AppImage the executable is APPDIR/usr/bin
- // so this should work for paket manager and AppImage distribution
- dirList.append( QDir::cleanPath( binDir + "/../share/doc/" + appDirName + "/" + subDirectory));
+ // Ubuntu
+ dirList.append( "/usr/share/doc/" + appDirName + "/" + subDirectory);
// Redhat style:
- dirList.append( QDir::cleanPath( binDir + "/../share/" + appDirName + "/" + subDirectory));
-#endif
+ dirList.append( "/usr/share/" + appDirName + "/" + subDirectory);
+
+ // Others, RVT April 25, 2011 removed, doesn anybody use that still?
+ // dirList.append("/usr/X11R6/share/" + appDirName + "/" + subDirectory);
#ifdef Q_OS_MAC
// Apple uses the resource directory
if (!appDir.isEmpty() && appDir!="/") {
- dirList.append( QDir::cleanPath( appDir + "/../Resources/" + subDirectory));
+ dirList.append( appDir + "/../Resources/" + subDirectory);
}
#endif
diff --git a/librecad/src/lib/engine/rs_system.h b/librecad/src/lib/engine/rs_system.h
index 745ffdbde646..cceb46280fc6 100644
--- a/librecad/src/lib/engine/rs_system.h
+++ b/librecad/src/lib/engine/rs_system.h
@@ -197,7 +197,6 @@ protected:
QString appVersion;
QString appDirName;
QString appDir;
- QString binDir;
QStringList languageList; //< List of available translations
bool initialized;
--
2.34.1

View File

@@ -1,3 +1,13 @@
-------------------------------------------------------------------
Thu Jan 6 11:44:32 UTC 2022 - Jiri Slaby <jslaby@suse.cz>
- replace the revert by an upstream fix
* add 0001-fixed-1488-getDirectoryList-failed-on-Linux-when-lib.patch
* remove
0001-Revert-AppImage-build-on-GitHub-Actions-with-go-appi.patch
0002-Revert-RS_System-getDirectoryList-add-plugins-folder.patch
0003-Revert-fix-RS_System-getDirectoryList-use-relative-p.patch
-------------------------------------------------------------------
Sat Jan 1 16:38:27 UTC 2022 - Jiri Slaby <jslaby@suse.cz>

View File

@@ -35,9 +35,7 @@ Source3: http://wiki.librecad.org/images/7/70/Electronics3-LCAD.zip
Source4: http://wiki.librecad.org/images/9/9d/Electrical1-LCAD.zip
Source10: ttf2lff.1
Source20: %name-rpmlintrc
Patch0: 0001-Revert-AppImage-build-on-GitHub-Actions-with-go-appi.patch
Patch1: 0002-Revert-RS_System-getDirectoryList-add-plugins-folder.patch
Patch2: 0003-Revert-fix-RS_System-getDirectoryList-use-relative-p.patch
Patch0: 0001-fixed-1488-getDirectoryList-failed-on-Linux-when-lib.patch
Patch4: librecad-no-date.diff
Patch5: librecad-use-system-libdxfrw.patch
Patch6: librecad-install.diff