-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdate-recipe-checksums.sh
executable file
·52 lines (45 loc) · 1.59 KB
/
update-recipe-checksums.sh
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
#!/bin/sh
# raspberrypi-card-write.sh
# (c) Copyright 2020 Andreas Müller <[email protected]>
# Licensed under terms of GPLv2
#
# This script updates checksums in recipes after version bump. It is supposed
# to run run in same environment as bitbake:
#
# update-recipe-checksums.sh [-d <recipedir> <recipes>
#
# where <recipe> can be a single recipe, a packagegroup an image or...
# Includes
. `dirname $0`/include/common-helpers.inc
echo
if [ "$1" = "-d" ]; then
shift
_TOPDIR="$1"
echo -e "${style_bold}Use $1 as recipe directory...${style_normal}"
shift
fi
if [ -z "$1" ]; then
ErrorOut "No fetch target set in first parameter!"
fi
if [ "x$_TOPDIR" = "x" ]; then
echo -e "${style_bold}Ask bitbake for recipe directory...${style_normal}"
GetBitbakeEnvVar "TOPDIR"
_TOPDIR="$BitbakeEnvVar"
fi
echo
echo -e "${style_bold}Run bitbake -k --runall=fetch $@...${style_normal}"
bitbake -k --runall=fetch "$@" 2>&1 | while read line; do
if echo "$line" | grep -q "was expected"; then
# Shorten line to ensure not being confused by filenames containing spaces
line=`echo "$line" | sed 's:.*checksum ::' | sed "s:'::g"`
# Extract checksums
newchecksum=`echo "$line" | awk '{print $1}'`
oldchecksum=`echo "$line" | awk '{print $3}'`
# Lazy way: just grep for old checksums to find recipes
for recipe in `grep -rl "$oldchecksum" "${_TOPDIR}"`; do
if [ -f "$recipe" ]; then
EvalExAuto "sed -i '"s:$oldchecksum:$newchecksum:"' "$recipe"" "Change checksum in $recipe to $newchecksum"
fi
done
fi
done