Use nix to download Desktop bundle base images
Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
parent
fc5c8c2dc0
commit
c53553e137
|
@ -3,3 +3,5 @@ android-sdk-platform;android-27;
|
|||
android-sdk;4333796;aa190cfd7299cd6a1c687355bb2764e4
|
||||
nix;2.2.1;
|
||||
react_native_cli;2.0.1;
|
||||
StatusImAppImage;20181208;
|
||||
StatusIm-Windows-base-image;20181113;
|
|
@ -2,7 +2,7 @@ pipeline {
|
|||
agent {
|
||||
docker {
|
||||
label 'linux'
|
||||
image 'statusteam/nix:jenkins-1.0.0-4a147dc3'
|
||||
image 'statusteam/nix:jenkins-1.0.0-158e62e1'
|
||||
args (
|
||||
"-v /home/jenkins/tmp:/var/tmp:rw "+
|
||||
"-v /home/jenkins/status-im.keystore:/tmp/status-im.keystore:ro"
|
||||
|
|
|
@ -2,12 +2,11 @@ pipeline {
|
|||
agent {
|
||||
docker {
|
||||
label 'linux'
|
||||
image 'statusteam/nix:jenkins-1.0.0-4a147dc3'
|
||||
image 'statusteam/nix:jenkins-1.0.0-158e62e1'
|
||||
args (
|
||||
"-v /tmp/Android/Sdk:/home/jenkins/.status/Android/Sdk:rw "+
|
||||
"-v /var/tmp/lein:/var/tmp/lein:rw "+
|
||||
"-v /var/tmp/npm:/var/tmp/npm:rw "+
|
||||
"-v /opt/desktop-files:/opt/desktop-files:rw"
|
||||
"-v /var/tmp/npm:/var/tmp/npm:rw "
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +44,6 @@ pipeline {
|
|||
CI_ENVIRONMENT = 'jenkins'
|
||||
LEIN_HOME = '/var/tmp/lein'
|
||||
NIX_CONF_DIR = "${env.WORKSPACE}/scripts/lib/setup/nix"
|
||||
STATUSIM_APPIMAGE_DIR = '/opt/desktop-files'
|
||||
VERBOSE_LEVEL = '3'
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ pipeline {
|
|||
/* the -u is necessary for acces to /nix */
|
||||
docker {
|
||||
label 'linux'
|
||||
image 'statusteam/nix:jenkins-1.0.0-4a147dc3'
|
||||
image 'statusteam/nix:jenkins-1.0.0-158e62e1'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ pipeline {
|
|||
agent {
|
||||
docker {
|
||||
label 'linux-new'
|
||||
image 'statusteam/nix:jenkins-1.0.0-4a147dc3'
|
||||
image 'statusteam/nix:jenkins-1.0.0-158e62e1'
|
||||
args (
|
||||
"-v /var/tmp/lein:/var/tmp/lein:rw "+
|
||||
"-v /var/tmp/npm:/var/tmp/npm:rw "
|
||||
|
|
|
@ -46,6 +46,8 @@ ENV LANG=en_US.UTF-8 \
|
|||
LANGUAGE=en_US.UTF-8
|
||||
|
||||
ARG NIX_VERSION
|
||||
# DEPS_HASH is not used expect for a new image to be created in case some indirect dependency changes (e.g. a download brought by nix-shell)
|
||||
ARG DEPS_HASH
|
||||
ARG ANDROID_SDK_VERSION
|
||||
ARG JENKINS_UID
|
||||
ARG JENKINS_GID
|
||||
|
|
|
@ -23,7 +23,9 @@ DEPS_HASH = $(shell $(GIT_ROOT)/scripts/gen-deps-hash.sh -b $(NIX_SHA) \
|
|||
-d android-sdk \
|
||||
-d android-sdk-platform \
|
||||
-d android-sdk-build-tools \
|
||||
-d nix)
|
||||
-d nix \
|
||||
-d StatusImAppImage \
|
||||
-d StatusIm-Windows-base-image)
|
||||
|
||||
IMAGE_TAG = jenkins-1.0.0-$(DEPS_HASH)
|
||||
IMAGE_NAME = statusteam/nix:$(IMAGE_TAG)
|
||||
|
@ -36,6 +38,7 @@ build: $(NIX_INSTALL) $(ANDROID_SDK_ARCHIVE)
|
|||
--build-arg="ANDROID_SDK_VERSION=$(ANDROID_SDK_VERSION)" \
|
||||
--build-arg="SDK_BUILD_TOOLS_VERSION=$(SDK_BUILD_TOOLS_VERSION)" \
|
||||
--build-arg="SDK_PLATFORM_VERSION=$(SDK_PLATFORM_VERSION)" \
|
||||
--build-arg="DEPS_HASH=$(DEPS_HASH)" \
|
||||
-t $(IMAGE_NAME) .
|
||||
|
||||
$(NIX_INSTALL):
|
||||
|
|
|
@ -57,11 +57,15 @@ with pkgs;
|
|||
++ lib.optional targetDesktop statusDesktop.buildInputs
|
||||
++ lib.optional targetMobile statusMobile.buildInputs;
|
||||
shellHook =
|
||||
''
|
||||
set -e
|
||||
'' +
|
||||
lib.optionalString targetDesktop statusDesktop.shellHook +
|
||||
lib.optionalString targetMobile statusMobile.shellHook +
|
||||
''
|
||||
if [ -n "$ANDROID_SDK_ROOT" ] && [ ! -d "$ANDROID_SDK_ROOT" ]; then
|
||||
./scripts/setup # we assume that if the Android SDK dir does not exist, make setup needs to be run
|
||||
fi
|
||||
set +e
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
;Unicode true
|
||||
;!define top_srcdir @top_srcdir@
|
||||
;!define base_image_dir ""
|
||||
;!define srcdir @srcdir@
|
||||
!define VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}
|
||||
!define VERSION_FULL ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}.0
|
||||
|
@ -626,7 +627,7 @@ Section "Status Desktop" SecMain
|
|||
File "${top_srcdir}\.env"
|
||||
File "${top_srcdir}\node_modules\node-notifier\vendor\snoreToast\SnoreToast.exe"
|
||||
File /r "${top_srcdir}\desktop\bin\"
|
||||
File /r "${top_srcdir}\StatusImPackage\Windows\"
|
||||
File /r "${base_image_dir}"
|
||||
|
||||
SetOutPath "$INSTDIR\notifier"
|
||||
File "${top_srcdir}\node_modules\node-notifier\vendor\notifu\*.exe"
|
||||
|
|
|
@ -83,7 +83,6 @@ fi
|
|||
|
||||
STATUSREACTPATH="$(cd "$SCRIPTPATH" && cd '..' && pwd)"
|
||||
WORKFOLDER="$(joinExistingPath "$STATUSREACTPATH" 'StatusImPackage')"
|
||||
STATUSIM_APPIMAGE_ARCHIVE="StatusImAppImage_20181208.zip"
|
||||
|
||||
function init() {
|
||||
if [ -z $STATUSREACTPATH ]; then
|
||||
|
@ -193,20 +192,9 @@ function bundleWindows() {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
pushd $WORKFOLDER
|
||||
rm -rf Windows
|
||||
mkdir Windows
|
||||
|
||||
if [ -z $STATUSIM_WINDOWS_BASEIMAGE_ZIP ]; then
|
||||
STATUSIM_WINDOWS_BASEIMAGE_ZIP=./StatusIm-Windows-base-image.zip
|
||||
[ -f $STATUSIM_WINDOWS_BASEIMAGE_ZIP ] || wget https://desktop-app-files.ams3.digitaloceanspaces.com/StatusIm-Windows-base-image_20181113.zip -O StatusIm-Windows-base-image.zip
|
||||
fi
|
||||
unzip "$STATUSIM_WINDOWS_BASEIMAGE_ZIP" -d Windows/
|
||||
|
||||
pushd $STATUSREACTPATH/desktop/bin
|
||||
rm -rf cmake_install.cmake Makefile CMakeFiles Status_autogen
|
||||
popd
|
||||
popd
|
||||
|
||||
local compressionAlgo="lzma"
|
||||
local compressionType="/SOLID"
|
||||
|
@ -217,11 +205,15 @@ function bundleWindows() {
|
|||
compressionAlgo="zlib"
|
||||
fi
|
||||
|
||||
# TODO this needs to be fixed: status-react/issues/5378
|
||||
local windowsBaseImagePath="$(nix show-derivation -r -f $STATUSREACTPATH | jq -r '.[] | select(.env.name=="StatusIm-Windows-base-image") | .outputs.out.path')/src"
|
||||
|
||||
local top_srcdir=$(joinExistingPath "$STATUSREACTPATH" '.')
|
||||
VERSION_MAJOR="$(cut -d'.' -f1 <<<"$VERSION")"
|
||||
VERSION_MINOR="$(cut -d'.' -f2 <<<"$VERSION")"
|
||||
VERSION_BUILD="$(cut -d'.' -f3 <<<"$VERSION")"
|
||||
makensis -Dtop_srcdir=${top_srcdir} \
|
||||
-Dbase_image_dir=${windowsBaseImagePath} \
|
||||
-DCOMPRESSION_ALGO=${compressionAlgo} \
|
||||
-DCOMPRESSION_TYPE=${compressionType} \
|
||||
-DVERSION_MAJOR=$VERSION_MAJOR \
|
||||
|
@ -239,24 +231,21 @@ function bundleLinux() {
|
|||
QTBIN=$(joinExistingPath "$QT_PATH" 'bin')
|
||||
fi
|
||||
|
||||
# invoke linuxdeployqt to create Status.AppImage
|
||||
echo "Creating AppImage..."
|
||||
pushd $WORKFOLDER
|
||||
rm -rf StatusImAppImage
|
||||
rm -rf StatusImAppImage AppDir
|
||||
|
||||
# TODO this needs to be fixed: status-react/issues/5378
|
||||
if [ -z $STATUSIM_APPIMAGE_DIR ]; then
|
||||
STATUSIM_APPIMAGE="./${STATUSIM_APPIMAGE_ARCHIVE}"
|
||||
else
|
||||
STATUSIM_APPIMAGE="${STATUSIM_APPIMAGE_DIR}/${STATUSIM_APPIMAGE_ARCHIVE}"
|
||||
fi
|
||||
[ -f $STATUSIM_APPIMAGE ] || wget "https://desktop-app-files.ams3.digitaloceanspaces.com/${STATUSIM_APPIMAGE_ARCHIVE}" -O $STATUSIM_APPIMAGE
|
||||
unzip "$STATUSIM_APPIMAGE" -d .
|
||||
rm -rf AppDir
|
||||
local baseAppImagePath="$(nix show-derivation -r -f $STATUSREACTPATH | jq -r '.[] | select(.env.name=="StatusImAppImage") | .outputs.out.path')/src"
|
||||
cp -r $baseAppImagePath/StatusImAppImage .
|
||||
chmod -R +w StatusImAppImage/
|
||||
|
||||
mkdir AppDir
|
||||
popd
|
||||
|
||||
qmakePath="$(joinExistingPath "${QTBIN}" 'qmake')"
|
||||
usrBinPath="$(joinPath "$WORKFOLDER" "AppDir/usr/bin")"
|
||||
# invoke linuxdeployqt to create Status.AppImage
|
||||
local qmakePath="$(joinExistingPath "${QTBIN}" 'qmake')"
|
||||
local usrBinPath="$(joinPath "$WORKFOLDER" "AppDir/usr/bin")"
|
||||
cp -r ./deployment/linux/usr $WORKFOLDER/AppDir
|
||||
cp ./.env $usrBinPath
|
||||
cp ./desktop/bin/Status ./desktop/bin/reportApp $usrBinPath
|
||||
|
@ -264,13 +253,13 @@ function bundleLinux() {
|
|||
rm -f Application-x86_64.AppImage Status-x86_64.AppImage
|
||||
|
||||
[ $VERBOSE_LEVEL -ge 1 ] && ldd $(joinExistingPath "$usrBinPath" 'Status')
|
||||
desktopFilePath="$(joinExistingPath "$WORKFOLDER" 'AppDir/usr/share/applications/Status.desktop')"
|
||||
pushd $WORKFOLDER
|
||||
cp -r assets/share/assets $usrBinPath
|
||||
cp -rf StatusImAppImage/* $usrBinPath
|
||||
rm -f $usrBinPath/Status.AppImage
|
||||
popd
|
||||
|
||||
local desktopFilePath="$(joinExistingPath "$WORKFOLDER" 'AppDir/usr/share/applications/Status.desktop')"
|
||||
linuxdeployqt \
|
||||
$desktopFilePath \
|
||||
-verbose=$VERBOSE_LEVEL -always-overwrite -no-strip \
|
||||
|
@ -450,14 +439,11 @@ fi
|
|||
function bundleMacOS() {
|
||||
pushd $WORKFOLDER
|
||||
# download prepared package with mac bundle files (it contains qt libraries, icon)
|
||||
echo "Downloading skeleton of mac bundle..."
|
||||
|
||||
rm -rf Status.app
|
||||
# TODO this needs to be fixed: status-react/issues/5378
|
||||
[ -f ./Status.app.zip ] || curl -L -o Status.app.zip https://desktop-app-files.ams3.digitaloceanspaces.com/Status_20181113.app.zip
|
||||
echo -e "${GREEN}Downloading done.${NC}"
|
||||
echo ""
|
||||
unzip ./Status.app.zip
|
||||
local baseAppImagePath="$(nix show-derivation -r -f $STATUSREACTPATH | jq -r '.[] | select(.env.name=="StatusImAppBundle") | .outputs.out.path')/src"
|
||||
cp -r $baseAppImagePath/Status.app .
|
||||
chmod -R +w Status.app/
|
||||
|
||||
local contentsPath='Status.app/Contents'
|
||||
local usrBinPath=$(joinExistingPath "$WORKFOLDER" "$contentsPath/MacOS")
|
||||
|
|
|
@ -20,7 +20,7 @@ usage () {
|
|||
deps=()
|
||||
while getopts "hb:d:" opt; do
|
||||
case $opt in
|
||||
b) base_hash="$OPTARG";;
|
||||
b) base_hash="${base_hash}${OPTARG}";;
|
||||
d)
|
||||
version=$($toolversion "$OPTARG")
|
||||
if [ $? -ne 0 ]; then
|
||||
|
|
|
@ -8,13 +8,17 @@ let
|
|||
"linux" = true;
|
||||
"" = isLinux;
|
||||
}.${target-os} or false;
|
||||
targetDarwin = {
|
||||
"macos" = true;
|
||||
"" = isDarwin;
|
||||
}.${target-os} or false;
|
||||
targetWindows = {
|
||||
"windows" = true;
|
||||
"" = isLinux;
|
||||
}.${target-os} or false;
|
||||
linuxPlatform = callPackage ./linux { };
|
||||
darwinPlatform = callPackage ./macos { };
|
||||
windowsPlatform = callPackage ./windows { };
|
||||
appimagekit = callPackage ./appimagekit { };
|
||||
linuxdeployqt = callPackage ./linuxdeployqt { inherit appimagekit; };
|
||||
|
||||
in
|
||||
{
|
||||
|
@ -22,12 +26,14 @@ in
|
|||
cmake
|
||||
extra-cmake-modules
|
||||
file
|
||||
gnupg # Used by appimagetool
|
||||
go
|
||||
] ++ lib.optional targetLinux [ appimagekit linuxdeployqt patchelf ]
|
||||
] ++ lib.optional targetLinux linuxPlatform.buildInputs
|
||||
++ lib.optional targetDarwin darwinPlatform.buildInputs
|
||||
++ lib.optional (! targetWindows) qt5.full
|
||||
++ lib.optional targetWindows windowsPlatform.buildInputs;
|
||||
shellHook = (if target-os == "windows" then "unset QT_PATH" else ''
|
||||
shellHook = (if target-os == "windows" then ''
|
||||
unset QT_PATH
|
||||
'' else ''
|
||||
export QT_PATH="${qt5.full}"
|
||||
export PATH="${stdenv.lib.makeBinPath [ qt5.full ]}:$PATH"
|
||||
'') + (lib.optionalString isDarwin ''
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{ stdenv, fetchFromGitHub
|
||||
, pkgconfig, cmake, autoconf, automake, libtool
|
||||
, wget, xxd, desktop-file-utils, file
|
||||
, glib, zlib, cairo, openssl, fuse, xz, squashfuse, inotify-tools, libarchive
|
||||
, gnupg, glib, zlib, cairo, openssl, fuse, xz, squashfuse, inotify-tools, libarchive
|
||||
, squashfsTools
|
||||
, gtest
|
||||
}:
|
||||
|
@ -70,6 +70,7 @@ in stdenv.mkDerivation rec {
|
|||
];
|
||||
|
||||
buildInputs = [
|
||||
gnupg
|
||||
glib zlib cairo openssl fuse
|
||||
xz inotify-tools libarchive
|
||||
squashfsTools
|
|
@ -0,0 +1,32 @@
|
|||
{ pkgs, stdenv, fetchurl }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "StatusImAppImage";
|
||||
version = "20181208";
|
||||
|
||||
src =
|
||||
if stdenv.hostPlatform.system == "x86_64-linux" then
|
||||
fetchurl {
|
||||
url = "https://desktop-app-files.ams3.digitaloceanspaces.com/${name}_${version}.zip";
|
||||
sha256 = "15c6p5v6325kj2whc298dn1dyigi0yzk2nzh1y10d03aqr4j8mp5";
|
||||
}
|
||||
else throw "${name} is not supported on ${stdenv.hostPlatform.system}";
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
|
||||
phases = [ "unpackPhase" ];
|
||||
unpackPhase = ''
|
||||
mkdir -p $out/src
|
||||
unzip $src -d $out/src
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "A base image for Linux Status Desktop release distributions";
|
||||
homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/;
|
||||
license = stdenv.lib.licenses.gpl3;
|
||||
maintainers = [ stdenv.lib.maintainers.pombeirp ];
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{ stdenv, pkgs }:
|
||||
|
||||
with pkgs;
|
||||
with stdenv;
|
||||
|
||||
let
|
||||
baseImage = callPackage ./base-image { };
|
||||
appimagekit = callPackage ./appimagekit { };
|
||||
linuxdeployqt = callPackage ./linuxdeployqt { inherit appimagekit; };
|
||||
|
||||
in
|
||||
{
|
||||
buildInputs = [ appimagekit linuxdeployqt patchelf baseImage ];
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
{ pkgs, stdenv, fetchurl }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "StatusImAppBundle";
|
||||
version = "20181113";
|
||||
|
||||
src =
|
||||
if stdenv.hostPlatform.system == "x86_64-darwin" then
|
||||
fetchurl {
|
||||
url = "https://desktop-app-files.ams3.digitaloceanspaces.com/Status_${version}.app.zip";
|
||||
sha256 = "0n8n6p60dwsr4q5v4vq8fffcy5qmqhp03yy95k66q4yic72r0hhz";
|
||||
}
|
||||
else throw "${name} is not supported on ${stdenv.hostPlatform.system}";
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
|
||||
phases = [ "unpackPhase" ];
|
||||
unpackPhase = ''
|
||||
mkdir -p $out/src
|
||||
unzip $src -d $out/src
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "A base image for macOS Status Desktop release distributions";
|
||||
homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/;
|
||||
license = stdenv.lib.licenses.gpl3;
|
||||
maintainers = [ stdenv.lib.maintainers.pombeirp ];
|
||||
platforms = stdenv.lib.platforms.darwin;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{ stdenv, pkgs }:
|
||||
|
||||
with pkgs;
|
||||
with stdenv;
|
||||
|
||||
let
|
||||
baseImage = callPackage ./base-image { };
|
||||
|
||||
in
|
||||
{
|
||||
buildInputs = [ baseImage ];
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
{ pkgs, stdenv, fetchurl }:
|
||||
|
||||
with pkgs;
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "StatusIm-Windows-base-image";
|
||||
version = "20181113";
|
||||
|
||||
src =
|
||||
if stdenv.hostPlatform.system == "x86_64-linux" then
|
||||
fetchurl {
|
||||
url = "https://desktop-app-files.ams3.digitaloceanspaces.com/${name}_${version}.zip";
|
||||
sha256 = "1wrxcss63zlwspmw76k549z72hcycxzd9iw4cdh98l4hs2ayzsk3";
|
||||
}
|
||||
else throw "${name} is not supported on ${stdenv.hostPlatform.system}";
|
||||
|
||||
nativeBuildInputs = [ unzip ];
|
||||
|
||||
phases = [ "unpackPhase" "installPhase" ];
|
||||
unpackPhase = ''
|
||||
mkdir -p $out/src
|
||||
unzip $src -d $out/src
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
echo $out
|
||||
ls $out -al
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "A base image for Windows Status Desktop release distributions";
|
||||
homepage = https://desktop-app-files.ams3.digitaloceanspaces.com/;
|
||||
license = stdenv.lib.licenses.gpl3;
|
||||
maintainers = [ stdenv.lib.maintainers.pombeirp ];
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
};
|
||||
}
|
|
@ -3,6 +3,10 @@
|
|||
with pkgs;
|
||||
with stdenv;
|
||||
|
||||
let
|
||||
baseImage = callPackage ./base-image { };
|
||||
|
||||
in
|
||||
{
|
||||
buildInputs = lib.optional isLinux [ conan nsis ];
|
||||
buildInputs = lib.optional isLinux [ conan nsis baseImage ];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue