From 519d4666cfd798d83921acb5db29880bbad0f2a1 Mon Sep 17 00:00:00 2001 From: Olivier Keshavjee Date: Wed, 22 Nov 2017 22:26:28 +0100 Subject: [PATCH] Updates version number and deb build script. --- .gitignore | 3 +- manuskript/version.py | 2 +- package/create_deb.sh | 65 +++++++++++++++++++++++-------------------- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index abbe884..d94acef 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ icons/Numix .idea dist build -test-projects \ No newline at end of file +test-projects +.cache diff --git a/manuskript/version.py b/manuskript/version.py index 09fff0f..e95faa7 100644 --- a/manuskript/version.py +++ b/manuskript/version.py @@ -3,7 +3,7 @@ # Single source the package version # https://packaging.python.org/guides/single-sourcing-package-version/ -__version__ = "0.5.0" +__version__ = "0.6.0" def getVersion(): return __version__ diff --git a/package/create_deb.sh b/package/create_deb.sh index f9773f0..444aea4 100755 --- a/package/create_deb.sh +++ b/package/create_deb.sh @@ -1,25 +1,28 @@ #!/bin/bash # Can take two parameters: AppVersion PkgNumber -# Default values are: 0.5.0 1 - -# Manuskript Vars -AppName=manuskript -AppVersion=${1:-0.5.0} -PkgNumber=${2:-1} -PkgVersion=$AppVersion-$PkgNumber -#PkgSizeInKb # find with: du -sk manuskript-0.5.0-1 +# If not provided, AppVersion is found in manuskript/version.py +# PkgNumber is 1. # Program vars ScriptPath="$( cd "$(dirname "$0")" ; pwd -P )" -Dest="$ScriptPath/../dist/$AppName-$PkgVersion" +Root="$ScriptPath/../" -echo Package directory: $Dest +# Manuskript Vars +AppName=manuskript +Version=$(grep -E "__version__.*\".*\"" "$Root/manuskript/version.py" \ + | cut -d\" -f2) # Look for version in manuskript/version +AppVersion=${1:-$Version} +PkgNumber=${2:-1} +PkgVersion=$AppVersion-$PkgNumber +Dest="$Root/dist/$AppName-$PkgVersion" -echo -n Creating folder structure -mkdir -p $Dest/DEBIAN -mkdir -p $Dest/usr/bin -mkdir -p $Dest/usr/share/applications +echo "Package directory: $Dest" + +echo -n "Creating folder structure" +mkdir -p "$Dest/DEBIAN" +mkdir -p "$Dest/usr/bin" +mkdir -p "$Dest/usr/share/applications" echo " [✓]" # Getting manuskript files, by downloading @@ -32,29 +35,31 @@ echo " [✓]" # Using the current direction as source -echo -n Copying manuskript content -rsync -a --exclude=.git --include="*.msk" --exclude-from=.gitignore $ScriptPath/../ $Dest/usr/share/manuskript -cp $ScriptPath/create_deb/manuskript $Dest/usr/bin/manuskript -cp $ScriptPath/create_deb/manuskript.desktop $Dest/usr/share/applications/manuskript.desktop -cp $ScriptPath/create_deb/control $Dest/DEBIAN/control +echo -n "Copying manuskript content" +rsync -a --exclude=.git --include="*.msk" --exclude-from="$Root/.gitignore" \ + "$ScriptPath/../" "$Dest/usr/share/manuskript" +cp "$ScriptPath/create_deb/manuskript" "$Dest/usr/bin/manuskript" +cp "$ScriptPath/create_deb/manuskript.desktop" \ + "$Dest/usr/share/applications/manuskript.desktop" +cp "$ScriptPath/create_deb/control" "$Dest/DEBIAN/control" -sed -i "s/{PkgVersion}/$PkgVersion/" $Dest/DEBIAN/control -PkgSizeInKb=$(du -sk $Dest | cut -f 1) -sed -i "s/{PkgSizeInKb}/$PkgSizeInKb/" $Dest/DEBIAN/control +sed -i "s/{PkgVersion}/$PkgVersion/" "$Dest/DEBIAN/control" +PkgSizeInKb=$(du -sk "$Dest" | cut -f 1) +sed -i "s/{PkgSizeInKb}/$PkgSizeInKb/" "$Dest/DEBIAN/control" echo " [✓]" -echo -n Setting permissions -chmod 0755 $Dest/usr/bin/manuskript +echo -n "Setting permissions" +chmod 0755 "$Dest/usr/bin/manuskript" echo " [✓]" -echo Your root password might now be asked to finish setting permissions: -sudo chown root:root -R $Dest +echo "Your root password might now be asked to finish setting permissions:" +sudo chown root:root -R "$Dest" -echo Creating the package… -dpkg -b $Dest +echo "Creating the package…" +dpkg -b "$Dest" -echo -n Removing build folder -sudo rm -r $Dest +echo -n "Removing build folder" +sudo rm -r "$Dest" echo " [✓]" echo Done !