blob: 4d44f420178db5da2aa75a597fcec3259e39351a (
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
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
|
#!/bin/sh
# Requires:
# app-portage/portage-utils
# app-portage/gentoolkit-dev
# app-portage/repoman
# Optional:
# dev-vcs/git
# app-portage/mgorny-dev-scripts
# dev-util/pkgcheck
: ${PORTDIR:="$(pwd)"}
get_package_list_from_set() {
local set="${1}"
for entry in $(grep -v ^[#@] "${PORTDIR}/sets/${set}") ; do
echo $(qatom ${entry} | cut -d " " -f 1-2 | tr " " "/")
done
for entry in $(grep ^@ "${PORTDIR}/sets/${set}") ; do
get_package_list_from_set ${entry/@/}
done
}
get_main_tree_keyword() {
local portdir="$(portageq get_repo_path / gentoo)"
local cp="${1}"
if [[ -e ${portdir}/${cp} ]] ; then
echo $(sed -ne 's/^\s*KEYWORDS="\(.*\)"/\1/p' "$(ls ${portdir}/${cp}/*.ebuild | sort | tail -n 1)")
else
echo "~amd64 ~x86"
fi
}
help() {
echo Simple set-based version bumper.
echo
echo Given a set file, bumps all packages in the given set given source
echo and destination versions. Optionally, if destination is a git repository,
echo each ebuild will be committed as \"cat/pn: DESTINATIONVERSION version bump\".
echo Designed for workflows where ebuilds are bumped from up-to-date live versions.
echo
echo Reads PORTDIR from your enviroment, defaulting to the current directory.
echo
echo Usage: bump-from-set.sh SETNAME SOURCEVERSION DESTINATIONVERSION
echo Example: bump-from-set.sh kde-plasma-5.19 5.19.49.9999 5.19.2
exit 0
}
SETNAME="$1"
SOURCEVERSION="$2"
DESTINATIONVERSION="$3"
if [[ $1 == "--help" ]] ; then
help
fi
if [[ -z "${SETNAME}" || -z "${SOURCEVERSION}" || -z "${DESTINATIONVERSION}" ]] ; then
echo ERROR: Not enough arguments
echo
help
fi
packages=$(get_package_list_from_set ${SETNAME})
for cp in ${packages} ; do
pushd "${PORTDIR}/${cp}" > /dev/null
pn=$(basename $(pwd))
source=${pn}-${SOURCEVERSION}.ebuild
destination=${pn}-${DESTINATIONVERSION}.ebuild
cp ${source} ${destination}
ekeyword ^all ${destination} > /dev/null
if [[ ${destination} != *9999* ]] ; then
ekeyword $(get_main_tree_keyword ${cp}) ${destination} > /dev/null
ekeyword ~all ${destination} > /dev/null
fi
repoman manifest
popd > /dev/null
done
if [[ -d "${PORTDIR}/.git" ]] && hash git 2>/dev/null && hash pkgcommit 2>/dev/null; then
for cp in ${packages} ; do
pushd "${PORTDIR}/${cp}" > /dev/null
git add .
pkgcommit -sS . -m "${DESTINATIONVERSION} version bump"
popd > /dev/null
done
if hash pkgcheck 2>/dev/null; then
pushd "${PORTDIR}" > /dev/null
pkgcheck scan --commits
popd > /dev/null
fi
fi
|