Commit db40f878 authored by rgaudin's avatar rgaudin
Browse files

Merge branch 'macos-plist' into 'master'

Usable versioning

See merge request ideascube/pibox-installer!51
parents 56cfe26c 13789e5d
......@@ -23,6 +23,13 @@ matrix:
language: generic
python: 3.6.5 # just a label
install:
- PIBOX_RELEASE=$(echo $TRAVIS_TAG | grep -x 'v[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)*\(-rc[[:digit:]]\+\)\?') || true
- if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then DESTINATION="/var/www/download.kiwix.org/nightly/$(date +'%Y-%m-%d')"; else DESTINATION="/var/www/tmp.kiwix.org/ci"; fi
- BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}
- SCOMMIT=$(git rev-parse --short ${TRAVIS_COMMIT})
- if [ $PIBOX_RELEASE ]; then PIBOX_VERSION=${PIBOX_RELEASE:1}; elif [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then PIBOX_VERSION="nightly ($SCOMMIT)"; else PIBOX_VERSION="CI ($SCOMMIT)"; fi
- sed -i.bak "s/VERSION = \"devel\"/VERSION = \"${PIBOX_VERSION}\"/g" pibox-installer/data.py
# Package pibox-installer
- brew update
# checking our formulas out to how they were when python 3.6.5 was around
......@@ -56,14 +63,12 @@ matrix:
# Install and run create-dmg
- npm install --global create-dmg@2.0.0 --python=python2.7
- create-dmg dist/kiwix-plug_installer.app || true
- mv kiwix-plug_installer-0.0.0.dmg kiwix-plug_installer-macos.dmg
- mv kiwix-plug_installer-*.dmg kiwix-plug_installer-macos.dmg
# Send dmg
- if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then DESTINATION="/var/www/download.kiwix.org/nightly/$(date +'%Y-%m-%d')"; else DESTINATION="/var/www/tmp.kiwix.org/ci"; fi
- BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}
- scp -v -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa kiwix-plug_installer-macos.dmg nightlybot@download.kiwix.org:$DESTINATION/kiwix-plug_installer-macos-$BRANCH.dmg
- PIBOX_RELEASE=$(echo $TRAVIS_TAG | grep -x 'v[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)*\(-rc[[:digit:]]\+\)\?') || true
- if [ $PIBOX_RELEASE ]; then mkdir -p releases/$PIBOX_RELEASE; cp kiwix-plug_installer-macos.dmg releases/$PIBOX_RELEASE/; scp -r -v -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa releases/$PIBOX_RELEASE nightlybot@download.kiwix.org:/var/www/download.kiwix.org/release/kiwix-plug_installer/; fi
- os: linux
......@@ -90,6 +95,13 @@ matrix:
python3-dev
libgdk-pixbuf2.0-dev
script:
- PIBOX_RELEASE=$(echo $TRAVIS_TAG | grep -x 'v[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)*\(-rc[[:digit:]]\+\)\?') || true
- if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then DESTINATION="/var/www/download.kiwix.org/nightly/$(date +'%Y-%m-%d')"; else DESTINATION="/var/www/tmp.kiwix.org/ci"; fi
- BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}
- SCOMMIT=$(git rev-parse --short ${TRAVIS_COMMIT})
- if [ $PIBOX_RELEASE ]; then PIBOX_VERSION=${PIBOX_RELEASE:1}; elif [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then PIBOX_VERSION="nightly ($SCOMMIT)"; else PIBOX_VERSION="CI ($SCOMMIT)"; fi
- sed -i.bak "s/VERSION = \"devel\"/VERSION = \"${PIBOX_VERSION}\"/g" pibox-installer/data.py
# update XZ (trusty version -5.0.5 is too old)
- wget http://download.kiwix.org/dev/xz-5.2.4.tar.gz
- tar xf xz-5.2.4.tar.gz
......@@ -123,9 +135,5 @@ matrix:
- cd ..
# Deploy
- if [ "$TRAVIS_EVENT_TYPE" = "cron" ]; then DESTINATION="/var/www/download.kiwix.org/nightly/$(date +'%Y-%m-%d')"; else DESTINATION="/var/www/tmp.kiwix.org/ci"; fi
- BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}
- scp -v -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa dist/kiwix-plug_installer-linux.tar.gz nightlybot@download.kiwix.org:$DESTINATION/kiwix-plug_installer-linux-$BRANCH.tar.gz
- PIBOX_RELEASE=$(echo $TRAVIS_TAG | grep -x 'v[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)*\(-rc[[:digit:]]\+\)\?') || true
- if [ $PIBOX_RELEASE ]; then mkdir -p releases/$PIBOX_RELEASE; cp dist/kiwix-plug_installer-linux.tar.gz releases/$PIBOX_RELEASE; scp -r -v -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa releases/$PIBOX_RELEASE nightlybot@download.kiwix.org:/var/www/download.kiwix.org/release/kiwix-plug_installer/; fi
......@@ -16,14 +16,35 @@ platform:
install:
- set PATH=C:\Program Files (x86)\Windows Kits\10\bin\%platform%\;%PATH%
# send all non-release build to tmp.kiwix.org except cron to nightly folder
- ps: if ($env:APPVEYOR_SCHEDULED_BUILD -eq "true") { "/var/www/download.kiwix.org/nightly/" | Out-File C:\destination-ps.txt -NoNewline -Encoding ASCII; Get-Date -UFormat "%Y-%m-%d" | Out-File C:\destination-ps.txt -Append -NoNewline -Encoding ASCII } else { "/var/www/tmp.kiwix.org/ci" | Out-File C:\destination-ps.txt -NoNewline -Encoding ASCII }
# store branch name
- if defined APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH (echo %APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH% > branch.txt) else (echo %APPVEYOR_REPO_BRANCH% > branch.txt)
- move branch.txt C:\msys64\home\appveyor\
# store tag name
- if defined APPVEYOR_REPO_TAG_NAME (echo %APPVEYOR_REPO_TAG_NAME% > C:\msys64\home\appveyor\tag.txt)
# build-up version
- ps: |
$scommit = (git rev-parse --short $env:APPVEYOR_REPO_COMMIT) | Out-String
$scommit = $scommit.Trim()
If ($env:APPVEYOR_REPO_TAG_NAME) {
$version = $env:APPVEYOR_REPO_TAG_NAME.Substring(1)
} Elseif ($env:APPVEYOR_SCHEDULED_BUILD -eq "true") {
$version="nightly (" + $scommit + ")"
} Else {
$version="CI (" + $scommit + ")"
}
(Get-Content pibox-installer\data.py).replace('devel', $version) | Set-Content pibox-installer\data.py
# decrypt certificates
- cmd: choco install openssl.light
- openssl enc -d -aes-256-cbc -md sha256 -pass pass:%win_certificate_secret% -in kiwix.p12.enc -out kiwix.pfx
- nuget install secure-file -ExcludeVersion
- nuget install ResourceHacker.CommandLineTool -ExcludeVersion
- secure-file\tools\secure-file -decrypt pibox_installer_ci_rsa.appveyor_enc -secret %certificate_secret% -out pibox_installer_ci_rsa
- ResourceHacker.CommandLineTool\tools\ResourceHacker.exe -help
# Download pibox-installer-vexpress-boot
- appveyor DownloadFile "http://download.kiwix.org/dev/pibox-installer-vexpress-boot.zip"
......@@ -77,8 +98,10 @@ install:
# bundle 7zip
- mkdir "C:\Program Files\7zextra"
- cd "C:\Program Files\7zextra"
- appveyor DownloadFile "https://www.7-zip.org/a/7z920_extra.7z"
- 7z.exe x 7z920_extra.7z
- appveyor DownloadFile "https://www.7-zip.org/a/7z1805-extra.7z"
- 7z.exe x 7z1805-extra.7z
- 7z.exe -y x 7z1805-extra.7z
# Copy Imdisk Installer
- mkdir "C:\Program Files\imdiskinst"
......@@ -97,7 +120,18 @@ install:
# Deploy
- cd C:\projects\pibox-installer\dist\kiwix-plug_installer
- 7z.exe a -m0=Copy C:\projects\pibox-installer\windows_bundle\kiwix-plug_installer.exe *
- 7z.exe a -m0=Copy C:\projects\pibox-installer\windows_bundle\kiwix-plug_installer.7z *
# download tools
- cd C:\projects\pibox-installer\windows_bundle\
- appveyor DownloadFile "http://download.kiwix.org/dev/GoRC.exe" -FileName "GoRC.exe"
# create SFX exe from 7z archive
- copy /b "C:\Program Files\7zextra\7zS.sfx" + sfxconfig.txt + kiwix-plug_installer.7z kiwix-plug_installer.exe
# change icon and add version info to exe
- GoRC.exe /fo resources.res resources.rc
- copy ..\pibox-installer-logo.ico icon.ico
- c:\projects\pibox-installer\ResourceHacker.CommandLineTool\tools\ResourceHacker.exe -script reshack.txt
- cd C:\projects\pibox-installer\dist\kiwix-plug_installer
# sign the build
- signtool.exe sign /f C:\projects\pibox-installer\kiwix.pfx /p %win_certificate_password% /t http://timestamp.verisign.com/scripts/timstamp.dll /d "Kiwix-plug installer" C:\projects\pibox-installer\windows_bundle\kiwix-plug_installer.exe
......@@ -106,10 +140,7 @@ install:
- if %platform%==x64 move C:\projects\pibox-installer\windows_bundle\kiwix-plug_installer.exe C:\msys64\home\appveyor\kiwix-plug_installer-win64.exe
- move C:\projects\pibox-installer\pibox_installer_ci_rsa C:\msys64\home\appveyor\
- if defined APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH (echo %APPVEYOR_PULL_REQUEST_HEAD_REPO_BRANCH% > branch.txt) else (echo %APPVEYOR_REPO_BRANCH% > branch.txt)
- move branch.txt C:\msys64\home\appveyor\
- if %platform%==x86 C:\msys64\usr\bin\bash --login -c "DESTINATION=$(cat /c/destination-ps.txt | tr -d '\r' | tr -d '\n') ; scp -r -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa kiwix-plug_installer-win32.exe nightlybot@download.kiwix.org:$DESTINATION/kiwix-plug_installer-win32-$(cat branch.txt | sed 's/ //g').exe"
- if %platform%==x64 C:\msys64\usr\bin\bash --login -c "DESTINATION=$(cat /c/destination-ps.txt | tr -d '\r' | tr -d '\n') ; scp -r -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa kiwix-plug_installer-win64.exe nightlybot@download.kiwix.org:$DESTINATION/kiwix-plug_installer-win64-$(cat branch.txt | sed 's/ //g').exe"
- if defined APPVEYOR_REPO_TAG_NAME (echo %APPVEYOR_REPO_TAG_NAME% > C:\msys64\home\appveyor\tag.txt)
- C:\msys64\usr\bin\bash --login -c "PIBOX_RELEASE=$(cat tag.txt | sed 's/ //g' | grep -x 'v[[:digit:]]\+.[[:digit:]]\+\(.[[:digit:]]\+\)*\(-rc[[:digit:]]\+\)\?') || true; if [ $PIBOX_RELEASE ]; then mkdir -p releases/$PIBOX_RELEASE/; cp kiwix-plug_installer-win*.exe releases/$PIBOX_RELEASE/; scp -r -o StrictHostKeyChecking=no -i pibox_installer_ci_rsa releases/$PIBOX_RELEASE nightlybot@download.kiwix.org:/var/www/download.kiwix.org/release/kiwix-plug_installer/; fi"
# -*- mode: python -*-
import os
import sys
import subprocess
sys.path += [os.path.join(os.getcwd(), 'pibox-installer')]
from version import get_version_str, get_short_version_str
output = subprocess.check_output(["ls", "qemu"])
files = output.decode('utf-8').splitlines()
......@@ -41,4 +45,10 @@ coll = COLLECT(exe,
app = BUNDLE(coll,
name='kiwix-plug_installer.app',
icon='pibox-installer-logo.icns',
bundle_identifier='org.kiwix.plug')
bundle_identifier='org.kiwix.plug',
info_plist={
'CFBundleDisplayName': 'Kiwix-plug installer',
'CFBundleShortVersionString': get_version_str(),
'CFBundleVersion': get_short_version_str(),
'NSHumanReadableCopyright': 'Kiwix'
})
# -*- mode: python -*-
import os
import sys
import site
sys.path += [os.path.join(os.getcwd(), 'pibox-installer')]
from version import get_version_str, get_short_version_str
# update version number for exe metadata
rsc = os.path.join('windows_bundle', 'resources.rc')
with open(rsc, 'r') as f:
content = f.read().replace("VERSION_TUPLE", get_short_version_str(",")) \
.replace("VERSION_STR", get_version_str())
with open(rsc, 'w') as f:
f.write(content)
block_cipher = None
typelib_path = os.path.join(site.getsitepackages()[1], 'gnome', 'lib', 'girepository-1.0')
......
# -*- mode: python -*-
import os
import sys
import site
sys.path += [os.path.join(os.getcwd(), 'pibox-installer')]
from version import get_version_str, get_short_version_str
# update version number for exe metadata
rsc = os.path.join('windows_bundle', 'resources.rc')
with open(rsc, 'r') as f:
content = f.read().replace("VERSION_TUPLE", get_short_version_str(",")) \
.replace("VERSION_STR", get_version_str())
with open(rsc, 'w') as f:
f.write(content)
block_cipher = None
typelib_path = os.path.join(site.getsitepackages()[1], 'gnome', 'lib', 'girepository-1.0')
......
......@@ -36,3 +36,5 @@ ideascube_languages = [
]
help_url = "https://framagit.org/ideascube/pibox-installer/wikis/faq"
VERSION = "devel"
......@@ -14,6 +14,7 @@ import tempfile
import threading
from util import CancelEvent, ProgressHelper
import sd_card_info
from version import get_version_str
from util import human_readable_size, ONE_GB, ONE_MiB
from util import get_free_space_in_dir
from util import relpathto
......@@ -270,6 +271,7 @@ class Application:
# about dialog
self.component.about_dialog.set_logo(GdkPixbuf.Pixbuf.new_from_file_at_scale(data.pibox_logo, 200, -1, True))
self.component.about_dialog.set_version(get_version_str())
# done window
self.component.done_window_ok_button.connect("clicked", lambda widget: self.component.done_window.hide())
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from data import VERSION
def get_version_str():
''' human-readable version '''
return VERSION
def get_short_version_str(separator="."):
''' string version based on the tuple one (no extra) '''
return separator.join([str(x) for x in get_version_tuple()])
def get_version_tuple():
''' 2 digits tuple version information
VERSION can be:
devel: default for source repo.
CI (ZZZ): any CI build (ZZZ is commit short ref)
nightly (ZZZ): for nightlies of the master
A.B: for regular releases
A.B-xxx: for special releases (rc, beta, etc) '''
if VERSION[0].isdigit():
parts = VERSION.split('-', 1)
return tuple([int(x) for x in parts[0].split(".")[:2]])
else:
return (2, 0)
......@@ -1463,7 +1463,7 @@ In File mode the image is created at build path, you can choose the size
<property name="type_hint">dialog</property>
<property name="transient_for">window</property>
<property name="program_name">Kiwix-plug installer</property>
<property name="version">nightly</property>
<property name="version">devel</property>
<property name="website">https://framagit.org/ideascube/pibox-installer</property>
<property name="logo_icon_name">image-missing</property>
<property name="license_type">gpl-3-0</property>
......
This directory contains files for windows bundling.
* pibox-installer-sfx-conf.txt: the configuration for 7z SFX Builder
* kiwix-plug_installer.exe: a self extracting empty archive generated with 7z sfx builder using 7zS.sfx.
program run is launcher.exe
* resources.rc: source configuration of exe meta data
* sfxconfig.txt: configuration for 7z SFX creation
* reshack.txt: ResoucesHacker script to insert metadata and icon into exe
;!@Install@!UTF-8!
Title="Kiwix-plug installer"
MiscFlags="4"
RunProgram="launcher.exe"
;Config file generated by 7z SFX Builder v2.1. (http://sourceforge.net/projects/s-zipsfxbuilder/)
;!@InstallEnd@!
7zSFXBuilder_7zArchive=C:\Users\user\Desktop\empty_file.7z
7zSFXBuilder_SFXName=C:\Users\user\Desktop\kiwix-plug_installer.exe
7zSFXBuilder_SFXIcon=C:\Users\user\Pictures\pibox-installer-logo.ico
7zSFXBuilder_UseDefMod=7zsd_All
7zSFXBuilder_UPXCommands=--ultra-brute
7zSFXBuilder_Res_FileVersion=
7zSFXBuilder_Res_CompanyName=Kiwix
7zSFXBuilder_Res_Comments=
7zSFXBuilder_Res_FileDescription=
7zSFXBuilder_Res_ProductVersion=
7zSFXBuilder_Res_ProductName=Kiwix-plug installer
7zSFXBuilder_Res_LegalCopyright=
7zSFXBuilder_Res_LegalTrademarks=
7zSFXBuilder_Res_InternalName=
7zSFXBuilder_Res_OriginalFileName=
7zSFXBuilder_Res_SpecialBuild=
7zSFXBuilder_Res_PrivateBuild=
[FILENAMES]
Exe= kiwix-plug_installer.exe
SaveAs= kiwix-plug_installer.exe
Log= CONSOLE
[COMMANDS]
-addoverwrite icon.ico, ICONGROUP,MAINICON,0
-addoverwrite resources.res,,,
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION VERSION_TUPLE,0,0
{
BLOCK "StringFileInfo"
{
BLOCK "040904b0"
{
VALUE "CompanyName", "Kiwix\0"
VALUE "FileDescription", "Kiwix-plug installer\0"
VALUE "FileVersion", "1.0.0.0\0"
VALUE "LegalCopyright", "Association Kiwix\0"
VALUE "OriginalFilename", "kiwix-plug_installer.exe\0"
VALUE "ProductName", "Kiwix-plug installer\0"
VALUE "ProductVersion", "VERSION_STR\0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x409, 1200
}
}
;!@Install@!UTF-8!
Title="Kiwix-plug installer"
MiscFlags="4"
RunProgram="launcher.exe"
;!@InstallEnd@!
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment