summaryrefslogtreecommitdiff
path: root/koszko-rebase.sh
blob: 4bec82eb3cba37fe40029f380f1573c5ddede99b (about) (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
#!/bin/sh

# SPDX-License-Identifier: CC0-1.0
# Copyright (C) 2023 Wojtek Kosior <koszko@koszko.org>

set -eu

KOSZKO_BRANCHES="
readme
pantalaimon
cgit
exim
ca
certbot
overlayfs
extra-groups
guile-libraries
localhost-repo-server
vpath-builds
ldap
gmnisrv
cron"

KOSZKO_PERSONAL_BRANCHES="
personal-packages
"

cd "$(dirname "$0")"

git checkout koszko
git reset --hard master

rebase_branches() {
    BUILDUP_BRANCH="$(git status | awk '/^On branch /{print $3}')"
    [ "x$BUILDUP_BRANCH" != x ]

    git checkout koszko-"$1"
    git rebase master

    git checkout koszko-work
    git reset --hard koszko-"$1"
    git rebase "$BUILDUP_BRANCH"
    git checkout "$BUILDUP_BRANCH"
    git reset --hard koszko-work
}

for BRANCH_SUFFIX in $KOSZKO_BRANCHES; do
    rebase_branches "$BRANCH_SUFFIX"
done

git rm .guix-authorizations

git commit -m "Allow unauthorized \`guix pull\`"

git checkout koszko-personal
git reset --hard koszko

for BRANCH_SUFFIX in $KOSZKO_PERSONAL_BRANCHES; do
    rebase_branches "$BRANCH_SUFFIX"
done

MODIFIED="$(grep 'url "https://git.koszko.org' gnu/packages/*.scm |
                awk -F: '{print $1}' | sort | uniq)"

sed -i 's|url \"https://git.koszko.org/|url \"http://localhost:8098/|g' \
    $MODIFIED

git commit -m "Replace git.koszko.org URLs with local ones" $MODIFIED

# optionally, do
#     guix shell -D guix -- make -j$((1 + $(nproc)))