summaryrefslogtreecommitdiff
path: root/devel/qt5/files/create_kde-qt_release.sh
blob: d46e4bd088d882c4b89d46e591b4537ded25a85e (plain) (blame)
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
#!/bin/sh

# Creates and updates a git checkout in ${BASE_DIRECTORY}
# for the given KDE Qt repository ${PROJECT}.
# After that, a new distfile for the ports tree is created.

DIST="$1"
PROJECT=qt"${DIST}"
BASE_DIRECTORY="$2"
# Version of Qt we want
VERSION="$3"
ORIGIN_TAG="$4"

# Remote KDE git repository
REPO="https://invent.kde.org/qt/qt/${PROJECT}.git"
# Local checkout
CHECKOUT="${BASE_DIRECTORY}/${PROJECT}"

# KDE-Qt branch
BRANCH=kde/5.15

# Make sure we can use ${BASE_DIRECTORY}
if [ ! -d "${BASE_DIRECTORY}" ] || [ ! -w "${BASE_DIRECTORY}" ] ; then
	echo "Directory '${BASE_DIRECTORY}' does not exist"
	exit 1
fi

# Init a new git checkout if it is missing
if [ ! -d "${CHECKOUT}" ] ; then
	git -C "${BASE_DIRECTORY}" clone "${REPO}"
fi

# Update the checkout of the required branch
git -C "${CHECKOUT}" checkout "${BRANCH}" && git -C "${CHECKOUT}" pull --ff-only --rebase --autostash
if [ $? -ne 0 ] ; then
	echo "Failed to update ${CHECKOUT}"
	exit 1
fi

# Count number of patches added by KDE
PATCH_COUNT=$(git -C ${CHECKOUT} rev-list --count ${ORIGIN_TAG}..origin/${BRANCH})

# Setup information for the distfile
DISTNAME="kde-${PROJECT}-${VERSION}p${PATCH_COUNT}"
DISTFILE="${BASE_DIRECTORY}/${DISTNAME}.tar.xz"

# Tar and compress distfile
git -C ${CHECKOUT} archive --format=tar --prefix="${DISTNAME}/" HEAD | xz > "${DISTFILE}"
if [ $? -ne 0 ] ; then
	echo "Failed to create tarball ${DISTFILE}"
	exit 1
fi

# Printout information required in qt-dist.mk
echo -e "Distfile:\t${DISTFILE}\n_KDE_${DIST}=\t${PATCH_COUNT}"