From 8609ef4a54c281c3b8c143c68961bdb468ad3b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Sat, 14 May 2016 10:26:10 +0000 Subject: [PATCH] read more than one certificate from a file; take file names in command line arguments --- ax_init_standard_project.m4 | 2 ++ bootstrap.sh | 14 ++++++++++++-- build-in-docker.conf | 4 ++++ resolve-rpmbuilddeps.sh | 13 +++++++++++++ src/certman.hxx | 37 ++++++++++++++++++++++++------------- src/main.cxx | 6 +++++- 6 files changed, 60 insertions(+), 16 deletions(-) create mode 100644 build-in-docker.conf diff --git a/ax_init_standard_project.m4 b/ax_init_standard_project.m4 index f487c68..4128d9f 100644 --- a/ax_init_standard_project.m4 +++ b/ax_init_standard_project.m4 @@ -181,6 +181,8 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [ _AM_SUBST_NOTMAKE([AUTHOR]) DISTRO=$(lsb_release -sc 2>/dev/null || uname -s 2>/dev/null) AX_SUBST(DISTRO) + ARCH=$((@<:@@<:@ $(uname -sm) =~ 64 @:>@@:>@ && echo amd64) || (@<:@@<:@ $(uname -sm) =~ 'i?86' @:>@@:>@ && echo i386 || uname -sm)) + AX_SUBST(ARCH) DISTRIBUTOR=$(lsb_release -si 2>/dev/null || uname -s 2>/dev/null) case "${DISTRIBUTOR// /-}" in (Ubuntu) UBUNTU=1; AX_SUBST(UBUNTU);; diff --git a/bootstrap.sh b/bootstrap.sh index 9b53b8b..50c94e1 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -31,8 +31,9 @@ while test $# -gt 0; do (--configure|-c) configure=1;; (--docker|-d) docker=1;; (--build|-b) configure=1; build=1; buildtarget+=" distcheck";; - (--target|-t) shift; configure=1; build=1; buildtarget+=" $1";; + (--all|-a) shift; configure=1; build=1; buildtarget+=" all";; (--clean) shift; configure=1; build=1; buildtarget+=" maintainer-clean";; + (--target|-t) shift; configure=1; build=1; buildtarget+=" $1";; (--overwrite|-o) overwrite=1;; (--rebuild|-r) rebuild=1;; (--rebuild-file|-f) shift; rebuildfiles+=("$1");; @@ -51,6 +52,8 @@ OPTIONS --configure, -c call ./configure after initialization --docker, -d build and run tests in a docker instance --build, -b build, also call ./configure && make distcheck + --all, -a same as -b, but make target all + --clean same as -b, but make target maintainer-clean --target, -t same as -b, but specify target instead of distcheck --overwrite, -o overwrite all basic files (bootstrap.sh, m4-macros) --rebuild, -r force rebuild of generated files, even if modified @@ -129,6 +132,7 @@ GENERATED FILES * resolve-debbuilddeps.sh - script to install debian package dependencies * resolve-rpmbuilddeps.sh - script to install RPM package dependencies * build-in-docker.sh - script to build the project encapsulated in a docker container + * build-in-docker.conf - additional configuration for build-in-docker.sh * build-resource-file.sh - build resource.qrc file from a resource directory * sql-to-dot.sed - script to convert SQL schema files to graphviz dot in doxygen * mac-create-app-bundle.sh - script to create apple mac os-x app-bundle @@ -845,7 +849,7 @@ if testtag AX_USE_DOXYGEN; then doxyreplace PROJECT_NAME "@PACKAGE_NAME@" doxyreplace PROJECT_NUMBER "@PACKAGE_VERSION@" doxyreplace PROJECT_BRIEF "@DESCRIPTION@" - doxyreplace PROJECT_LOGO "@top_srcdir@/@PACKACE_LOGO@" + doxyreplace PROJECT_LOGO "@top_srcdir@/@PACKAGE_LOGO@" doxyreplace INLINE_INHERITED_MEMB YES doxyreplace MULTILINE_CPP_IS_BRIEF YES doxyreplace TAB_SIZE 2 @@ -1162,6 +1166,12 @@ Libs: -L\${libdir} -l${PACKAGE_NAME#lib} @LDFLAGS@ Cflags: -I\${includedir} @CPPFLAGS@ Requires: @PKG_REQUIREMENTS@ EOF +to build-in-docker.conf <&1 | sed -n 's, is needed by.*,,p') if test -n "${FILES}"; then + FIRST=$(echo "${FILES}" | egrep -o "${PKGCONFIGS// /|}") + if test -n "${FIRST}"; then + schroot -c ${SCHROOTNAME} -u root -- yum install -y ${FIRST} || \ + schroot -c ${SCHROOTNAME} -u root -- zypper install -y ${FIRST} || \ + schroot -c ${SCHROOTNAME} -u root -- dnf install -y ${FIRST} + fi schroot -c ${SCHROOTNAME} -u root -- yum install -y ${FILES} || \ schroot -c ${SCHROOTNAME} -u root -- zypper install -y ${FILES} || \ schroot -c ${SCHROOTNAME} -u root -- dnf install -y ${FILES} @@ -23,6 +30,12 @@ if test -n "${SCHROOTNAME}"; then else FILES=$(LANG= rpmbuild -bb --clean --nobuild --define "_topdir ." --define "_sourcedir ." ${PACKAGE_NAME}.spec 2>&1 | sed -n 's, is needed by.*,,p') if test -n "${FILES}"; then + FIRST=$(echo "${FILES}" | egrep -o "${PKGCONFIGS// /|}") + if test -n "${FIRST}"; then + yum install -y ${FIRST} || \ + zypper install -y ${FIRST} || \ + dnf install -y ${FIRST} + fi yum install -y ${FILES} || \ zypper install -y ${FILES} || \ dnf install -y ${FILES} diff --git a/src/certman.hxx b/src/certman.hxx index 87c9f6d..97db01c 100644 --- a/src/certman.hxx +++ b/src/certman.hxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -33,24 +34,34 @@ class CertMan: public QMainWindow, protected Ui::CertMan { connect(&_openFromURL, SIGNAL(certificate(QUrl, QSslCertificate)), SLOT(certificate(QUrl, QSslCertificate))); } + bool open(const QString& fileName) { + bool status(true); + QFile file(fileName); + file.open(QIODevice::ReadOnly); + while (!file.atEnd()) { + QSslCertificate c(&file); + if (!c.isNull()) { + Certificate* win(new Certificate(_mdi)); + _mdi->addSubWindow(win)->setWindowTitle(QFileInfo(fileName).fileName()); + win->show(); + win->certificate(c); + } else { + status = false; + qDebug()<addSubWindow(win)->setWindowTitle(QFileInfo(fileName).fileName()); - win->show(); - win->certificate(c); + if (!open(fileName)) + QMessageBox::warning(this, "Error Loading File", + QString("Error loading file:\n%1").arg(fileName)); } void on__actionOpenFromURL_triggered() { if (_openFromURL.exec()==QDialog::Accepted) { diff --git a/src/main.cxx b/src/main.cxx index 5921b53..65284eb 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -18,8 +18,12 @@ int main(int argc, char *argv[]) try { QCommandLineParser parser; parser.addHelpOption(); parser.process(a); - QStringList scripts(parser.positionalArguments()); + QStringList files(parser.positionalArguments()); CertMan w; + for (const QString& file: files) { + if (!w.open(file)) + std::cerr<<"Error reading file: "<