Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Vladimir Svyatski 2018-05-22 21:42:53 +03:00
commit 28d949fa5f
5 changed files with 107 additions and 39 deletions

51
ci/snapcraft/Dockerfile Normal file
View File

@ -0,0 +1,51 @@
# KeePassXC Linux Release Build Dockerfile
# Copyright (C) 2017-2018 KeePassXC team <https://keepassxc.org/>
#
# 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 2 or (at your option)
# version 3 of the License.
#
# 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/>.
FROM snapcore/snapcraft
ENV REBUILD_COUNTER=1
ENV QT5_VERSION=510
ENV QT5_PPA_VERSION=5.10.1
RUN set -x \
&& apt update -y \
&& apt -y install software-properties-common
RUN set -x \
&& add-apt-repository ppa:phoerious/keepassxc
RUN set -x \
&& apt update -y \
&& apt-get -y --no-install-recommends install \
build-essential \
cmake \
libgcrypt20-18-dev \
libargon2-0-dev \
libsodium-dev \
qtbase5-dev \
qttools5-dev \
qttools5-dev-tools \
zlib1g-dev \
libyubikey-dev \
libykpers-1-dev \
libxi-dev \
libxtst-dev \
xvfb
RUN set -x \
&& apt-get autoremove --purge

View File

@ -41,6 +41,7 @@ BUILD_PLUGINS="all"
INSTALL_PREFIX="/usr/local" INSTALL_PREFIX="/usr/local"
BUILD_SOURCE_TARBALL=true BUILD_SOURCE_TARBALL=true
BUILD_SNAPSHOT=false BUILD_SNAPSHOT=false
BUILD_SNAPCRAFT=false
ORIG_BRANCH="" ORIG_BRANCH=""
ORIG_CWD="$(pwd)" ORIG_CWD="$(pwd)"
@ -106,6 +107,8 @@ Options:
This option has no effect if --build is not set. This option has no effect if --build is not set.
--container-name Docker container name (default: '${DOCKER_CONTAINER_NAME}') --container-name Docker container name (default: '${DOCKER_CONTAINER_NAME}')
The container must not exist already The container must not exist already
--snapcraft Create and use docker image to build snapcraft distribution.
This option has no effect if --docker-image is not set.
-c, --cmake-options Additional CMake options for compiling the sources -c, --cmake-options Additional CMake options for compiling the sources
--compiler Compiler to use (default: '${COMPILER}') --compiler Compiler to use (default: '${COMPILER}')
-m, --make-options Make options for compiling sources (default: '${MAKE_OPTIONS}') -m, --make-options Make options for compiling sources (default: '${MAKE_OPTIONS}')
@ -543,6 +546,10 @@ build() {
DOCKER_CONTAINER_NAME="$2" DOCKER_CONTAINER_NAME="$2"
shift ;; shift ;;
--snapcraft)
BUILD_SNAPCRAFT=true
shift ;;
-c|--cmake-options) -c|--cmake-options)
CMAKE_OPTIONS="$2" CMAKE_OPTIONS="$2"
shift ;; shift ;;
@ -702,6 +709,17 @@ build() {
logInfo "Creating AppImage..." logInfo "Creating AppImage..."
${SRC_DIR}/AppImage-Recipe.sh "$APP_NAME" "$RELEASE_NAME" ${SRC_DIR}/AppImage-Recipe.sh "$APP_NAME" "$RELEASE_NAME"
fi fi
else
if [ BUILD_SNAPCRAFT ]; then
logInfo "Building snapcraft docker image..."
sudo docker image build -t "$DOCKER_IMAGE" "$(realpath "$SRC_DIR")/ci/snapcraft"
logInfo "Launching Docker contain to compile snapcraft..."
sudo docker run --name "$DOCKER_CONTAINER_NAME" --rm \
-v "$(realpath "$SRC_DIR"):/keepassxc" -w "/keepassxc" \
"$DOCKER_IMAGE" snapcraft
else else
mkdir -p "${OUTPUT_DIR}/bin-release" mkdir -p "${OUTPUT_DIR}/bin-release"
@ -719,6 +737,7 @@ build() {
-DKEEPASSXC_DIST_TYPE=AppImage /keepassxc/src && \ -DKEEPASSXC_DIST_TYPE=AppImage /keepassxc/src && \
make $MAKE_OPTIONS && make DESTDIR=/keepassxc/out/bin-release install/strip && \ make $MAKE_OPTIONS && make DESTDIR=/keepassxc/out/bin-release install/strip && \
/keepassxc/src/AppImage-Recipe.sh "$APP_NAME" "$RELEASE_NAME"" /keepassxc/src/AppImage-Recipe.sh "$APP_NAME" "$RELEASE_NAME""
fi
if [ 0 -ne $? ]; then if [ 0 -ne $? ]; then
exitError "Docker build failed!" exitError "Docker build failed!"

View File

@ -27,6 +27,8 @@ parts:
configflags: configflags:
- -DCMAKE_BUILD_TYPE=Release - -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX=/usr - -DCMAKE_INSTALL_PREFIX=/usr
- -DCMAKE_LIBRARY_PATH=/opt/keepassxc-libs/lib/x86_64-linux-gnu
- -DCMAKE_INCLUDE_PATH=/opt/keepassxc-libs/include
- -DKEEPASSXC_DIST_TYPE=Snap - -DKEEPASSXC_DIST_TYPE=Snap
- -DKEEPASSXC_BUILD_TYPE=Release - -DKEEPASSXC_BUILD_TYPE=Release
- -DWITH_TESTS=OFF - -DWITH_TESTS=OFF
@ -43,31 +45,26 @@ parts:
- libxtst-dev - libxtst-dev
- libyubikey-dev - libyubikey-dev
- libykpers-1-dev - libykpers-1-dev
- libcurl4-openssl-dev
- libsodium-dev - libsodium-dev
- libargon2-0-dev - libargon2-0-dev
stage-packages: stage-packages:
- dbus - dbus
- qttranslations5-l10n # common translations - qttranslations5-l10n # common translations
- libgcrypt20-18 - libgcrypt20-18
install: | - libykpers-1-1
- libargon2-0
- libsodium23
- libxtst6
- libqt5x11extras5
- libusb-1.0-0
override-build: |
snapcraftctl build
sed -i 's|Icon=keepassxc|Icon=${SNAP}/usr/share/icons/hicolor/256x256/apps/keepassxc.png|g' $SNAPCRAFT_PART_INSTALL/usr/share/applications/org.keepassxc.KeePassXC.desktop sed -i 's|Icon=keepassxc|Icon=${SNAP}/usr/share/icons/hicolor/256x256/apps/keepassxc.png|g' $SNAPCRAFT_PART_INSTALL/usr/share/applications/org.keepassxc.KeePassXC.desktop
organize: organize:
usr/share/qt5/translations/*.qm: usr/share/keepassxc/translations/ usr/share/qt5/translations/*.qm: usr/share/keepassxc/translations/
opt/keepassxc-libs/lib/x86_64-linux-gnu/*: usr/lib/x86_64-linux-gnu/
opt/keepassxc-libs/share/locale/*: usr/share/locale/
stage:
- -opt
after: [desktop-qt5] after: [desktop-qt5]
# Redefine desktop-qt5 stage packages to work with Ubuntu 17.04
desktop-qt5:
stage-packages:
- libxkbcommon0
- ttf-ubuntu-font-family
- dmz-cursor-theme
- light-themes
- adwaita-icon-theme
- gnome-themes-standard
- shared-mime-info
- libqt5gui5
- libgdk-pixbuf2.0-0
- libqt5svg5 # for loading icon themes which are svg
- locales-all
- xdg-user-dirs

View File

@ -134,11 +134,12 @@ void NativeMessagingBase::sendReply(const QString& reply)
QString NativeMessagingBase::getLocalServerPath() const QString NativeMessagingBase::getLocalServerPath() const
{ {
const QString serverPath = "/kpxc_server";
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
// Use XDG_RUNTIME_DIR instead of /tmp/ if it's available // Use XDG_RUNTIME_DIR instead of /tmp if it's available
QString path = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation) + "/kpxc_server"; QString path = QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation);
return path.isEmpty() ? "/tmp/kpxc_server" : path; return path.isEmpty() ? QStandardPaths::writableLocation(QStandardPaths::TempLocation) + serverPath : path + serverPath;
#else // Q_OS_MAC, Q_OS_WIN and others #else // Q_OS_MAC, Q_OS_WIN and others
return QStandardPaths::writableLocation(QStandardPaths::TempLocation) + "/kpxc_server"; return QStandardPaths::writableLocation(QStandardPaths::TempLocation) + serverPath;
#endif #endif
} }

View File

@ -32,6 +32,7 @@
#include <QStackedLayout> #include <QStackedLayout>
#include <QStandardPaths> #include <QStandardPaths>
#include <QTemporaryFile> #include <QTemporaryFile>
#include <QButtonGroup>
#include "autotype/AutoType.h" #include "autotype/AutoType.h"
#include "core/Config.h" #include "core/Config.h"
@ -275,7 +276,6 @@ void EditEntryWidget::setupEntryUpdate()
connect( connect(
m_sshAgentUi->attachmentComboBox, SIGNAL(editTextChanged(const QString&)), this, SLOT(setUnsavedChanges())); m_sshAgentUi->attachmentComboBox, SIGNAL(editTextChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->externalFileEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges())); connect(m_sshAgentUi->externalFileEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->publicKeyEdit, SIGNAL(textChanged()), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->addKeyToAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges())); connect(m_sshAgentUi->addKeyToAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
connect(m_sshAgentUi->removeKeyFromAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges())); connect(m_sshAgentUi->removeKeyFromAgentCheckBox, SIGNAL(stateChanged(int)), this, SLOT(setUnsavedChanges()));
connect( connect(