Compare commits

...

No commits in common. "c8" and "imports/c9-beta/scap-workbench-1.2.1-13.el9" have entirely different histories.

13 changed files with 398 additions and 1007 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/scap-workbench-1.2.0.tar.bz2
SOURCES/scap-workbench-1.2.1.tar.bz2

View File

@ -1 +1 @@
50904817a4b01772bff7bc58a972d1f8f65b9026 SOURCES/scap-workbench-1.2.0.tar.bz2
59180c64eedef2c3047f7b420b9cfb8ed60a6dca SOURCES/scap-workbench-1.2.1.tar.bz2

View File

@ -1,41 +0,0 @@
From d4a0508caf6f319b3c19ee370a24c4716eb77bcf Mon Sep 17 00:00:00 2001
From: Martin Preisler <martin@preisler.me>
Date: Thu, 9 Aug 2018 12:38:10 -0400
Subject: [PATCH] Support oscap version suffix when scanning remote
Previously we only supported versions such as 1.2.3, now we also support
1.2.3_alpha4.
---
src/OscapCapabilities.cpp | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/OscapCapabilities.cpp b/src/OscapCapabilities.cpp
index 03099fbf..c85804f5 100644
--- a/src/OscapCapabilities.cpp
+++ b/src/OscapCapabilities.cpp
@@ -50,8 +50,10 @@ void OscapCapabilities::clear()
static bool versionGreaterOrEqual(const QString& a, const QString& b)
{
- const QStringList aSplit = a.split('.');
- const QStringList bSplit = b.split('.');
+ // the first split chops off any suffix such as _alpha2
+ // we have a guarantee that _ will occur at most once in the string
+ const QStringList aSplit = a.split("_")[0].split('.');
+ const QStringList bSplit = b.split("_")[0].split('.');
// we only compare versions of the same number of components!
assert(aSplit.size() == bSplit.size());
@@ -89,7 +91,11 @@ void OscapCapabilities::parse(const QString& mmv)
const QStringList firstLine = lines[0].split(' ', QString::SkipEmptyParts);
const QString& versionCandidate = firstLine.last();
- if (!versionCandidate.contains(QRegExp("^([0-9]+\\.){2,}[0-9]+$")))
+ // Examples:
+ // 1.3.0_alpha2
+ // 0.8.0
+ // 1.2.18
+ if (!versionCandidate.contains(QRegExp("^([0-9]+\\.){2,}[0-9]+(_[a-z0-9]+)?$")))
return; // TODO: Throw exception?
mVersion = versionCandidate;

View File

@ -1,51 +0,0 @@
From 9a85a7dd795112a53a04e5552a350ca2e1effbb0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
Date: Wed, 24 Oct 2018 15:04:18 +0200
Subject: [PATCH] Fix SCAP Workbench errors shown in Diagnostics Windows
This patch addresses the follwong part of messages chunk. Even if it
says that "oscap" process has written the content, it's the wrapper
script in fact.
```
14:34:53 | error | The 'oscap' process has written the following
content to stderr:
chown: cannot access '/tmp/SCAP': No such file or directory
14:34:53 | error | The 'oscap' process has written the following
content to stderr:
chown: cannot access 'Workbench.h22666': No such file or directory
14:34:53 | error | The 'oscap' process has written the following
content to stderr:
chown: cannot access '/tmp/SCAP': No such file or directory
14:34:53 | error | The 'oscap' process has written the following
content to stderr:
chown: cannot access 'Workbench.M22666': No such file or directory
14:34:53 | error | The 'oscap' process has written the following
content to stderr:
chown: cannot access '/tmp/SCAP': No such file or directory
14:34:53 | error | The 'oscap' process has written the following
content to stderr:
chown: cannot access 'Workbench.X22666': No such file or directory
```
---
scap-workbench-oscap.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scap-workbench-oscap.sh b/scap-workbench-oscap.sh
index 216376f2..90664446 100755
--- a/scap-workbench-oscap.sh
+++ b/scap-workbench-oscap.sh
@@ -93,7 +93,7 @@ function chown_copy
# chown only required if wrapper_{uid,gid} differs from real_{uid,gid}
if [ $wrapper_uid -ne $real_uid ] || [ $wrapper_gid -ne $real_gid ]; then
- chown $wrapper_uid:$wrapper_gid $where
+ chown $wrapper_uid:$wrapper_gid "$where"
fi
}

View File

