setlocalversion (3354c64d418460c500080fddb1171d8e17622a06) | setlocalversion (01e89a4acefc9d8356e91dde310da11e5b97d22d) |
---|---|
1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# 4# This scripts adds local version information from the version 5# control system git. 6# 7# If something goes wrong, send a mail the kernel build mailinglist 8# (see MAINTAINERS) and CC Nico Schottelius --- 43 unchanged lines hidden (view full) --- 52 if test -n "$(git rev-parse --show-cdup 2>/dev/null)"; then 53 return 54 fi 55 56 if ! head=$(git rev-parse --verify HEAD 2>/dev/null); then 57 return 58 fi 59 | 1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# 4# This scripts adds local version information from the version 5# control system git. 6# 7# If something goes wrong, send a mail the kernel build mailinglist 8# (see MAINTAINERS) and CC Nico Schottelius --- 43 unchanged lines hidden (view full) --- 52 if test -n "$(git rev-parse --show-cdup 2>/dev/null)"; then 53 return 54 fi 55 56 if ! head=$(git rev-parse --verify HEAD 2>/dev/null); then 57 return 58 fi 59 |
60 # If a localversion*' file and the corresponding annotated tag exist, 61 # use it. This is the case in linux-next. | 60 # mainline kernel: 6.2.0-rc5 -> v6.2-rc5 61 # stable kernel: 6.1.7 -> v6.1.7 62 version_tag=v$(echo "${KERNELVERSION}" | sed -E 's/^([0-9]+\.[0-9]+)\.0(.*)$/\1\2/') 63 64 # If a localversion* file exists, and the corresponding 65 # annotated tag exists and is an ancestor of HEAD, use 66 # it. This is the case in linux-next. |
62 tag=${file_localversion#-} | 67 tag=${file_localversion#-} |
63 tag=$(git describe --exact-match --match=$tag $tag 2>/dev/null) | 68 desc= 69 if [ -n "${tag}" ]; then 70 desc=$(git describe --match=$tag 2>/dev/null) 71 fi |
64 | 72 |
73 # Otherwise, if a localversion* file exists, and the tag 74 # obtained by appending it to the tag derived from 75 # KERNELVERSION exists and is an ancestor of HEAD, use 76 # it. This is e.g. the case in linux-rt. 77 if [ -z "${desc}" ] && [ -n "${file_localversion}" ]; then 78 tag="${version_tag}${file_localversion}" 79 desc=$(git describe --match=$tag 2>/dev/null) 80 fi 81 |
|
65 # Otherwise, default to the annotated tag derived from KERNELVERSION. | 82 # Otherwise, default to the annotated tag derived from KERNELVERSION. |
66 # mainline kernel: 6.2.0-rc5 -> v6.2-rc5 67 # stable kernel: 6.1.7 -> v6.1.7 68 if [ -z "${tag}" ]; then 69 tag=v$(echo "${KERNELVERSION}" | sed -E 's/^([0-9]+\.[0-9]+)\.0(.*)$/\1\2/') | 83 if [ -z "${desc}" ]; then 84 tag="${version_tag}" 85 desc=$(git describe --match=$tag 2>/dev/null) |
70 fi 71 72 # If we are at the tagged commit, we ignore it because the version is 73 # well-defined. | 86 fi 87 88 # If we are at the tagged commit, we ignore it because the version is 89 # well-defined. |
74 if [ -z "$(git describe --exact-match --match=$tag 2>/dev/null)" ]; then | 90 if [ "${tag}" != "${desc}" ]; then |
75 76 # If only the short version is requested, don't bother 77 # running further git commands 78 if $short; then 79 echo "+" 80 return 81 fi 82 # If we are past the tagged commit, we pretty print it. 83 # (like 6.1.0-14595-g292a089d78d3) | 91 92 # If only the short version is requested, don't bother 93 # running further git commands 94 if $short; then 95 echo "+" 96 return 97 fi 98 # If we are past the tagged commit, we pretty print it. 99 # (like 6.1.0-14595-g292a089d78d3) |
84 if atag="$(git describe --match=$tag 2>/dev/null)"; then 85 echo "$atag" | awk -F- '{printf("-%05d", $(NF-1))}' | 100 if [ -n "${desc}" ]; then 101 echo "${desc}" | awk -F- '{printf("-%05d", $(NF-1))}' |
86 fi 87 88 # Add -g and exactly 12 hex chars. 89 printf '%s%s' -g "$(echo $head | cut -c1-12)" 90 fi 91 92 if ${no_dirty}; then 93 return --- 77 unchanged lines hidden --- | 102 fi 103 104 # Add -g and exactly 12 hex chars. 105 printf '%s%s' -g "$(echo $head | cut -c1-12)" 106 fi 107 108 if ${no_dirty}; then 109 return --- 77 unchanged lines hidden --- |