gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 235b156 2/2: Uploading distribution files to s


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 235b156 2/2: Uploading distribution files to server in developer-build
Date: Wed, 30 May 2018 09:05:26 -0400 (EDT)

branch: master
commit 235b15620f6eb2bee7627ee3fa8cf889737513c6
Author: Mohammad Akhlaghi <address@hidden>
Commit: Mohammad Akhlaghi <address@hidden>

    Uploading distribution files to server in developer-build
    
    One common operation of a developer is to keep prepared tarballs of the
    latest release (for bug fixes for example). With this commit, a new
    `--tar-pdf-upload' (`-u') option has been added to `developer-build' to
    simplify that job.
---
 developer-build   | 72 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 doc/gnuastro.texi | 10 ++++++++
 2 files changed, 74 insertions(+), 8 deletions(-)

diff --git a/developer-build b/developer-build
index b4b7ebd..6569827 100755
--- a/developer-build
+++ b/developer-build
@@ -29,12 +29,20 @@
 
 
 
+# Exit the script if any of the commands fail
+set -e
+
+
+
+
+
 # Default values for variables.
 jobs=8
 debug=0
 clean=0
 check=0
 install=0
+tar_pdf_upload=0
 top_build_dir=/dev/shm
 if [ -f .version ]; then
     version=$(cat .version)
@@ -78,6 +86,13 @@ help_print() {
         install_status="ENABLED"
     fi
 
+    # See if tar_pdf_upload is enabled or not.
+    if [ $tar_pdf_upload = "0" ]; then
+        tpu_status="DISABLED"
+    else
+        tpu_status="ENABLED"
+    fi
+
     # Print the output.
     cat <<EOF
 
@@ -98,7 +113,7 @@ Options:
                           build directory name.
                           Current value: $version
 
- -c, --clean              Delete (with `rm') all its contents of the build
+ -c, --clean              Delete (with 'rm') all its contents of the build
                           directory before starting new configuration.
                           Current status: $clean_status
 
@@ -113,12 +128,17 @@ Options:
  -C, --check              Run 'make check' after the build.
                           Current status: $check_status
 
- -i, --install            Run `sudo make install' after the build.
+ -i, --install            Run 'sudo make install' after the build.
                           Current status: $install_status
 
- -P, --printparams        Another name for `--help', for similarity with
+ -u, --tar-pdf-upload STR Build a tar.lz tarball and PDF manual, then
+                          upload them to the given server:folder.
+                          For example: -u my-server:folder
+                          Current status: $tpu_status
+
+ -P, --printparams        Another name for '--help', for similarity with
                           Gnuastro's programs. Note that the output of
-                          `--help' also includes the variable values.
+                          '--help' also includes the variable values.
 
  -h, --help               Print this help list.
 
@@ -142,6 +162,10 @@ do
     case $key in
         -b|--top-build-dir)
             top_build_dir="$2"
+            if [ x"top_build_dir" = x ]; then
+                echo "No argument given to '--top-build-dir' ('-b')."
+                exit 1;
+            fi
             shift # past argument
             shift # past value
             ;;
@@ -159,6 +183,10 @@ do
             ;;
         -j|--jobs)
             jobs="$2"
+            if [ x"jobs" = x ]; then
+                echo "No argument given to '--jobs' ('-j')."
+                exit 1;
+            fi
             shift # past argument
             shift # past value
             ;;
@@ -170,6 +198,16 @@ do
             install=1
             shift # past argument
             ;;
+        -u|--tar-pdf-upload)
+            tar_pdf_upload=1
+            url="$2"
+            if [ x"$url" = x ]; then
+                echo "No argument given to '--tar-pdf-upload' ('-u')."
+                exit 1;
+            fi
+            shift # past argument
+            shift # past value
+            ;;
         -h|-P|--help|--printparams)
             help_print
             exit 0
@@ -281,8 +319,8 @@ cd $build_dir
 # shared libraries can be a pain when debuggin. For this reason,
 # compilation of shared libraries can be turned off by specifying the
 # --disable-shared option to configure. With static libraries, compilation
-# (the `make' command) will also significantly speed up. Also, by default
-# (in `configure.ac'), we have set optimization flags which have to be
+# (the 'make' command) will also significantly speed up. Also, by default
+# (in 'configure.ac'), we have set optimization flags which have to be
 # cancelled in debugging.
 if [ ! -f Makefile ]; then
     if [ x$debug = x1 ]; then
@@ -303,7 +341,7 @@ make -kj$jobs
 
 
 
-# If requested, also run `make check'.
+# If requested, also run 'make check'.
 if [ x$check = x1 ]; then
     make check -kj$jobs
 fi
@@ -312,7 +350,25 @@ fi
 
 
 
-# If requested, also run `sudo make install'.
+# If requested, also run 'sudo make install'.
 if [ x$install = x1 ]; then
     sudo make install -kj$jobs
 fi
+
+
+
+
+
+# Build a tarball, and upload it to the requested server.
+if [ x$tar_pdf_upload = x1 ]; then
+
+    # Make the distribution tarball and pdf manual.
+    make dist-lzip pdf
+
+    # Get the base package name, and use it to make a generic tarball name.
+    base=$(ls *.tar.lz | sed -e's/-/ /' | awk '{print $1}')
+    mv *.tar.lz $base"-latest.tar.lz"
+
+    # Copy the files to the given URL (must include folders).
+    scp $base"-latest.tar.lz" doc/$base.pdf $url
+fi
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index e8f9ba5..c1d7fd7 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -6215,6 +6215,16 @@ checks to work on (for example defined in 
@file{tests/during-dev.sh}).
 @itemx --install
 After finishing the build, also run @command{make install}.
 
address@hidden -u STR
address@hidden --tar-pdf-upload STR
+After finishing the build, run @command{make dist-lzip pdf} to build an
+Lzip tarball and pdf manual. Then rename the tarball suffix to
address@hidden (instead of the version number). Then use secure copy
+(@command{scp}, part of the SSH tools) to copy the tarball and PDF to the
+server and directory specified in the value to this option. For example
address@hidden my-server:dir}, will copy the two files to the
address@hidden directory of @code{my-server}.
+
 @item -h
 @itemx --help
 @itemx -P



reply via email to

[Prev in Thread] Current Thread [Next in Thread]