File: close-source

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 (68 lines) | stat: -rw-r--r-- 1,705 bytes parent folder | download | duplicates (7)
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
67
68

# This bash shell pseudoscript closes the development source tree for
# subsequent building.  Note that you can close the source as many times
# as you like; you needn't (and shouldn't) reopen it each time.

if   [[ $MAINTENV != derivations       ]] ; then
  echo 1>&2 "Please run helper/maintenv first."
  false
elif [[ ! $PWD -ef $E/$P-$V.$D2        ]] ; then
  echo 1>&2 "Please run from the top source directory $E/$D2."
  false
else

  if [[ $D3 == '' ]] ; then D3=$D2 ; fi
  if [[ $VD == '' ]] ; then VD=1   ; fi
  if echo -n $VD | grep -q '[^0-9]' ; then
    echo 1>&2 "The \$VD must be a nonnegative integer."
    false
  else

    if [[ $(( $VD > 1 )) == 0 ]] ; then

      if [[ $D3 != $D2 && -e $E/$D3 ]] ; then
        echo 1>&2 "Sorry, but $E/$D3 already exists."
        false
      else
        if [[ $D3 != $D2 ]] ; then
          cd ..
          mv $P-$V.{$D2,$D3}
          rm -f $DIFF
          cd $P-$V.$D3
        fi
        helper/update-date $D3
        D2=$D3
        helper/buffe-src >/dev/null
        debian/rules orig-force
        mkdiff
      fi

    else

      if [[ -e $E/$P-$V.$D1-$(( $VD - 1 )) && $D2 != $D1 ]] ; then
        echo 1>&2 "Sorry, but \$D2 != \$D1,"
        echo 1>&2 "yet $E/$P-$V.$D1-$(( $VD - 1 )) already exists."
        false
      else
        rm -Rf $E/$P-$V.$D1-$(( $VD - 1 ))
        if [[ $D2 != $D1 ]] ; then
          cd ..
          mv $P-$V.$D1{,-$(( $VD - 1 ))}
          mv $P-$V.{$D2,$D1}
          cd $P-$V.$D1
        fi
        helper/update-debver   $VD
        helper/update-date     $D1
        helper/update-date -ds $D2
        D2=$D1
        D3=$D1
        helper/buffe-src >/dev/null
        mkdiff
      fi

    fi

  fi

fi