[Debian-astro-commits] [cspice] 05/11: d/repack: Add script
Rock Storm
rockstorm-guest at moszumanska.debian.org
Sun Apr 23 17:34:47 UTC 2017
This is an automated email from the git hooks/post-receive script.
rockstorm-guest pushed a commit to branch debian
in repository cspice.
commit 69a8dd8f6061967b1eb2f9a92cc0c434d5747104
Author: Rock Storm <rockstorm at gmx.com>
Date: Sun Apr 23 11:01:55 2017 +0200
d/repack: Add script
---
debian/README.source | 7 ++--
debian/repack | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++
debian/watch | 6 ++--
3 files changed, 104 insertions(+), 4 deletions(-)
diff --git a/debian/README.source b/debian/README.source
index 220f4a5..ee39d14 100644
--- a/debian/README.source
+++ b/debian/README.source
@@ -22,8 +22,11 @@ produced by direct translation and are left as is:
Moreover upstream distributes source code and compiled binaries, all together.
This binaries are removed for compliance with the DFSG. Besides, upstream
-replicates the very same header files through different subfolder, these are
+replicates the very same header files through different subfolders, these are
also removed for the sake of simplicity.
- -- Rock Storm <rockstorm at gmx.com> Mon, 20 Mar 2017 18:48:04 +0100
+The construction of the "upstream tarball" is made using the script
+debian/repack.
+
+ -- Rock Storm <rockstorm at gmx.com> Sat, 15 Apr 2017 11:54:12 +0200
diff --git a/debian/repack b/debian/repack
new file mode 100644
index 0000000..ad08706
--- /dev/null
+++ b/debian/repack
@@ -0,0 +1,95 @@
+#! /bin/bash
+# repackaging script: Merge the C and FORTRAN files published by upstream to
+# generate the upstream tarball.
+#
+# Author: Rock Storm <rockstorm at gmx.com>
+
+topdir=$(dirname $PWD)
+ctkname="cspice"
+ftkname="toolkit"
+debname="cspice-66+dfsg"
+
+# This script is supposed to be run from within the main cspice debian package
+# folder
+cd ..
+
+# Download files
+if [ -e $ctkname.tar.Z ] ; then :
+else
+ wget http://naif.jpl.nasa.gov/pub/naif/toolkit//C/PC_Linux_GCC_32bit/packages/cspice.tar.Z
+fi
+
+if [ -e $ftkname.tar.Z ] ; then :
+else
+ wget http://naif.jpl.nasa.gov/pub/naif/toolkit//FORTRAN/PC_Linux_gfortran_32bit/packages/toolkit.tar.Z
+fi
+
+# Extract files
+rm -fr $ctkname
+rm -fr $ftkname
+tar -zxf $ctkname.tar.Z
+tar -zxf $ftkname.tar.Z
+
+# Remove header files
+cd $ctkname
+rm src/*/*.h
+
+cdirs="brief_c chrnos_c ckbref_c commnt_c cspice csupport \
+dskbrief_c dskexp_c frmdif_c inspkt_c mkdsk_c mkspk_c \
+msopck_c spacit_c spkdif_c spkmrg_c tobin_c toxfr_c versn_c"
+
+fdirs="brief chronos ckbrief commnt spicelib support \
+dskbrief dskexp frmdiff inspekt mkdsk mkspk \
+msopck spacit spkdiff spkmerge tobin toxfr version"
+
+# Exclude files which cannot be directly translated from the published Fortran
+# files:
+excludedfiles="rdker.c zzldker.c zzxlated.c zzxlatei.c"
+for item in $excludedfiles
+do
+ excludes="$excludes --exclude="*$item""
+done
+
+arr=($cdirs)
+index=0
+for item in $fdirs
+do
+ # Copy the Fortran include files
+ cp ../$ftkname/src/$item/*.inc src/${arr[$index]}/
+
+ # Replace each .pgm file with its Fortran counterpart
+ cp -f ../$ftkname/src/$item/*.pgm src/${arr[$index]}/
+
+ # Replace every .c file with its fortran counterpart
+ ## List which files from the C Toolkit where actually translated from
+ ## Fortran
+ cfiles="$(grep -l -d recurse -e "translated by f2c" $excludes src/${arr[$index]}/ | grep -v -e "pgm")"
+
+ ## Find the Fortran counterpart of each *.c file
+ for item2 in $cfiles
+ do
+ ffilename="${item2%.c}"
+ ffilename="${ffilename##src*/}.f"
+ cfilepath="${item2%/*.c}"
+ ffile="$(find $topdir/$ftkname/src/$item -type f -name "$ffilename" | head -n 1)"
+ # If Fortran counterpart exists remove C file and replace it
+ if [ $ffile ]; then
+ rm $item2
+ cp $ffile ./$cfilepath/
+ fi
+ done
+
+ let "index++"
+done
+
+# Remove the folders containing binary files
+rm -fr exe
+rm -fr etc
+rm -fr lib
+
+# Repack
+cd $topdir
+rm -rf $debname
+rm -rf $debname.tar.gz
+mv $ctkname $debname
+tar -zcf $debname.tar.gz $debname
diff --git a/debian/watch b/debian/watch
index 6d7118f..697df2f 100644
--- a/debian/watch
+++ b/debian/watch
@@ -2,7 +2,9 @@
version=4
# No way to reach the download file and the version has been found yet.
-# Upstream "tarball" has no version on its name. See http://naif.jpl.nasa.gov/
-# pub/naif/toolkit//C/PC_Linux_GCC_32bit/packages/cspice.tar.Z
+# Upstream "tarball" has no version on its name. See http://naif.jpl.nasa.gov/pub/naif/toolkit//C/PC_Linux_GCC_32bit/packages/cspice.tar.Z
# The version is stated here: https://naif.jpl.nasa.gov/naif/toolkit.html
# instead.
+
+# The upstream tarball is produced using the debian/repack script and the
+# process is explained in the debian/README.source file.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/cspice.git
More information about the Debian-astro-commits
mailing list