File: maintenv

package info (click to toggle)
derivations 0.53.20120414-1.2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,208 kB
  • ctags: 486
  • sloc: cpp: 1,634; perl: 600; makefile: 153; sh: 116
file content (65 lines) | stat: -rw-r--r-- 2,099 bytes parent folder | download | duplicates (6)
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

# This bash shell pseudoscript sets some useful environment
# variables for derivations package maintenance.  You run it
# by ". helper/maintenv".
#
# Before running this pseudoscript you must set the following:
#
#     D1  the old version date (for example, 19700101)
#     D2  the prospective new version date
#
# (It would be neater to make this and the associated pseudoscripts real
# scripts, but it would also be less useful from the author's point of
# view.  Remember that this is just a development helper.  The reason to
# use pseudoscripts is to keep the various shell variables and functions
# in the shell's global namespace where the maintainer can manipulate
# them directly.  If you don't want your shell's namespace cluttered,
# you can spawn a subshell before invoking the pseudoscript.)

if   [[ $D1 == '' || $D2 == '' ]] ; then
  echo 1>&2 "Please set D1 and D2 before running this pseudoscript."
  false
elif echo -n $VD | grep -q '[^0-9]' ; then
  echo 1>&2 "The \$VD must be a nonnegative integer."
  false
elif [[ $D1 == $D2 && ( $VD == '' || $(( $VD > 1 )) == 0 ) ]] ; then
  echo 1>&2 "Please set either \$VD > 1 or \$D2 != \$D1."
  false
else

  DVLARCH=i386  # the maintainer's own machine architecture
  E=~/der       # the maintainer's development superdirectory
  P=derivations # the package name
  V=0.5         # the base version number

  # Derive additional variables.
  if [[ $VD == '' ]] ; then VD=1 ; fi

  # Define a shell function to build a diff.
  function mkdiff {
    if [[ -x helper/buffe-src ]] ; then
      if [[ $(( $VD > 1 )) == 0 ]] ; then
        DIFF=$E/$P-$V.$D2.diff
        (
          cd ..
          diff -ruN $P-$V.{$D1,$D2} >$DIFF
        )
      else
        DIFF=$E/$P-$V.$D1-$VD.diff
        (
          cd ..
          diff -ruN $P-$V.$D1{-$(( $VD - 1 )),} >$DIFF
        )
      fi
    else
      echo 1>&2 "You must run this shell function from the top source"
      echo 1>&2 "directory, and helper/buffe-src must be executable."
      false
    fi
  }

  # Set a flag to mark that the pseudoscript has been run.
  MAINTENV=$P

fi