File update_git.sh of Package u-boot-p2371-2180
160
1
2
#
3
# Instead of a quilt workflow, we use a git tree that contains
4
# all the commits on top of a stable tarball.
5
#
6
# When updating this package, just either update the git tree
7
# below (use rebase!) or change the tree path and use your own
8
#
9
# That way we can easily rebase against the next stable release
10
# when it comes.
11
12
set -e
13
14
GIT_TREE=git://github.com/openSUSE/u-boot.git
15
GIT_LOCAL_TREE=~/git/u-boot-opensuse
16
GIT_BRANCH=sle15-sp1
17
GIT_UPSTREAM_TAG=v2019.01
18
GIT_DIR=/dev/shm/u-boot-factory-git-dir
19
CMP_DIR=/dev/shm/u-boot-factory-cmp-dir
20
21
rm -rf $GIT_DIR
22
rm -rf $CMP_DIR
23
24
if [ -d "$GIT_LOCAL_TREE" ]; then
25
echo "Processing $GIT_BRANCH branch of local git tree, using tag:" \
26
"$GIT_UPSTREAM_TAG"
27
if ! (cd $GIT_LOCAL_TREE && git show-branch $GIT_BRANCH &>/dev/null); then
28
echo "Error: Branch $GIT_BRANCH not found - please create a remote" \
29
"tracking branch of origin/$GIT_BRANCH"
30
exit
31
fi
32
git clone -ls $GIT_LOCAL_TREE $GIT_DIR -b $GIT_BRANCH
33
if ! (cd $GIT_LOCAL_TREE && git remote show upstream &>/dev/null); then
34
echo "Remote for upstream git tree not found. Next time add remote" \
35
"named upstream for git://git.denx.de/u-boot.git and update"
36
(cd $GIT_DIR && git remote add upstream git://git.denx.de/u-boot.git)
37
(cd $GIT_DIR && git remote update)
38
fi
39
else
40
echo "Processing $GIT_BRANCH branch of remote git tree, using tag:" \
41
"$GIT_UPSTREAM_TAG"
42
echo "(For much faster processing, consider establishing a local git tree" \
43
"at $GIT_LOCAL_TREE)"
44
git clone $GIT_TREE $GIT_DIR -b $GIT_BRANCH
45
(cd $GIT_DIR && git remote add upstream git://git.denx.de/u-boot.git)
46
(cd $GIT_DIR && git remote update)
47
fi
48
(cd $GIT_DIR && git format-patch -N $GIT_UPSTREAM_TAG --suffix= -o $CMP_DIR >/dev/null)
49
UBOOT_VERSION=$(egrep '^VERSION = ' $GIT_DIR/Makefile | cut -d ' ' -f 3)
50
UBOOT_PATCHLEVEL=$(egrep '^PATCHLEVEL = ' $GIT_DIR/Makefile | cut -d ' ' -f 3)
51
UBOOT_SUBLEVEL=$(egrep '^SUBLEVEL = ' $GIT_DIR/Makefile | cut -d ' ' -f 3)
52
UBOOT_EXTRAVERSION=$(egrep '^EXTRAVERSION = ' $GIT_DIR/Makefile | cut -d ' ' -f 3)
53
UBOOT_VERSION="${UBOOT_VERSION}.${UBOOT_PATCHLEVEL}"
54
if [ -n "${UBOOT_SUBLEVEL}" ]; then
55
UBOOT_VERSION="${UBOOT_VERSION}.${UBOOT_SUBLEVEL}"
56
fi
57
UBOOT_VERSION="${UBOOT_VERSION}${UBOOT_EXTRAVERSION}"
58
echo "U-Boot version: $UBOOT_VERSION"
59
60
rm -rf $GIT_DIR
61
62
(
63
CHANGED_COUNT=0
64
UNCHANGED_COUNT=0
65
DELETED_COUNT=0
66
ADDED_COUNT=0
67
68
shopt -s nullglob
69
70
# Process patches to eliminate useless differences: limit file names to 40 chars
71
# before extension and remove git signature. ('32' below gets us past dir prefix)
72
for i in $CMP_DIR/*; do
73
# format-patch may append a signature, which per default contains the git version
74
# wipe everything starting from the signature tag
75
sed '/^-- $/Q' $i > $CMP_DIR/${i:32:40}.patch
76
rm $i
77
done
78
79
for i in 0???-*.patch; do
80
if [ -e $CMP_DIR/$i ]; then
81
if cmp -s $CMP_DIR/$i $i; then
82
rm $CMP_DIR/$i
83
let UNCHANGED_COUNT+=1
84
else
85
mv $CMP_DIR/$i .
86
let CHANGED_COUNT+=1
87
fi
88
else
89
osc rm --force $i
90
let DELETED_COUNT+=1
91
echo " ${i##*/}" >> u-boot.changes.deleted
92
fi
93
done
94
95
for i in $CMP_DIR/*; do
96
mv $i .
97
osc add ${i##*/}
98
let ADDED_COUNT+=1
99
echo " ${i##*/}" >> u-boot.changes.added
100
done
101
102
for package in u-boot u-boot-board; do
103
while IFS= read -r line; do
104
if [ "$line" = "PATCH_FILES" ]; then
105
for i in 0???-*.patch; do
106
NUM=${i%%-*}
107
echo -e "Patch$NUM: $i"
108
done
109
elif [ "$line" = "PATCH_EXEC" ]; then
110
for i in 0???-*.patch; do
111
NUM=${i%%-*}
112
echo "%patch$NUM -p1"
113
done
114
elif [ "$line" = "ARCHIVE_VERSION" ]; then
115
echo "%define archive_version $UBOOT_VERSION"
116
elif [ "$line" = "UBOOT_VERSION" ]; then
117
echo "Version: $(echo $UBOOT_VERSION | sed 's/-/~/g')"
118
else
119
echo "$line"
120
fi
121
done < $package.spec.in > $package.spec.tmp
122
done
123
124
# Factory requires all deleted and added patches to be mentioned
125
if [ -e u-boot.changes.deleted ] || [ -e u-boot.changes.added ]; then
126
echo "Patch queue updated from ${GIT_TREE} ${GIT_BRANCH}" > u-boot.changes.proposed
127
fi
128
if [ -e u-boot.changes.deleted ]; then
129
echo "* Patches dropped:" >> u-boot.changes.proposed
130
cat u-boot.changes.deleted >> u-boot.changes.proposed
131
fi
132
if [ -e u-boot.changes.added ]; then
133
echo "* Patches added:" >> u-boot.changes.proposed
134
cat u-boot.changes.added >> u-boot.changes.proposed
135
fi
136
if [ -e u-boot.changes.proposed ]; then
137
osc vc --file=u-boot.changes.proposed u-boot
138
rm -f u-boot.changes.proposed
139
fi
140
if [ -e u-boot.changes.deleted ]; then
141
rm -f u-boot.changes.deleted
142
fi
143
if [ -e u-boot.changes.added ]; then
144
rm -f u-boot.changes.added
145
fi
146
echo "git patch summary"
147
echo " unchanged: $UNCHANGED_COUNT"
148
echo " changed: $CHANGED_COUNT"
149
echo " deleted: $DELETED_COUNT"
150
echo " added: $ADDED_COUNT"
151
)
152
153
rm -rf $CMP_DIR
154
155
osc service localrun format_spec_file
156
157
/bin/sh pre_checkin.sh
158
159
echo "Please remember to run pre_checkin.sh after modifying u-boot.changes."
160