Debian Codegraph @

scripts/ksync.sh

raw symbols SCIP
1 #!/bin/sh
2 set -e
3
4 my_name="${0##*/}"
5
6 # If an argument is given, it's the location
7 # of the Linux kernel source tree
8 k_dir="${1}"
9 if [ ! \( -n "${k_dir}" -a -d "${k_dir}/kernel" \) ]; then
10 if [ -n "${k_dir}" ]; then
11 printf "%s: \`%s': not a Linux kernel source tree\n" \
12 "${my_name}" "${k_dir}"
13 else
14 printf "Usage: %s /path/to/kernel/dir\n" "${my_name}"
15 fi
16 exit 1
17 fi
18
19 # Save current version
20 k_cset_old=$( head -n 1 .version |awk '{ print $(2); }' )
21
22 # Get the kernel version
23 eval $( head -n 5 "${k_dir}/Makefile" \
24 |sed -e 's/^/K_/; s/"//g; s/ = \{0,1\}/="/; s/$/"/;' \
25 )
26 k_cset="$( cd "${k_dir}"; \
27 git log -n 1 --pretty='format:%H' \
28 )"
29 printf "Found Linux kernel %d.%d.%d%s '%s' (%7.7s)\n" \
30 "${K_VERSION}" "${K_PATCHLEVEL}" "${K_SUBLEVEL}" \
31 "${K_EXTRAVERSION}" "${K_NAME}" "${k_cset}"
32
33 # Get the kconfig-frontends version
34 kf_version="$( tail -n 1 .version )"
35
36 # Store the new version
37 printf "%d.%d.%d%s %s %s\n%s\n" \
38 "${K_VERSION}" "${K_PATCHLEVEL}" \
39 "${K_SUBLEVEL}" "${K_EXTRAVERSION}" \
40 "${k_cset}" "${K_NAME}" \
41 "${kf_version}" \
42 >.version
43
44 # Sync-up the files
45 k_files=""
46 while read k_file trash kf_file; do
47 k_files="${k_files} ${k_file}"
48 mkdir -p "${kf_file%/*}"
49 cp -v "${k_dir}/${k_file}" "${kf_file}"
50 if [ -f "${kf_file}.patch" ]; then
51 patch --no-backup-if-mismatch -g0 -F1 -p1 -f <"${kf_file}.patch"
52 fi
53 done <scripts/ksync.list
54
55 # Save the changelog between the old cset and now
56 printf "Synced-up these changes:\n"
57 ( cd "${k_dir}"
58 git log --no-merges --pretty='tformat:%h %s' \
59 "${k_cset_old}..${k_cset}" \
60 ${k_files} \
61 )|tac \
62 |tee -a "scripts/ksync.log" \
63 |sed -e 's/^/ /;'