@ -1,773 +0,0 @@
From 8a7aade15b48402403604f17d6cf7690d1a7c752 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
Date: Fri, 13 Dec 2019 13:52:52 +0100
Subject: [PATCH 1/2] Remove space from temporary file names
We use QTemporaryFile to create temporary files. According to
https://doc.qt.io/qt-5/qtemporaryfile.html, the default filename
is determined from QCoreApplication::applicationName(). It returns
"SCAP Workbench" which leads to creating temporary files with a space
character in their name, eg. "/tmp/SCAP Workbench.XM8663". The space
can cause problems with missing quotes s.a. the problems described in
https://github.com/OpenSCAP/scap-workbench/issues/196.
To avoid these problems, it's probably better to create the temporary
files without the space.
We will create 2 temporary classes: SpacelessQTemporaryFile and
SpacelessQTemporaryDir which are derived from QTemporaryFile and
QTemporaryDir and call the constructor with a filename template.
The QTemporaryDir replaces usage of our custom TemporaryDir class.
We don't need this class anymore because since version 1.2.0 we
require Qt version 5 where QTemporaryDir is present.
---
include/Exceptions.h | 3 -
include/ForwardDecls.h | 1 -
include/OscapScannerLocal.h | 5 +-
include/RPMOpenHelper.h | 4 +-
include/RemediationRoleSaver.h | 4 +-
include/RemoteSsh.h | 4 +-
include/ResultViewer.h | 4 +-
include/ScanningSession.h | 9 +-
include/TemporaryDir.h | 74 ----------------
include/Utils.h | 12 +++
src/OscapScannerBase.cpp | 1 -
src/OscapScannerLocal.cpp | 17 ++--
src/OscapScannerRemoteSsh.cpp | 5 +-
src/RPMOpenHelper.cpp | 4 +-
src/RemediationRoleSaver.cpp | 6 +-
src/RemoteSsh.cpp | 4 +-
src/ResultViewer.cpp | 2 +-
src/SaveAsRPMDialog.cpp | 5 +-
src/ScanningSession.cpp | 4 +-
src/TemporaryDir.cpp | 149 ---------------------------------
src/Utils.cpp | 6 ++
src/main.cpp | 3 -
22 files changed, 53 insertions(+), 273 deletions(-)
delete mode 100644 include/TemporaryDir.h
delete mode 100644 src/TemporaryDir.cpp
diff --git a/include/Exceptions.h b/include/Exceptions.h
index 84bee42d..1b876895 100644
--- a/include/Exceptions.h
+++ b/include/Exceptions.h
@@ -57,9 +57,6 @@ SCAP_WORKBENCH_SIMPLE_EXCEPTION(SshConnectionException,
SCAP_WORKBENCH_SIMPLE_EXCEPTION(TailoringWindowException,
"There was a problem with TailoringWindow!\n");
-SCAP_WORKBENCH_SIMPLE_EXCEPTION(TemporaryDirException,
- "There was a problem with TemporaryDir!\n");
-
SCAP_WORKBENCH_SIMPLE_EXCEPTION(OscapScannerRemoteSshException,
"There was a problem with OscapScannerRemoteSsh!\n");
diff --git a/include/ForwardDecls.h b/include/ForwardDecls.h
index b9735476..3059a1c3 100644
--- a/include/ForwardDecls.h
+++ b/include/ForwardDecls.h
@@ -50,7 +50,6 @@ class SyncProcess;
class SSGIntegrationDialog;
class TailoringWindow;
class TailorProfileDialog;
-class TemporaryDir;
class XCCDFItemPropertiesDockWidget;
class XCCDFItemSelectUndoCommand;
class XCCDFValueChangeUndoCommand;
diff --git a/include/OscapScannerLocal.h b/include/OscapScannerLocal.h
index 4370744b..00b5ab39 100644
--- a/include/OscapScannerLocal.h
+++ b/include/OscapScannerLocal.h
@@ -22,10 +22,9 @@
#ifndef SCAP_WORKBENCH_OSCAP_SCANNER_LOCAL_H_
#define SCAP_WORKBENCH_OSCAP_SCANNER_LOCAL_H_
-#include <QTemporaryFile>
-
#include "ForwardDecls.h"
#include "OscapScannerBase.h"
+#include "Utils.h"
class OscapScannerLocal : public OscapScannerBase
@@ -54,7 +53,7 @@ class OscapScannerLocal : public OscapScannerBase
void evaluateWithOfflineRemediation();
void evaluateWithOtherSettings();
- static void setFilenameToTempFile(QTemporaryFile& file);
+ static void setFilenameToTempFile(SpacelessQTemporaryFile& file);
};
#endif
diff --git a/include/RPMOpenHelper.h b/include/RPMOpenHelper.h
index 18d1bad1..b6bd606c 100644
--- a/include/RPMOpenHelper.h
+++ b/include/RPMOpenHelper.h
@@ -23,7 +23,7 @@
#define SCAP_WORKBENCH_RPM_OPEN_HELPER_H_
#include "ForwardDecls.h"
-#include "TemporaryDir.h"
+#include "Utils.h"
#include <QWidget>
/**
@@ -66,7 +66,7 @@ class RPMOpenHelper
private:
static QString getRPMExtractPath();
- TemporaryDir mTempDir;
+ SpacelessQTemporaryDir mTempDir;
QString mInputPath;
QString mTailoringPath;
diff --git a/include/RemediationRoleSaver.h b/include/RemediationRoleSaver.h
index c668739e..1681b901 100644
--- a/include/RemediationRoleSaver.h
+++ b/include/RemediationRoleSaver.h
@@ -103,7 +103,7 @@ class ResultBasedProcessRemediationSaver : public RemediationSaverBase
private:
virtual void saveToFile(const QString& filename);
- QTemporaryFile mArfFile;
+ SpacelessQTemporaryFile mArfFile;
};
@@ -138,7 +138,7 @@ class ResultBasedLibraryRemediationSaver : public RemediationSaverBase
private:
virtual void saveToFile(const QString& filename);
- QTemporaryFile mArfFile;
+ SpacelessQTemporaryFile mArfFile;
};
diff --git a/include/RemoteSsh.h b/include/RemoteSsh.h
index 7971a0e7..8ae8ba7b 100644
--- a/include/RemoteSsh.h
+++ b/include/RemoteSsh.h
@@ -24,7 +24,7 @@
#include "ForwardDecls.h"
#include "ProcessHelpers.h"
-#include "TemporaryDir.h"
+#include "Utils.h"
#include <QObject>
class SshConnection : public QObject
@@ -57,7 +57,7 @@ class SshConnection : public QObject
QString mTarget;
unsigned short mPort;
- TemporaryDir* mSocketDir;
+ SpacelessQTemporaryDir* mSocketDir;
QString mMasterSocket;
QProcessEnvironment mEnvironment;
diff --git a/include/ResultViewer.h b/include/ResultViewer.h
index 978a23a4..a6da89da 100644
--- a/include/ResultViewer.h
+++ b/include/ResultViewer.h
@@ -23,9 +23,9 @@
#define SCAP_WORKBENCH_RESULT_VIEWER_H_
#include "ForwardDecls.h"
+#include "Utils.h"
#include <QWidget>
-#include <QTemporaryFile>
#include <QUrl>
#include <QMenu>
#include <QLabel>
@@ -97,7 +97,7 @@ class ResultViewer : public QWidget
QByteArray mResults;
QByteArray mReport;
/// If user requests to open the file via desktop services
- QTemporaryFile* mReportFile;
+ SpacelessQTemporaryFile* mReportFile;
QByteArray mARF;
};
diff --git a/include/ScanningSession.h b/include/ScanningSession.h
index c1d2b490..25ccc604 100644
--- a/include/ScanningSession.h
+++ b/include/ScanningSession.h
@@ -23,9 +23,8 @@
#define SCAP_WORKBENCH_SCANNING_SESSION_H_
#include "ForwardDecls.h"
+#include "Utils.h"
-#include <QTemporaryDir>
-#include <QTemporaryFile>
#include <QSet>
#include <QDir>
#include <map>
@@ -292,7 +291,7 @@ class ScanningSession
mutable struct xccdf_tailoring* mTailoring;
/// Temporary copy of opened DS or XCCDF file
- QTemporaryDir* mTempOpenDir;
+ SpacelessQTemporaryDir* mTempOpenDir;
/// Path to temporary DS or XCCDF file
QString mTempOpenPath;
/// Path to original DS or XCCDF file
@@ -301,9 +300,9 @@ class ScanningSession
QSet<QString> mClosureOfOriginalFile;
/// Temporary file provides auto deletion and a valid temp file path
- QTemporaryFile mTailoringFile;
+ SpacelessQTemporaryFile mTailoringFile;
/// Temporary file provides auto deletion and a valid temp file path
- QTemporaryFile mGuideFile;
+ SpacelessQTemporaryFile mGuideFile;
/// Whether or not validation should be skipped
bool mSkipValid;
diff --git a/include/TemporaryDir.h b/include/TemporaryDir.h
deleted file mode 100644
index fadabeca..00000000
--- a/include/TemporaryDir.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2013 Red Hat Inc., Durham, North Carolina.
- * All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors:
- * Martin Preisler <mpreisle@redhat.com>
- */
-
-#ifndef SCAP_WORKBENCH_TEMPORARY_DIR_H_
-#define SCAP_WORKBENCH_TEMPORARY_DIR_H_
-
-#include "ForwardDecls.h"
-#include <QString>
-
-/**
- * @brief Creates a (LOCAL!) temporary directory and auto destroys it if told so
- *
- * This structure is lazy, it only creates the temp directory when asked about
- * its path. Before you query the path the directory won't be created.
- *
- * @note Default setting is to auto-remove the directory on destruction.
- * @internal We should replace this with QTemporaryDir when scap-workbench moves to Qt5
- */
-class TemporaryDir
-{
- public:
- TemporaryDir();
- ~TemporaryDir();
-
- /**
- * @brief Changes the auto-remove settings
- *
- * If autoRemove is true the structure will recursively remove the entire
- * temporary directory (that is the default setting). Else it will just
- * create it and it's up to the user to destroy it.
- */
- void setAutoRemove(const bool autoRemove);
-
- /// @see TemporaryDir::setAutoRemove
- bool getAutoRemove() const;
-
- /**
- * @brief Returns absolute path of created temporary directory
- *
- * @exception TemporaryDirException Failed to create temporary directory (nonzero exit code from mktemp -d)
- */
- const QString& getPath() const;
-
- private:
- /**
- * Ensures that temporary directory has been created and the stored path is valid.
- */
- void ensurePath() const;
-
- /// Holds absolute path of the created temporary directory
- mutable QString mPath;
- /// @see TemporaryDir::setAutoRemove
- bool mAutoRemove;
-};
-
-#endif
diff --git a/include/Utils.h b/include/Utils.h
index c3b6f013..fb9c1507 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -28,6 +28,8 @@
#include <QDir>
#include <QIcon>
#include <QUrl>
+#include <QTemporaryFile>
+#include <QTemporaryDir>
/**
* @brief Retrieves QDir representing the share directory
@@ -115,4 +117,14 @@ void openUrlGuarded(const QUrl& url);
*/
const QString& getSetSidPath();
+class SpacelessQTemporaryFile: public QTemporaryFile {
+ public:
+ SpacelessQTemporaryFile ();
+};
+
+class SpacelessQTemporaryDir: public QTemporaryDir {
+ public:
+ SpacelessQTemporaryDir ();
+};
+
#endif
diff --git a/src/OscapScannerBase.cpp b/src/OscapScannerBase.cpp
index 3d4075cf..daf08b9c 100644
--- a/src/OscapScannerBase.cpp
+++ b/src/OscapScannerBase.cpp
@@ -24,7 +24,6 @@
#include <QThread>
#include <QAbstractEventDispatcher>
-#include <QTemporaryFile>
#include <cassert>
extern "C"
diff --git a/src/OscapScannerLocal.cpp b/src/OscapScannerLocal.cpp
index 48687f25..dd9891fa 100644
--- a/src/OscapScannerLocal.cpp
+++ b/src/OscapScannerLocal.cpp
@@ -22,7 +22,6 @@
#include "OscapScannerLocal.h"
#include "ProcessHelpers.h"
#include "ScanningSession.h"
-#include "TemporaryDir.h"
#include <stdexcept>
#include <QThread>
@@ -33,7 +32,7 @@ extern "C"
#include <xccdf_session.h>
}
-void OscapScannerLocal::setFilenameToTempFile(QTemporaryFile& file)
+void OscapScannerLocal::setFilenameToTempFile(SpacelessQTemporaryFile& file)
{
file.open();
file.close();
@@ -97,21 +96,21 @@ void OscapScannerLocal::evaluate()
// This is mainly for check-engine-results and oval-results, to ensure
// we get a full report, including info from these files. openscap's XSLT
// uses info in the check engine results if it can find them.
- TemporaryDir workingDir;
- process.setWorkingDirectory(workingDir.getPath());
+ SpacelessQTemporaryDir workingDir;
+ process.setWorkingDirectory(workingDir.path());
QStringList args;
- QTemporaryFile inputARFFile;
+ SpacelessQTemporaryFile inputARFFile;
- QTemporaryFile arfFile;
+ SpacelessQTemporaryFile arfFile;
arfFile.setAutoRemove(true);
setFilenameToTempFile(arfFile);
- QTemporaryFile reportFile;
+ SpacelessQTemporaryFile reportFile;
reportFile.setAutoRemove(true);
setFilenameToTempFile(reportFile);
- QTemporaryFile resultFile;
+ SpacelessQTemporaryFile resultFile;
resultFile.setAutoRemove(true);
setFilenameToTempFile(resultFile);
@@ -223,7 +222,7 @@ QStringList OscapScannerLocal::getCommandLineArgs() const
if (mScannerMode == SM_OFFLINE_REMEDIATION)
{
- QTemporaryFile inputARFFile;
+ SpacelessQTemporaryFile inputARFFile;
inputARFFile.setAutoRemove(true);
inputARFFile.open();
inputARFFile.write(getARFForRemediation());
diff --git a/src/OscapScannerRemoteSsh.cpp b/src/OscapScannerRemoteSsh.cpp
index 44611a77..dcfd6d5f 100644
--- a/src/OscapScannerRemoteSsh.cpp
+++ b/src/OscapScannerRemoteSsh.cpp
@@ -25,7 +25,6 @@
#include <QThread>
#include <QAbstractEventDispatcher>
-#include <QTemporaryFile>
#include <QFileInfo>
#include <QDir>
#include <cassert>
@@ -105,7 +104,7 @@ QStringList OscapScannerRemoteSsh::getCommandLineArgs() const
if (mScannerMode == SM_OFFLINE_REMEDIATION)
{
- QTemporaryFile inputARFFile;
+ SpacelessQTemporaryFile inputARFFile;
inputARFFile.setAutoRemove(true);
inputARFFile.open();
inputARFFile.write(getARFForRemediation());
@@ -381,7 +380,7 @@ QString OscapScannerRemoteSsh::copyInputFileOver()
QString localPath = "";
- QTemporaryFile inputARFFile;
+ SpacelessQTemporaryFile inputARFFile;
inputARFFile.setAutoRemove(true);
if (mScannerMode == SM_OFFLINE_REMEDIATION)
{
diff --git a/src/RPMOpenHelper.cpp b/src/RPMOpenHelper.cpp
index 565eaa16..b12f109d 100644
--- a/src/RPMOpenHelper.cpp
+++ b/src/RPMOpenHelper.cpp
@@ -33,12 +33,12 @@ RPMOpenHelper::RPMOpenHelper(const QString& path)
const QFileInfo pathInfo(path);
proc.setCommand(getRPMExtractPath());
proc.setArguments(QStringList(pathInfo.absoluteFilePath()));
- proc.setWorkingDirectory(mTempDir.getPath());
+ proc.setWorkingDirectory(mTempDir.path());
}
proc.run();
- const QDir tempDir(mTempDir.getPath());
+ const QDir tempDir(mTempDir.path());
if (proc.getExitCode() != 0)
{
diff --git a/src/RemediationRoleSaver.cpp b/src/RemediationRoleSaver.cpp
index 247475e0..900a221d 100644
--- a/src/RemediationRoleSaver.cpp
+++ b/src/RemediationRoleSaver.cpp
@@ -27,6 +27,7 @@
#include "RemediationRoleSaver.h"
#include "DiagnosticsDialog.h"
+#include "Utils.h"
extern "C"
{
@@ -41,7 +42,6 @@ extern "C"
#endif
}
-#include "TemporaryDir.h"
const QString bashSaveMessage = QObject::tr("Save remediation role as a bash script");
@@ -197,8 +197,8 @@ void ResultBasedProcessRemediationSaver::saveToFile(const QString& filename)
// This is a lightweight launch though.
QProcess process(mParentWindow);
- TemporaryDir workingDir;
- process.setWorkingDirectory(workingDir.getPath());
+ SpacelessQTemporaryDir workingDir;
+ process.setWorkingDirectory(workingDir.path());
QString program(SCAP_WORKBENCH_LOCAL_OSCAP_PATH);
process.start(program, args);
diff --git a/src/RemoteSsh.cpp b/src/RemoteSsh.cpp
index 36c359ff..9f737b8a 100644
--- a/src/RemoteSsh.cpp
+++ b/src/RemoteSsh.cpp
@@ -109,8 +109,8 @@ void SshConnection::connect()
mSocketDir = 0;
}
- mSocketDir = new TemporaryDir();
- mMasterSocket = mSocketDir->getPath() + "/ssh_socket";
+ mSocketDir = new SpacelessQTemporaryDir();
+ mMasterSocket = mSocketDir->path() + "/ssh_socket";
}
catch (const SyncProcessException& e)
{
diff --git a/src/ResultViewer.cpp b/src/ResultViewer.cpp
index c65be2d2..1e730e99 100644
--- a/src/ResultViewer.cpp
+++ b/src/ResultViewer.cpp
@@ -158,7 +158,7 @@ void ResultViewer::openReport()
mReportFile = 0;
}
- mReportFile = new QTemporaryFile();
+ mReportFile = new SpacelessQTemporaryFile();
mReportFile->setFileTemplate(mReportFile->fileTemplate() + ".html");
mReportFile->open();
mReportFile->write(mReport);
diff --git a/src/SaveAsRPMDialog.cpp b/src/SaveAsRPMDialog.cpp
index 6c537444..611d15fd 100644
--- a/src/SaveAsRPMDialog.cpp
+++ b/src/SaveAsRPMDialog.cpp
@@ -21,7 +21,6 @@
#include "SaveAsRPMDialog.h"
#include "MainWindow.h"
-#include "TemporaryDir.h"
#include "ScanningSession.h"
#include "ProcessHelpers.h"
@@ -128,7 +127,7 @@ void SaveAsRPMDialog::slotFinished(int result)
args.append(cwd.relativeFilePath(*it));
}
- TemporaryDir tailoringDir;
+ SpacelessQTemporaryDir tailoringDir;
// Tailoring file is a special case since it may be in memory only.
// In case it is memory only we don't want it to cause our common ancestor dir to be /
@@ -138,7 +137,7 @@ void SaveAsRPMDialog::slotFinished(int result)
QFileInfo tailoringFile(mScanningSession->getTailoringFilePath());
assert(tailoringFile.exists());
- const QString tailoringFilePath = QString("%1/%2").arg(tailoringDir.getPath(), "tailoring-xccdf.xml");
+ const QString tailoringFilePath = QString("%1/%2").arg(tailoringDir.path(), "tailoring-xccdf.xml");
ScanningSession::copyOrReplace(tailoringFile.absoluteFilePath(),
tailoringFilePath);
diff --git a/src/ScanningSession.cpp b/src/ScanningSession.cpp
index a486761d..20ce501f 100644
--- a/src/ScanningSession.cpp
+++ b/src/ScanningSession.cpp
@@ -34,8 +34,6 @@ extern "C" {
#include <cassert>
#include <ctime>
-#include <QTemporaryDir>
-#include <QTemporaryFile>
#include <QFileInfo>
#include <QBuffer>
#include <QXmlQuery>
@@ -161,7 +159,7 @@ void ScanningSession::cloneToTemporaryFile(const QString& path)
// Clean the temporary directory if it is open already, then create
// a new one.
cleanTmpDir();
- mTempOpenDir = new QTemporaryDir();
+ mTempOpenDir = new SpacelessQTemporaryDir();
// Recalling is unlikely to succeed, so throw a fatal exception
if (!mTempOpenDir->isValid())
diff --git a/src/TemporaryDir.cpp b/src/TemporaryDir.cpp
deleted file mode 100644
index 0fed2556..00000000
--- a/src/TemporaryDir.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright 2013 Red Hat Inc., Durham, North Carolina.
- * All Rights Reserved.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors:
- * Martin Preisler <mpreisle@redhat.com>
- */
-
-#include "TemporaryDir.h"
-#include "ProcessHelpers.h"
-#include "Exceptions.h"
-
-#include <QDir>
-#include <iostream>
-
-static bool recursiveRemoveDir(const QString& dirName)
-{
- // Adapted code from:
- // http://john.nachtimwald.com/2010/06/08/qt-remove-directory-and-its-contents/
-
- bool result = true;
- QDir dir(dirName);
-
- if (dir.exists(dirName))
- {
- for (QFileInfo info : dir.entryInfoList(QDir::NoDotAndDotDot | QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files, QDir::DirsFirst))
- {
- if (info.isDir())
- result = recursiveRemoveDir(info.absoluteFilePath());
- else
- result = QFile::remove(info.absoluteFilePath());
-
- if (!result)
- return result;
- }
- result = dir.rmdir(dirName);
- }
-
- return result;
-}
-
-TemporaryDir::TemporaryDir():
- mAutoRemove(true)
-{}
-
-TemporaryDir::~TemporaryDir()
-{
- if (!mPath.isEmpty() && mAutoRemove)
- {
- if (!recursiveRemoveDir(mPath))
- {
- // We don't throw on destruction! The worst thing that can happen
- // is leftover files which is not a big deal anyway.
-
- std::cerr << "Failed to remove temporary directory '" << mPath.toUtf8().constData() << "'." << std::endl;
- }
- }
-}
-
-void TemporaryDir::setAutoRemove(const bool autoRemove)
-{
- mAutoRemove = autoRemove;
-}
-
-bool TemporaryDir::getAutoRemove() const
-{
- return mAutoRemove;
-}
-
-const QString& TemporaryDir::getPath() const
-{
- ensurePath();
- return mPath;
-}
-
-// nextRand adapted from from QTemporaryDir from Qt5, licensed under LGPL2.1+
-
-// Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-// Contact: http://www.qt-project.org/legal
-//
-// GNU Lesser General Public License Usage
-// Alternatively, this file may be used under the terms of the GNU Lesser
-// General Public License version 2.1 or version 3 as published by the Free
-// Software Foundation and appearing in the file LICENSE.LGPLv21 and
-// LICENSE.LGPLv3 included in the packaging of this file. Please review the
-// following information to ensure the GNU Lesser General Public License
-// requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-// http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-//
-// In addition, as a special exception, Digia gives you certain additional
-// rights. These rights are described in the Digia Qt LGPL Exception
-// version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-
-static int nextRand(int& v)
-{
- int r = v % 62;
- v /= 62;
- if (v < 62)
- v = qrand();
- return r;
-}
-
-void TemporaryDir::ensurePath() const
-{
- static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-
- if (mPath.isEmpty())
- {
- QString dirName;
- while (true)
- {
- dirName = "";
-
- int v = qrand();
- dirName += letters[nextRand(v)];
- dirName += letters[nextRand(v)];
- dirName += letters[nextRand(v)];
- dirName += letters[nextRand(v)];
- dirName += letters[nextRand(v)];
- dirName += letters[nextRand(v)];
-
- if (QDir::temp().mkdir(dirName))
- break;
- }
-
- const QDir dir(QDir::temp().absoluteFilePath(dirName));
-
- if (!dir.exists())
- throw TemporaryDirException(
- QString("Failed to create temporary directory. mkdir succeeded "
- "but the directory does not exist!")
- );
-
- mPath = dir.absolutePath();
- }
-}
diff --git a/src/Utils.cpp b/src/Utils.cpp
index 802cd503..d3562fac 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -217,3 +217,9 @@ const QString& getSetSidPath()
return ret;
#endif
}
+
+SpacelessQTemporaryFile::SpacelessQTemporaryFile () :
+ QTemporaryFile(QDir::cleanPath(QDir::tempPath() + "/" + "XXXXXX")) {}
+
+SpacelessQTemporaryDir::SpacelessQTemporaryDir () :
+ QTemporaryDir(QDir::cleanPath(QDir::tempPath() + "/" + "XXXXXX")) {}
diff --git a/src/main.cpp b/src/main.cpp
index ebc7b4ba..5f6480a8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -35,9 +35,6 @@ int main(int argc, char** argv)
FreeConsole();
#endif
- // Needed for TemporaryDir
- qsrand(QTime::currentTime().msec());
-
Application app(argc, argv);
return app.exec();
}
From c8b9c4a7e57a01293e4f622f18f139b29ea544d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
Date: Mon, 6 Jan 2020 17:54:04 +0100
Subject: [PATCH 2/2] Add scap-workbench to temporary file name template
This way it will be obvious that the files have been created by
SCAP Workbench.
---
src/Utils.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Utils.cpp b/src/Utils.cpp
index d3562fac..fbeb809c 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -219,7 +219,7 @@ const QString& getSetSidPath()
}
SpacelessQTemporaryFile::SpacelessQTemporaryFile () :
- QTemporaryFile(QDir::cleanPath(QDir::tempPath() + "/" + "XXXXXX")) {}
+ QTemporaryFile(QDir::cleanPath(QDir::tempPath() + "/" + "scap-workbench-XXXXXX")) {}
SpacelessQTemporaryDir::SpacelessQTemporaryDir () :
- QTemporaryDir(QDir::cleanPath(QDir::tempPath() + "/" + "XXXXXX")) {}
+ QTemporaryDir(QDir::cleanPath(QDir::tempPath() + "/" + "scap-workbench-XXXXXX")) {}

