summaryrefslogtreecommitdiffstats
path: root/bin/reprepro_add.sh
blob: 2fe3c8908bb2170e7d3b17ba72ea45dcefa03eb9 (plain)
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
#!/bin/sh

set -e

HOSTNAME="$(hostname -f)"

Irk ()
{
	MESSAGE="${1}"

	for CHANNEL in progress-linux bfh-linux-systems
	do
		irk irc://irc.oftc.net:7000/${CHANNEL} ${MESSAGE}
	done
}

case "$(basename ${PWD})" in
	*_arm64)
		_ARCH="arm64"
		;;

	*_armel)
		_ARCH="armel"
		;;

	*_armhf)
		_ARCH="armhf"
		;;

	*_amd64)
		_ARCH="amd64"
		;;

	*_i386)
		_ARCH="i386"
		;;

	*_all)
		_ARCH="all"
		;;
esac

#_DIST="$(cd ../../../ && echo $(basename ${PWD}))"
_DIST="$(grep -m1 '^Distribution: ' *.changes | awk '{ print $2 }')"

_PACKAGE="$(basename *.changes .changes | awk -F_ '{ print $1 }')"

# HACK
_POOL="/srv/${HOSTNAME}/packages"

if ls *.dsc > /dev/null 2>&1
then
	echo "### Removing ${_PACKAGE} sources..."

	# Remove source and binary upload
	reprepro -b ${_POOL} removesrc ${_DIST} $(basename *.changes .changes | awk -F_ '{ print $1 }') || true
else
	echo "### Removing ${_PACKAGE} binary..."

	# Remove binary upload
	reprepro -b ${_POOL} --architecture ${_ARCH} remove ${_DIST} $(basename *.changes .changes | awk -F_ '{ print $1 }') || true
fi

echo "### Including ${_PACKAGE} upload..."
reprepro -b ${_POOL} ${_REPREPRO_OPTIONS} include ${_DIST} *.changes

if [ "${1}" != "quiet" ]
then
	_SOURCE="$(grep -m1 '^Source: ' *.changes | awk '{ print $2 }')"
	_VERSION="$(grep -m1 '^Version: ' *.changes | awk '{ print $2 }')"
	_URGENCY="$(grep -m1 '^Urgency: ' *.changes | awk '{ print $2 }')"
	_DISTRIBUTION="$(grep -m1 '^Distribution: ' *.changes | awk '{ print $2 }')"
	_ARCHITECTURE="$(grep -m1 '^Architecture: ' *.changes | awk '{ $1=""; print $0 }' | sed -e 's|^ ||')"

	Irk "\x0300archive-master:\x03 \x0303${_SOURCE}\x03 \x0310${_VERSION}\x03 uploaded with urgency \x0307${_URGENCY}\x03 to \x0312${_DISTRIBUTION}\x03 (${_ARCHITECTURE}) \x0305http://sources.progress-linux.org/gitweb/?p=releases/${_DISTRIBUTION}/packages/${_SOURCE}.git\x03"
fi