File: repackage.sh

package info (click to toggle)
cpl-plugin-xshoo 3.5.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 20,920 kB
  • sloc: ansic: 170,001; sh: 4,369; python: 2,391; makefile: 1,211
file content (66 lines) | stat: -rwxr-xr-x 2,394 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh
#
# The ESO pipeline packages come in the form of a "kit" containing all
# packages needed to build the pipeline. This also includes some non-free
# packages like Gasgano.
# To allow the pipelines to be put to Debian "main", and to have a more 
# convienient build process, we extract just the source package.
#
# Debian package name ("cpl-plugin-fors")
DEBIAN_PACKAGE=$(echo $(basename $3) | cut -d_ -f1)

# Pipeline name ("fors")
PIPELINE=$(echo ${DEBIAN_PACKAGE} | cut -d- -f3-)

# Version number ("4.9.4")
VERSION=$2

# Include full calibration set?
# If not, the "calib" package will act as a "downloader" package for the 
# calibration files.
INCLUDE_CALIB="no"
#INCLUDE_CALIB="yes"

# Include test data?
# If not, the test (fits) data are removed from the source package.
# In this case, also the tests need to be adjusted.
#INCLUDE_TEST_DATA="no"
INCLUDE_TEST_DATA="yes"

BASEDIR=$(dirname $3)
FILENAME=${BASEDIR}/${PIPELINE}-kit-${VERSION}.tar.gz
if [ ! -f ${FILENAME} ] ; then
  FILENAME=${BASEDIR}/${PIPELINE}-kit-${VERSION}-*.tar.gz
  UVERSION=$(echo ${FILENAME} | sed "s/.*-kit-\(.*\)\.tar.gz/\1/")
else
  UVERSION=${VERSION}
fi
tar xf ${FILENAME} -C ${BASEDIR}
rm -f ${BASEDIR}/${DEBIAN_PACKAGE}_${UVERSION}.orig*.tar.* ${FILENAME}

TAREXCLUDE="--exclude ${PIPELINE}-${VERSION}/html"
if [ $INCLUDE_TEST_DATA = "no" ] ; then
  TAREXCLUDE=${TAREXCLUDE}" --exclude ${PIPELINE}-${VERSION}/*/tests/ref_data"
fi

tar xf ${BASEDIR}/${PIPELINE}-kit-${UVERSION}/${PIPELINE}-${VERSION}.tar.gz\
    -C ${BASEDIR} ${TAREXCLUDE}
tar xf ${BASEDIR}/${PIPELINE}-kit-${UVERSION}/${PIPELINE}-calib-${VERSION}.tar.gz\
    -C ${BASEDIR}/${PIPELINE}-${VERSION}/
mv ${BASEDIR}/${PIPELINE}-${VERSION}/${PIPELINE}-calib-${VERSION}/ \
   ${BASEDIR}/${PIPELINE}-${VERSION}/calib/
if [ $INCLUDE_CALIB = "no" ] ; then
  sha1sum -b ${BASEDIR}/${PIPELINE}-kit-${UVERSION}/${PIPELINE}-calib-${VERSION}.tar.gz\
      | cut -d\  -f1 \
      > ${BASEDIR}/${PIPELINE}-${VERSION}/calib/cal_shasum
  du -s ${BASEDIR}/${PIPELINE}-${VERSION}/calib/cal | cut -f1 \
      > ${BASEDIR}/${PIPELINE}-${VERSION}/calib/cal_size
  rm -rf ${BASEDIR}/${PIPELINE}-${VERSION}/calib/cal
fi

tar cJf ${BASEDIR}/${DEBIAN_PACKAGE}_${VERSION}+dfsg.orig.tar.xz \
    -C ${BASEDIR} ${PIPELINE}-${VERSION}/
rm -rf ${BASEDIR}/${PIPELINE}-${VERSION}/

rm -rf ${BASEDIR}/${PIPELINE}-kit-${UVERSION}/ 
exec uupdate --no-symlink "$@"