View File

@ -1,94 +0,0 @@
From 03391003a5b6f63988b0687625d85c0060b1a932 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
Date: Wed, 25 Jul 2018 18:59:04 +0200
Subject: [PATCH 1/2] Replace SVG logo by PNG logo in Manual
---
doc/user_manual.adoc | 2 +-
doc/user_manual/logo.png | Bin 0 -> 17058 bytes
doc/user_manual/logo.svg | 75 ---------------------------------------
scap-workbench.wxs.in | 6 ++--
4 files changed, 4 insertions(+), 79 deletions(-)
create mode 100644 doc/user_manual/logo.png
delete mode 100644 doc/user_manual/logo.svg
From bd356e0a8dbab798db96b0d009758e8f56e3cf11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
Date: Wed, 25 Jul 2018 19:06:27 +0200
Subject: [PATCH 2/2] Replace asciidoctor by asciidoc
Asciidoc is present in many Linux Distributions.
This makes SCAP Workbench also consistent with OpenSCAP.
---
.travis.yml | 2 +-
CMakeLists.txt | 16 ++++++++--------
README.md | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index f928331c..809bfd19 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,7 +11,7 @@ before_install:
- brew update
- brew install jq
- brew install cartr/qt4/qt@4
- - brew install asciidoctor
+ - brew install asciidoc
before_script:
- git clone --depth 1 https://github.com/openscap/openscap.git -b master
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 993b949f..b4427f1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,15 +89,15 @@ if (SCAP_AS_RPM_EXECUTABLE)
endif()
# This is optional, only required if user wants documentation rebuilt
-find_program(ASCIIDOCTOR_EXECUTABLE NAMES asciidoctor)
-option(SCAP_WORKBENCH_REBUILD_MANUAL "If enabled, user manual will be rebuilt (requires asciidoctor to be installed)" TRUE)
+find_program(ASCIIDOC_EXECUTABLE NAMES asciidoc)
+option(SCAP_WORKBENCH_REBUILD_MANUAL "If enabled, user manual will be rebuilt (requires asciidoc to be installed)" TRUE)
option(SCAP_WORKBENCH_USE_NATIVE_FILE_DIALOGS "If enabled, native desktop environment file dialogs are used (disable if you have crashes at startup)" TRUE)
-if (SCAP_WORKBENCH_REBUILD_MANUAL AND NOT ASCIIDOCTOR_EXECUTABLE)
- message("asciidoctor has not been found, user manual won't be rebuilt even though SCAP_WORKBENCH_REBUILD_MANUAL has been enabled.")
+if (SCAP_WORKBENCH_REBUILD_MANUAL AND NOT ASCIIDOC_EXECUTABLE)
+ message("asciidoc has not been found, user manual won't be rebuilt even though SCAP_WORKBENCH_REBUILD_MANUAL has been enabled.")
endif()
if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doc/user_manual.html")
- if (NOT ASCIIDOCTOR_EXECUTABLE)
- message(FATAL_ERROR "You seem to be using scap-workbench from the repository ('${CMAKE_SOURCE_DIR}/doc/user_manual.html' hasn't been found). Please install asciidoctor to build the manual! You can use `gem install asciidoctor` if asciidoctor is not in your distribution package repository. If you don't have access to asciidoctor and don't mind not having a manual, run `touch ${CMAKE_SOURCE_DIR}/doc/user_manual.html` and rerun cmake.")
+ if (NOT ASCIIDOC_EXECUTABLE)
+ message(FATAL_ERROR "You seem to be using scap-workbench from the repository ('${CMAKE_SOURCE_DIR}/doc/user_manual.html' hasn't been found). Please install asciidoc to build the manual! If you don't have access to asciidoc and don't mind not having a manual, run `touch ${CMAKE_SOURCE_DIR}/doc/user_manual.html` and rerun cmake.")
endif()
set(SCAP_WORKBENCH_REBUILD_MANUAL TRUE)
endif()
@@ -269,12 +269,12 @@ install(FILES "share/pixmaps/scap-workbench.svg"
install(FILES "scap-workbench.appdata.xml"
DESTINATION "${CMAKE_INSTALL_DATADIR}/appdata")
-if (ASCIIDOCTOR_EXECUTABLE)
+if (ASCIIDOC_EXECUTABLE)
file(GLOB USER_MANUAL_SCREENSHOTS "${CMAKE_CURRENT_SOURCE_DIR}/doc/user_manual/*.png")
add_custom_command(
OUTPUT doc/user_manual.html
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/doc
- COMMAND ${ASCIIDOCTOR_EXECUTABLE} --destination-dir ${CMAKE_CURRENT_BINARY_DIR}/doc -b html5 -a data-uri user_manual.adoc
+ COMMAND ${ASCIIDOC_EXECUTABLE} -o ${CMAKE_CURRENT_BINARY_DIR}/doc/user_manual.html -b html5 -a data-uri user_manual.adoc
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/doc/user_manual.html ${CMAKE_CURRENT_SOURCE_DIR}/doc/user_manual.html
DEPENDS doc/user_manual.adoc ${USER_MANUAL_SCREENSHOTS}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc
diff --git a/README.md b/README.md
index 934c8240..8cf7ec93 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ required dependencies:
required dependencies (only for the git repo, not required for released tarballs):
```console
-# yum install rubygem-asciidoctor
+# yum install asciidoc
```
optional dependencies:

View File

@ -0,0 +1,73 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77bb3ae9..5c42e733 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -263,14 +263,14 @@ install(FILES "man/scap-workbench.8"
install(DIRECTORY "share/scap-workbench"
DESTINATION "${CMAKE_INSTALL_DATADIR}")
-install(FILES "scap-workbench.desktop"
+install(FILES "scap_workbench.desktop"
DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")
install(FILES "share/pixmaps/scap-workbench.png"
DESTINATION "${CMAKE_INSTALL_DATADIR}/pixmaps")
install(FILES "share/pixmaps/scap-workbench.svg"
DESTINATION "${CMAKE_INSTALL_DATADIR}/pixmaps")
-install(FILES "scap-workbench.appdata.xml"
- DESTINATION "${CMAKE_INSTALL_DATADIR}/appdata")
+install(FILES "org.open-scap.scap-workbench.appdata.xml"
+ DESTINATION "${CMAKE_INSTALL_DATADIR}/metainfo")
if (ASCIIDOC_EXECUTABLE)
file(GLOB USER_MANUAL_SCREENSHOTS "${CMAKE_CURRENT_SOURCE_DIR}/doc/user_manual/*.png")
diff --git a/scap-workbench.appdata.xml b/org.open-scap.scap-workbench.appdata.xml
similarity index 65%
rename from scap-workbench.appdata.xml
rename to org.open-scap.scap-workbench.appdata.xml
index d4288f3d..bed9b05c 100644
--- a/scap-workbench.appdata.xml
+++ b/org.open-scap.scap-workbench.appdata.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<application>
- <id type="desktop">scap-workbench.desktop</id>
+<component type="desktop">
+ <id>org.openscap.scap_workbench.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>SCAP Workbench</name>
@@ -23,10 +23,16 @@
</ul>
</description>
<screenshots>
- <screenshot type="default" width="1280" height="720">https://github.com/OpenSCAP/scap-workbench/raw/v1-1/doc/user_manual/default_content_opened.png</screenshot>
- <screenshot width="1280" height="720">https://github.com/OpenSCAP/scap-workbench/raw/v1-1/doc/user_manual/intro_screenshot.png</screenshot>
- <screenshot width="1280" height="720">https://github.com/OpenSCAP/scap-workbench/raw/v1-1/doc/user_manual/tailoring_undo_history.png</screenshot>
+ <screenshot type="default">
+ <image type="source" width="1280" height="720">https://github.com/OpenSCAP/scap-workbench/raw/v1-1/doc/user_manual/default_content_opened.png</image>
+ </screenshot>
+ <screenshot>
+ <image type="source" width="1280" height="720">https://github.com/OpenSCAP/scap-workbench/raw/v1-1/doc/user_manual/intro_screenshot.png</image>
+ </screenshot>
+ <screenshot>
+ <image type="source" width="1280" height="720">https://github.com/OpenSCAP/scap-workbench/raw/v1-1/doc/user_manual/tailoring_undo_history.png</image>
+ </screenshot>
</screenshots>
<url type="homepage">https://www.open-scap.org/tools/scap-workbench</url>
- <updatecontact>open-scap-list@redhat.com</updatecontact>
-</application>
+ <update_contact>open-scap-list@redhat.com</update_contact>
+</component>
diff --git a/scap-workbench.desktop b/scap_workbench.desktop
similarity index 95%
rename from scap-workbench.desktop
rename to scap_workbench.desktop
index 60b67e49..5b4bb899 100644
--- a/scap-workbench.desktop
+++ b/scap_workbench.desktop
@@ -7,4 +7,5 @@ TryExec=scap-workbench
Exec=scap-workbench
Icon=scap-workbench
Categories=System;
+Keywords=scap;
X-Desktop-File-Install-Version=0.3

View File

@ -0,0 +1,81 @@
From 408019f129027c120b71db3c029d5291e3275ea2 Mon Sep 17 00:00:00 2001
From: Evgeny Kolesnikov <ekolesni@redhat.com>
Date: Tue, 16 Nov 2021 00:08:32 +0100
Subject: [PATCH] Fix appdata, desktop and icons for Linux (Freedesktop)
Satisfy:
https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html#install_icons
https://freedesktop.org/software/appstream/docs/chap-Quickstart.html
---
CMakeLists.txt | 6 +++---
...ppdata.xml => org.open_scap.scap_workbench.appdata.xml | 5 +++--
...kbench.desktop => org.open_scap.scap_workbench.desktop | 8 ++++----
3 files changed, 10 insertions(+), 9 deletions(-)
rename org.open-scap.scap-workbench.appdata.xml => org.open_scap.scap_workbench.appdata.xml (92%)
rename scap_workbench.desktop => org.open_scap.scap_workbench.desktop (67%)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c42e733..55eed972 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -263,13 +263,13 @@ install(FILES "man/scap-workbench.8"
install(DIRECTORY "share/scap-workbench"
DESTINATION "${CMAKE_INSTALL_DATADIR}")
-install(FILES "scap_workbench.desktop"
+install(FILES "org.open_scap.scap_workbench.desktop"
DESTINATION "${CMAKE_INSTALL_DATADIR}/applications")
install(FILES "share/pixmaps/scap-workbench.png"
DESTINATION "${CMAKE_INSTALL_DATADIR}/pixmaps")
install(FILES "share/pixmaps/scap-workbench.svg"
- DESTINATION "${CMAKE_INSTALL_DATADIR}/pixmaps")
-install(FILES "org.open-scap.scap-workbench.appdata.xml"
+ DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps")
+install(FILES "org.open_scap.scap_workbench.appdata.xml"
DESTINATION "${CMAKE_INSTALL_DATADIR}/metainfo")
if (ASCIIDOC_EXECUTABLE)
diff --git a/org.open-scap.scap-workbench.appdata.xml b/org.open_scap.scap_workbench.appdata.xml
similarity index 92%
rename from org.open-scap.scap-workbench.appdata.xml
rename to org.open_scap.scap_workbench.appdata.xml
index bed9b05c..191796b2 100644
--- a/org.open-scap.scap-workbench.appdata.xml
+++ b/org.open_scap.scap_workbench.appdata.xml
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<component type="desktop">
- <id>org.openscap.scap_workbench.desktop</id>
+<component type="desktop-application">
+ <id>org.open_scap.scap_workbench</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>SCAP Workbench</name>
<summary>A GUI tool that serves as an SCAP scanner and provides tailoring functionality for SCAP content</summary>
+ <launchable type="desktop-id">org.open_scap.scap_workbench.desktop</launchable>
<description>
<p>
The main goal of this application is to lower the initial barrier of using SCAP.
diff --git a/scap_workbench.desktop b/org.open_scap.scap_workbench.desktop
similarity index 67%
rename from scap_workbench.desktop
rename to org.open_scap.scap_workbench.desktop
index 5b4bb899..0d568b1d 100644
--- a/scap_workbench.desktop
+++ b/org.open_scap.scap_workbench.desktop
@@ -1,11 +1,11 @@
[Desktop Entry]
+Version=1.0
Type=Application
Name=SCAP Workbench
GenericName=SCAP Scanner and Profile Editor
-Comment=GUI tool that allows scanning both local and remote computers using SCAP content of your choice.
+Comment=GUI tool that allows scanning both local and remote computers using SCAP content of your choice
TryExec=scap-workbench
Exec=scap-workbench
Icon=scap-workbench
-Categories=System;
-Keywords=scap;
-X-Desktop-File-Install-Version=0.3
+Categories=System;Security;
+Keywords=SCAP;

View File

@ -0,0 +1,64 @@
From 806be588a70349b1705a687d38b90bfa6702d010 Mon Sep 17 00:00:00 2001
From: Carlos Matos <cmatos@redhat.com>
Date: Fri, 29 May 2020 13:59:32 -0400
Subject: [PATCH] Use QT provided macro function to version check - deprecation
errors
---
src/SaveAsRPMDialog.cpp | 7 ++++++-
src/TailoringWindow.cpp | 14 ++++++++++++--
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/SaveAsRPMDialog.cpp b/src/SaveAsRPMDialog.cpp
index 611d15f..854396b 100644
--- a/src/SaveAsRPMDialog.cpp
+++ b/src/SaveAsRPMDialog.cpp
@@ -86,7 +86,12 @@ void SaveAsRPMDialog::slotFinished(int result)
closure.remove(mScanningSession->getOpenedFilePath());
QList<QString> closureOrdered;
closureOrdered.append(mScanningSession->getOpenedFilePath());
- closureOrdered.append(closure.toList());
+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+ closureOrdered.append(closure.values());
+ #else
+ // support older versions where deprecation warning is not fatal
+ closureOrdered.append(closure.toList());
+ #endif
const QDir cwd = ScanningSession::getCommonAncestorDirectory(closure);
diff --git a/src/TailoringWindow.cpp b/src/TailoringWindow.cpp
index ceced3e..e4081cf 100644
--- a/src/TailoringWindow.cpp
+++ b/src/TailoringWindow.cpp
@@ -645,7 +645,12 @@ QString TailoringWindow::getQSettingsKey() const
void TailoringWindow::deserializeCollapsedItems()
{
const QStringList list = mQSettings->value(getQSettingsKey()).toStringList();
- mCollapsedItemIds = QSet<QString>::fromList(list);
+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+ mCollapsedItemIds = QSet<QString>(list.begin(), list.end());
+ #else
+ // support older versions where deprecation warning is not fatal
+ mCollapsedItemIds = QSet<QString>::fromList(list);
+ #endif
}
void TailoringWindow::serializeCollapsedItems()
@@ -657,7 +662,12 @@ void TailoringWindow::serializeCollapsedItems()
}
else
{
- mQSettings->setValue(getQSettingsKey(), QVariant(mCollapsedItemIds.toList()));
+ #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
+ mQSettings->setValue(getQSettingsKey(), QVariant(mCollapsedItemIds.values()));
+ #else
+ // support older versions where deprecation warning is not fatal
+ mQSettings->setValue(getQSettingsKey(), QVariant(mCollapsedItemIds.toList()));
+ #endif
mQSettings->setValue(getQSettingsKey() + "_lastUsed", QVariant(QDateTime::currentDateTime()));
}
}
--
2.26.2

View File

@ -0,0 +1,42 @@
From 99a496dd49d0e0035b12db43e09aa3ab144bbfbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
Date: Tue, 27 Jul 2021 11:14:23 +0200
Subject: [PATCH] Do not set rpath
See: https://fedoraproject.org/wiki/Changes/Broken_RPATH_will_fail_rpmbuild
Similar to: https://github.com/OpenSCAP/openscap/pull/1765
---
CMakeLists.txt | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fe33466..77bb3ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -128,23 +128,6 @@ set(SCAP_WORKBENCH_LINK_LIBRARIES
Qt5::Widgets Qt5::XmlPatterns
${OPENSCAP_LIBRARIES})
-# ---------- RPATHS for linking
-
-# see https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling
-
-# when building, use the install RPATH
-# (but later on when installing)
-set(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
-
-set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_FULL_LIBDIR})
-
-# add the automatically determined parts of the RPATH
-# which point to directories outside the build tree to the install RPATH
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-
-# Turn on RPATH for OSX
-set(CMAKE_MACOSX_RPATH ON)
-
configure_file("include/Config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/Config.h")
# It is not trivial to make the resulting file executable :-(
# People will have to `bash runwrapper.sh ...` in the meantime.
--
2.31.1

View File

@ -0,0 +1,50 @@
From c4a7616b9c61acee077359e71db2b3ab4db8098b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20=C4=8Cern=C3=BD?= <jcerny@redhat.com>
Date: Wed, 7 Oct 2020 08:54:22 +0200
Subject: [PATCH] Replace obsolete QString::SkipEmptyParts
Starting from Qt 5.15, the enum QString::SplitBehavior is obsolete
and Qt::SplitBehavior should be used instead.
See:
https://doc.qt.io/qt-5.15/qstring-obsolete.html#SplitBehavior-enum
https://doc.qt.io/qt-5/qt.html#SplitBehaviorFlags-enum
---
src/OscapCapabilities.cpp | 4 ++++
src/RPMOpenHelper.cpp | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/src/OscapCapabilities.cpp b/src/OscapCapabilities.cpp
index 03099fb..83d75f7 100644
--- a/src/OscapCapabilities.cpp
+++ b/src/OscapCapabilities.cpp
@@ -86,7 +86,11 @@ void OscapCapabilities::parse(const QString& mmv)
if (lines.size() < 1)
return; // TODO: Throw exception?
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
+ const QStringList firstLine = lines[0].split(' ', Qt::SkipEmptyParts);
+#else
const QStringList firstLine = lines[0].split(' ', QString::SkipEmptyParts);
+#endif
const QString& versionCandidate = firstLine.last();
if (!versionCandidate.contains(QRegExp("^([0-9]+\\.){2,}[0-9]+$")))
diff --git a/src/RPMOpenHelper.cpp b/src/RPMOpenHelper.cpp
index b12f109..180571b 100644
--- a/src/RPMOpenHelper.cpp
+++ b/src/RPMOpenHelper.cpp
@@ -54,7 +54,11 @@ RPMOpenHelper::RPMOpenHelper(const QString& path)
static QRegExp tailoringRE("^\\.\\/usr\\/share\\/xml\\/scap\\/[^\\/]+\\/tailoring-xccdf\\.xml+$");
static QRegExp inputRE("^\\.\\/usr\\/share\\/xml\\/scap\\/[^\\/]+\\/[^\\/]+\\-(xccdf|ds)\\.xml+$");
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0))
+ QStringList lines = proc.getStdErrContents().split('\n', Qt::SkipEmptyParts);
+#else
QStringList lines = proc.getStdErrContents().split('\n', QString::SkipEmptyParts);
+#endif
for (QStringList::const_iterator it = lines.constBegin(); it != lines.constEnd(); ++it)
{
const QString& line = *it;
--
2.26.2

View File

@ -0,0 +1,13 @@
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index c9a0937..e811e83 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -409,7 +409,7 @@ void MainWindow::openFile(const QString& path, bool reload)
// Refill mFSWatch after opening file
mFSWatch->removePaths(mFSWatch->files());
- for (const QString path : mScanningSession->getOriginalClosure())
+ for (const QString &path : mScanningSession->getOriginalClosure())
{
mFSWatch->addPath(path);
}

View File

@ -1,31 +1,33 @@
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
Name: scap-workbench
Version: 1.2.0
Release: 8%{?dist}
Version: 1.2.1
Release: 13%{?dist}
Summary: Scanning, tailoring, editing and validation tool for SCAP content
License: GPLv3+
URL: http://www.open-scap.org/tools/scap-workbench
Source0: https://github.com/OpenSCAP/scap-workbench/releases/download/%{version}/scap-workbench-%{version}.tar.bz2
Patch1: oscap_version_suffix.patch
Patch2: scap-workbench-1.2.1-missing-quotes.patch
Patch3: scap-workbench-1.2.1-no-spaces-in-temporary-file-names.patch
Patch4: scap-workbench-1.2.2-generate-result-based-remediation-from-tailored-profile.patch
Patch5: scap-workbench-1.2.2-ui_dimensions.patch
Patch6: scap-workbench-1.2.2-refactor_messages-PR_271.patch
Patch7: scap-workbench-1.2.2-remote_sudo-PR_270.patch
Patch8: scap-workbench-1.2.1-use_asciidoc-PR_200.patch
Group: System Environment/Base
Patch1: scap-workbench-1.2.2-fix-qt-deprecated-pr-259.patch
Patch2: scap-workbench-1.2.2-replace-obsolete-Qstring-SkipEmptyParts-pr-266.patch
Patch3: %{name}-gcc11.patch
Patch4: scap-workbench-1.2.2-no-rpath-pr-285.patch
Patch5: scap-workbench-1.2.2-fix-appdata-pr-288.diff
Patch6: scap-workbench-1.2.2-fix-appdata-pr-295.patch
Patch7: scap-workbench-1.2.2-generate-result-based-remediation-from-tailored-profile.patch
Patch8: scap-workbench-1.2.2-ui_dimensions.patch
Patch9: scap-workbench-1.2.2-refactor_messages-PR_271.patch
Patch10: scap-workbench-1.2.2-remote_sudo-PR_270.patch
BuildRequires: cmake >= 2.6
BuildRequires: qt5-devel >= 5.0.0
BuildRequires: qt5-qtbase-devel >= 5.0.0
BuildRequires: qt5-qtxmlpatterns-devel >= 5.0.0
# Although releases usually contain compiled docs, builds from source via Packit need to generate those.
BuildRequires: asciidoc
BuildRequires: openscap-devel >= 1.2.11
BuildRequires: openscap-utils >= 1.2.11
Requires: openscap-utils >= 1.2.11
# Enables rebuild of documentation from downstream patches
BuildRequires: asciidoc
# ssh to scan remote machines
BuildRequires: openssh-clients
Requires: openssh-clients
@ -45,26 +47,18 @@ scap-workbench is GUI tool that provides scanning functionality for SCAP
content. The tool is based on OpenSCAP library.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%autosetup -p1
%build
%cmake -D CMAKE_INSTALL_DOCDIR=%{_pkgdocdir} .
make %{?_smp_mflags}
%cmake
%cmake_build
%install
make install DESTDIR=%{buildroot}
%cmake_install
%files
%{_bindir}/scap-workbench
%{_datadir}/applications/scap-workbench.desktop
%{_datadir}/applications/org.open_scap.scap_workbench.desktop
%{_datadir}/scap-workbench/*.png
%{_datadir}/scap-workbench/translations/*
%{_libexecdir}/scap-workbench-oscap.sh
@ -72,43 +66,76 @@ make install DESTDIR=%{buildroot}
%{_libexecdir}/scap-workbench-rpm-extract.sh
%{_datadir}/polkit-1/actions/scap-workbench-oscap.policy
%{_datadir}/pixmaps/scap-workbench.png
%{_datadir}/pixmaps/scap-workbench.svg
%{_datadir}/appdata/scap-workbench.appdata.xml
%{_datadir}/icons/hicolor/scalable/apps/scap-workbench.svg
%{_datadir}/metainfo/org.open_scap.scap_workbench.appdata.xml
%doc %{_mandir}/man8/scap-workbench.8.gz
%doc %{_pkgdocdir}/user_manual.html
%doc %{_pkgdocdir}/COPYING
%doc %{_pkgdocdir}/README.md
%changelog
* Fri Feb 12 2021 Matej Tyc <matyc@redhat.com> - 1.2.0-8
- Introduce asciidoc support instead of asciidoctor (RHBZ#1877522)
* Wed Dec 01 2021 Matej Tyc <matyc@redhat.com> - 1.2.1-13
- Ported 1.2.2 patches that we are present in el8 packages (rhbz#2029381)
* Tue Feb 09 2021 Matej Tyc <matyc@redhat.com> - 1.2.0-7
- Enabled asciidoc support during build (RHBZ#1877522)
* Mon Nov 08 2021 Evgenii Kolesnikov <ekolesni@redhat.com> - 1.2.1-12
- Fix appdata (rhbz#2021212)
* Mon Feb 1 14:38:24 CET 2021 Matej Tyc <matyc@redhat.com> - 1.2.0-6
- Refactor handling of scanner messages.
- Implement passwordless sudo support (RHBZ#1877522)
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 1.2.1-11
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Wed May 27 2020 Matěj Týč <matyc@redhat.com> - 1.2.0-5
- Adjust the GUI dimensions, so text fits to the screen (RHBZ#1743713)
* Tue Jul 27 2021 Jan Černý <jcerny@redhat.com> - 1.2.1-10
- Do not set rpath (rhbz#1986352)
* Wed Apr 29 2020 Jan Černý <jcerny@redhat.com> - 1.2.0-5
- Generate result-based remediation from tailored profile (RHBZ#1640715)
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.2.1-9
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 28 2020 Jan Černý <jcerny@redhat.com> 1.2.0-4
- Fix error messages in the diagnostics window (RHBZ#1781074)
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Oct 15 2018 Watson Yuuma Sato <wsato@redhat.com> - 1.2.0-3
- Rebuilt to fix openscap dependency (RHBZ#1639405)
* Fri Oct 16 2020 Jeff Law <law@redhat.com> - 1.2.1-7
- Use reference to avoid range-loop-construct diagnostic
* Thu Aug 30 2018 Jan Černý <jcerny@redhat.com> 1.2.0-2
- Support the OpenSCAP version suffix (RHBZ#1622998)
* Wed Oct 07 2020 Jan Černý <jcerny@redhat.com> - 1.2.1-6
- Replace obsolete QString::SkipEmptyParts
* Tue Aug 04 2020 Jan Černý <jcerny@redhat.com> - 1.2.1-5
- Remove qt5-devel from "Requires" section
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/WO625MVYEAAJNHNRLEEJDVZTIWMQOBRR/
- Update for new CMake out of source builds
https://fedoraproject.org/wiki/Changes/CMake_to_do_out-of-source_builds
- Fix Qt5 deprecated symbols
- Fix FTBS in Rawhide/F33 (RHBZ#1865462)
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-4
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Jan 27 2020 Jan Černý <jcerny@redhat.com> - 1.2.1-1
- Upgrade to the latest upstream release
* Fri Jan 03 2020 Matěj Týč <matyc@redhat.com> - 1.2.0-4
- Added asciidoc as build-time dependency for Packit.
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Wed Jul 18 2018 Martin Preisler <mpreisle@redhat.com> 1.2.0-1
- Updated to new upstream release 1.2.0
- Now using Qt5
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild