gnucash-on-flatpak master: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Mon Dec 30 06:47:44 EST 2019


Updated	 via  https://github.com/Gnucash/gnucash-on-flatpak/commit/9e470487 (commit)
	 via  https://github.com/Gnucash/gnucash-on-flatpak/commit/1af2580d (commit)
	 via  https://github.com/Gnucash/gnucash-on-flatpak/commit/5dce9101 (commit)
	from  https://github.com/Gnucash/gnucash-on-flatpak/commit/9f194435 (commit)



commit 9e470487c7043ba41f153ad9ac5ad1083d5c770d
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Mon Dec 30 12:47:36 2019 +0100

    Drop a bit of old, commented-out code

diff --git a/functions.sh b/functions.sh
index ad782b4..16fa8d3 100644
--- a/functions.sh
+++ b/functions.sh
@@ -140,15 +140,7 @@ function get_versions()
 {
   echo "Extracting version numbers for package $package"
   pushd "${repodir}"
-  # code uses cmake, docs is still on autotools...
-  #if [ -e CMakeLists.txt ]
-  #then
-  #  gc_version=$(grep '(PACKAGE_VERSION ' CMakeLists.txt | perl -pe 's/.*([0-9]+\.[0-9]+).*\)/$1/ge')
-  #else
-  #  gc_version=$(grep AC_INIT configure.ac | perl -pe 's/.*([0-9]+\.[0-9]+).*\)/$1/ge')
-  #fi
   gc_commit=$(git reflog | head -n1 | awk '{print $1}')
-  #gc_full_version=${gc_version}-nightly.git.${gc_commit}
   gc_full_version=$(git describe)
   popd
 }

commit 1af2580dae391db2589d52671940d5c65cd7427f
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Mon Dec 30 12:42:36 2019 +0100

    Fine tune build script to handle releases where release tags for gnucash and gnucash-docs differ
    
    For example there can be a gnucash 3.8b tag with a gnucash-docs 3.8 tag.
    The way to invoke the script for this is
    build-package.sh -r3.8 -c3.8b -d3.8
    or even
    build-package.sh -r3.8 -c3.8b
    
    The value of -r serves as both
    - the default for -c and -d
    - the sourceforge directory name containing the tarballs.
    
    So the main constraint for release tarballs now is that the tarballs must live
    in the same sourceforge directory.
    
    Notes:
    * if the release tag is the same for gnucash, gnucash-docs and the directory
    (the ideal case), the command can be simplified even more:
    build-package.sh -r3.7
    * for development (nightly) builds the directory restriction doesn't apply. For
    such builds you are free to use -c, -d and -r as you see fit. -r only serves
    as default for -c and -d in that scenario.

diff --git a/build_package.sh b/build_package.sh
index 4ac7df4..27fa55b 100755
--- a/build_package.sh
+++ b/build_package.sh
@@ -36,11 +36,17 @@ revision=maint
 . "$fp_git_dir"/functions.sh
 
 # Parse command line options
-while getopts "hr:" o; do
+while getopts "hr:c:d:" o; do
     case "${o}" in
         r)
             revision=${OPTARG}
             ;;
+        c)
+            code_revision=${OPTARG}
+            ;;
+        d)
+            docs_revision=${OPTARG}
+            ;;
         h)
             usage
             ;;
@@ -51,6 +57,8 @@ while getopts "hr:" o; do
 done
 
 is_release="undecided"
+code_revision=${code_revision:-${revision}}
+docs_revision=${docs_revision:-${revision}}
 
 # Set up logging
 local_log_dir="$base_dir/logs"
@@ -72,7 +80,7 @@ trap cleanup ERR
 # Check for new commits in code
 package=${code_package}
 repodir=${code_repodir}
-prepare_repo
+prepare_repo ${code_revision}
 get_versions
 
 code_curr_rev=${gc_commit}
@@ -81,22 +89,22 @@ code_full_version=${gc_full_version}
 # Check for new commits in docs
 package=${docs_package}
 repodir=${docs_repodir}
-prepare_repo
+prepare_repo ${docs_revision}
 get_versions
 
 docs_curr_rev=${gc_commit}
 docs_full_version=${gc_full_version}
 
-# Simplify flatpak package version if code and docs are on the same full_version
-# In practice this only happens when a tag is checked out, so as the code
-# is currently written this means it only happens for release builds
-if [[ "$code_full_version" == "$docs_full_version" ]]
+# Compose the default branch name to use in the flatpak repo
+fp_branch="$revision-C$code_full_version-D$docs_full_version"
+
+# Release builds start from tarballs and need checksums for the manifest
+if [[ "${is_release}" == "yes" ]]
 then
-    fp_branch="$code_full_version"
     build_type=tar
+    fp_branch="$revision"
     get_checksums
 else
-    fp_branch="$revision-C$code_full_version-D$docs_full_version"
     build_type=git
 fi
 
diff --git a/functions.sh b/functions.sh
index 2194c16..ad782b4 100644
--- a/functions.sh
+++ b/functions.sh
@@ -10,15 +10,48 @@ function cleanup()
 function usage()
 {
   {
-    echo "Usage: $0 [-r <revision>] [-u <remote>]"
+    echo "Usage: $0 [-c <revision>] [-d <revision>] [-r <revision>]"
     echo "       $0 -h"
     echo
     echo "-h          display this help message"
     echo
+    echo "-c revision gnucash git revision to build. Can be a branch or a tag."
+    echo "            Default: whatever is set with -r or 'maint' if -' was not specified"
+    echo "-d revision gnucash-docs git revision to build. Can be a branch or a tag."
+    echo "            Default: whatever is set with -r or 'maint' if -' was not specified"
     echo "-r revision git revision to build. Can be a branch or a tag."
-    echo "            Note this branch or tag should exist in both the gnucash"
-    echo "            and the gnucash-docs repository used for this build."
+    echo "            Can be used in multiple ways: if -c or -d options are omitted"
+    echo "            the value of -r is used as default instead."
+    echo "            If both -c and -d refer to a release tag, the value of -r will be used"
+    echo "            additionally as name of the directory that holds the release tarballs"
+    echo "            on sourceforge. This allows to handle situations where this directory name"
+    echo "            is different from the release tarball versions."
     echo "            Default: 'maint'"
+    echo
+    echo "Examples:"
+    echo
+    echo "  $0 -r master"
+    echo
+    echo "    Create a development flatpak for the current master branches of gnucash and gnucash-docs"
+    echo
+    echo "  $0 -r 3.7"
+    echo
+    echo "    Create a release flatpak for the gnucash 3.7. This will look for tarballs on sourceforge"
+    echo "    for gnucash 3.7 and gnucash-docs 3.7 in directory 3.7"
+    echo
+    echo "  $0 -r 3.8 -c3.8b"
+    echo
+    echo "    Create a release flatpak with tarballs taken from sourceforge"
+    echo "    for gnucash 3.8 and gnucash-docs 3.8b in directory 3.8"
+    echo
+    echo "Note:"
+    echo "  If you want to create a release flatpak, you will always want to set at least -r."
+    echo "  That tells the scripts in which sourceforge directory to look for tarballs."
+    echo "  If the tarballs have slightly different version numbers (due to release process internals)"
+    echo "  you can add -c or -d to specify those."
+    echo "  For development builds (that is, from git) you are free to mix and match"
+    echo "  the 3 options as you see fit. In this case -r only serves as a default value"
+    echo "  for the other two."
   } 1>&2
   exit 1
 }
@@ -72,22 +105,33 @@ function upload_build_log()
   fi
 }
 
+# Updates repo to repo_rev
+# Then checks whether repo_rev is a tag
+# If not a tag, reset repo to repo_rev
+# Caller should pass repo_rev as first parameter
 function prepare_repo()
 {
+  repo_rev=$1
   pushd "${repodir}"
   echo "Update repository $repodir"
   git fetch
-  git checkout $revision
-  if git tag | grep -q "^$revision\$"
+  git checkout $repo_rev
+  if git tag | grep -q "^$repo_rev\$"
   then
     echo "Detected a tag (release) build"
-    is_release="yes"
-    remote_branch_dir="releases"
+    if [[ "${is_release}" == "no" ]]
+    then
+        echo "However a previously checked repository is not set up for release builds. Falling back to development build."
+        remote_branch_dir=$repo_rev
+    else
+        is_release="yes"
+        remote_branch_dir="releases"
+    fi
   else
     echo "No tag detected, assuming development build"
     is_release="no"
-    remote_branch_dir=$revision
-    git reset --hard origin/$revision
+    remote_branch_dir=$repo_rev
+    git reset --hard origin/$repo_rev
   fi
   popd
 }
@@ -112,8 +156,8 @@ function get_versions()
 function get_checksums()
 {
   wget "http://downloads.sourceforge.net/gnucash/gnucash (stable)/${revision}/README.txt" -O "${base_dir}"/README.txt
-  code_checksum=$(awk "/gnucash-${revision}.tar.bz2/ { print \$1;}" "${base_dir}"/README.txt)
-  docs_checksum=$(awk "/gnucash-docs-${revision}.tar.gz/ { print \$1;}" "${base_dir}"/README.txt)
+  code_checksum=$(awk "/gnucash-${code_revision}.tar.bz2/ { print \$1;}" "${base_dir}"/README.txt)
+  docs_checksum=$(awk "/gnucash-docs-${docs_revision}.tar.gz/ { print \$1;}" "${base_dir}"/README.txt)
 }
 
 function prepare_gpg()
