File: make-ppa

package info (click to toggle)
swi-prolog 9.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 82,408 kB
  • sloc: ansic: 387,503; perl: 359,326; cpp: 6,613; lisp: 6,247; java: 5,540; sh: 3,147; javascript: 2,668; python: 1,900; ruby: 1,594; yacc: 845; makefile: 428; xml: 317; sed: 12; sql: 6
file content (177 lines) | stat: -rwxr-xr-x 3,531 bytes parent folder | download
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/bin/bash
#
# This script creates a source  deb  package   and  uploads  this to the
# Lauchpad PPA build service.
#
# Author: Yves Raimond and Jan Wielemaker

PL_VERSION=`cat VERSION`
VTAG=HEAD
TARGET_DISTRO=none
distros="bionic focal jammy kinetic"
build=true
buildbin=false
push=false
pgpkey=266FF04C52056213BECDDDA04EF5383C7C11B85B
program="$0"

usage()
{ cat << EOM
Usage: $(basename $program) [option ...]
Options:
    --distro=Distro
      Set the target distribution
    --distros
      If this optionn is present, the known distros are listed and
      this script terminates
    --no-build
      Only create the ppa directory, do not build a source deb
    --build-bin
      Also build the binary package
    --push
      Push the result to launchpad using dput(1)
    --key=Key [default: $pgpkey]
      Set the PGP key for signing the package
EOM
exit 1
}

done=false
while [ $done = false ]; do
    case "$1" in
	--help)
		usage
		exit 0
		;;
	--distro=*)
		TARGET_DISTRO="`echo $1 | sed 's/--[^=]*=//'`"
		shift
		;;
	--list-distros)
		for d in $distros; do echo $d; done
		exit 0
		;;
	--key=*)
		pgpkey="`echo $1 | sed 's/--[^=]*=//'`"
		shift
		;;
	--tag=*)
		VTAG="`echo $1 | sed 's/--[^=]*=//'`"
		shift
		;;
	--no-build)
		build=false
		shift
		;;
	--build-bin)
		buildbin=true
		shift
		;;
	--push)
		push=true
		shift
		;;
	*)	if [ x"$*" != x"" ]; then
		  usage
		  exit 1
		else
		  done=true
		fi
		;;
    esac
done

if [ $push = true -a $buildbin = true ]; then
  echo "Only one of --push or --buildbin is allowed"
  exit 1
fi

# Avoid typos ...
case $TARGET_DISTRO in
  none)
    echo "Known distros: $distros"
    exit 1
    ;;
  *)
    distrook=false
    for d in $distros; do
      if [ $d = $TARGET_DISTRO ]; then
	distrook=true;
      fi
    done
    if [ $distrook != true ]; then
      echo "ERROR: Unknown target distro ($TARGET_DISTRO)"
      echo "Known distros: $distros"
      exit 1
    fi
esac

gitd="$(git describe $VTAG)"
GIT_SHORT_HASH=`echo $gitd | sed 's/.*-\([0-9]*-g.*\)/\1/'`
if [ "$GIT_SHORT_HASH" = "$gitd" ]; then
  GIT_SHORT_HASH=0
fi

VERSION=$PL_VERSION-$GIT_SHORT_HASH-${TARGET_DISTRO}ppa2

echo "Building package $VERSION for $TARGET_DISTRO"

echo " - Adding entry to changelog"

dch --distribution=$TARGET_DISTRO -v $VERSION "New upstream release (from GIT)"
( cd debian && git commit changelog -m "Updated version" )
git commit debian -m "Updated debian (version)"

buildbase=swi-prolog_$PL_VERSION-$GIT_SHORT_HASH

echo " - Generating archive $buildbase"

./scripts/make-src-tape \
	--quiet \
	--tag=$VTAG \
	--name=swi-prolog --sep=_ \
	--version=$PL_VERSION-$GIT_SHORT_HASH \
	--submodule=debian

builddir=swi-prolog_$PL_VERSION-$GIT_SHORT_HASH
archive=$builddir.tar.gz
orig_archive=$builddir.orig.tar.gz

if [ -d build-ppa-tmp ]; then
  rm -rf build-ppa-tmp/*
else
  mkdir build-ppa-tmp
fi

echo " - Unpacking $archive into build-ppa-tmp"

mv ../$archive build-ppa-tmp/$orig_archive
(cd build-ppa-tmp && tar xf $orig_archive)

if [ $build = true ]; then
  echo " - Building source package"

  ( cd build-ppa-tmp/$builddir &&
    debuild -S -sa -k$pgpkey
  )
else
  echo " - Created build-ppa-tmp/$builddir; skipped building of source deb"
  exit 0
fi

if [ $buildbin = true ]; then
  echo " - Building binary source package"

  ( cd build-ppa-tmp/$builddir &&
    debuild -k$pgpkey
  )
  exit 0
fi

if [ $push = true ]; then
  echo " - Pushing source package to PPA"

  ( cd build-ppa-tmp &&
    dput ppa:swi-prolog/stable swi-prolog_${VERSION}_source.changes
  )
fi