-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcommit-changed-pkgs
executable file
·58 lines (45 loc) · 1.33 KB
/
commit-changed-pkgs
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
#!/usr/bin/env bash
# commit-changed-pkgs
# Commits all changes with a given template
# Can exclude by maintainer.
# Useful for e.g. big batch changes like a sed across tree
# Usage:
# bash ~/scripts/commit-changed-pkgs
# Configuration:
# - maintainers: maintainers to skip
# - template: file containing "*: msg" for pkgdev
# - debug: noisy or not
#maintainers="(some-project-to-treat-specially)"
maintainers=""
template="${BASH_SOURCE%/*}/template-pkgdev"
debug=1
#
# Get a list of the files changed
list=$(git diff --name-only | grep -v "/layout/" | grep -v "/metadata/")
# Parse out the directories to make it easier to see metadata.xml
dirs=()
for file in ${list[@]} ; do
dirs+=($(dirname "${file}"))
done
# Mangle the format for iteration
dirs=($(echo ${dirs[@]} | tr ' ' '\n' | sort -u))
# Iterate over all of the files changed locally (unstaged)
# If any ebuilds are in a directory mentioning a maintainer
# we want to skip, we don't stage the changes.
for dir in ${dirs[@]} ; do
if [[ ${dir} == *eclass* ]] || [[ ${dir} == *metadata* ]] ; then
continue
fi
if ! [[ -z ${maintainers} ]] ; then
grep -E -qe "${maintainers}" "${dir}"/metadata.xml
if [[ $? -eq 0 ]] ; then
[[ ${debug} -eq 1 ]] && echo "Skipping ${dir}";
continue
fi
fi
dir=${dir/files/}
cd "${dir}"
git add .
pkgdev commit -M ${template}
cd ../..
done