@@ -144,7 +188,7 @@ function create_manifest()
   echo "Writing org.gnucash.GnuCash.json manifest file"
 
   # Export environment variables used in the templates in order for envsubst to find them
-  export code_repodir docs_repodir code_checksum docs_checksum revision
+  export code_repodir docs_repodir code_checksum docs_checksum revision code_revision docs_revision
 
   # In the functions below build_type selects the proper templates to initiate
   # a git or a tar build. build_type is determined earlier in build_package.sh
@@ -157,7 +201,7 @@ function create_manifest()
       # Note the variable names passed to envsubst:
       # this limits the set of variables envsubst will effectively substitute
       # We do this to prevent colisions with flatpak variables in the manifest
-      gnucash_targets=$(envsubst '$code_repodir $docs_repodir $revision $code_checksum $docs_checksum' \
+      gnucash_targets=$(envsubst '$code_repodir $docs_repodir $code_revision $docs_revision $revision $code_checksum $docs_checksum' \
                         < "$fp_git_dir"/templates/gnucash-targets-${build_type}.json.tpl)
   fi
   export extra_deps gnucash_targets
diff --git a/templates/gnucash-targets-git.json.tpl b/templates/gnucash-targets-git.json.tpl
index 84e1aa3..17a2a33 100644
--- a/templates/gnucash-targets-git.json.tpl
+++ b/templates/gnucash-targets-git.json.tpl
@@ -19,7 +19,7 @@
         {
           "type": "git",
           "path": "${code_repodir}",
-          "branch": "${revision}"
+          "branch": "${code_revision}"
         }
       ]
     },
@@ -29,7 +29,7 @@
         {
           "type": "git",
           "path": "${docs_repodir}",
-          "branch": "${revision}"
+          "branch": "${docs_revision}"
         }
       ]
     }
diff --git a/templates/gnucash-targets-tar.json.tpl b/templates/gnucash-targets-tar.json.tpl
index 8ecff76..567b73f 100644
--- a/templates/gnucash-targets-tar.json.tpl
+++ b/templates/gnucash-targets-tar.json.tpl
@@ -18,7 +18,7 @@
       "sources": [
       {
           "type": "archive",
-          "url": "http://downloads.sourceforge.net/gnucash/gnucash (stable)/${revision}/gnucash-${revision}.tar.bz2",
+          "url": "http://downloads.sourceforge.net/gnucash/gnucash (stable)/${revision}/gnucash-${code_revision}.tar.bz2",
           "sha256": "${code_checksum}"
         }
       ]
@@ -28,7 +28,7 @@
       "sources": [
         {
           "type": "archive",
-          "url": "http://downloads.sourceforge.net/gnucash/gnucash-docs/gnucash-docs-${revision}.tar.gz",
+          "url": "http://downloads.sourceforge.net/gnucash/gnucash (stable)/${revision}/gnucash-docs-${docs_revision}.tar.gz",
           "sha256": "${docs_checksum}"
         }
       ]

commit 5dce91011499b80d9295aac80a310811b80eac07
Author: Geert Janssens <geert at kobaltwit.be>
Date:   Mon Dec 30 10:00:02 2019 +0100

    Update to gnome runtime 3.34

diff --git a/templates/org.gnucash.GnuCash.json.tpl b/templates/org.gnucash.GnuCash.json.tpl
index 2ac6081..0d2f1bf 100644
--- a/templates/org.gnucash.GnuCash.json.tpl
+++ b/templates/org.gnucash.GnuCash.json.tpl
@@ -1,7 +1,7 @@
 {
   "app-id": "org.gnucash.GnuCash",
   "runtime": "org.gnome.Platform",
-  "runtime-version": "3.32",
+  "runtime-version": "3.34",
   "sdk": "org.gnome.Sdk",
   "command": "gnucash",
   "copy-icon": true,



Summary of changes:
 build_package.sh                       | 26 ++++++++----
 functions.sh                           | 78 +++++++++++++++++++++++++---------
 templates/gnucash-targets-git.json.tpl |  4 +-
 templates/gnucash-targets-tar.json.tpl |  4 +-
 templates/org.gnucash.GnuCash.json.tpl |  2 +-
 5 files changed, 79 insertions(+), 35 deletions(-)



More information about the gnucash-changes mailing list