[LEDE-DEV] [PATCH] scripts: getver.sh: include branch name in a revision string
Matthias Schiffer
mschiffer at universe-factory.net
Thu Jun 22 04:54:00 PDT 2017
On 06/22/2017 10:50 AM, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal at milecki.pl>
>
> The purpose of revision (r* number) is to provide a rough info about
> build next to the (very) specific SHA-1. Unfortunately without a branch
> name specified it's a bit misleading and what's more two commits may get
> the same revision, e.g.:
>
> For master branch:
> ./scripts/getver.sh bb9d2aa868
> r3438-bb9d2aa868
>
> For lede-17.01 branch:
> ./scripts/getver.sh 2e206c79cc
> r3438-2e206c79cc
>
> This can be solved by prepending a branch name so above example would
> look like this:
>
> ./scripts/getver.sh 2e206c79cc
> master-r2993+445-b9a408c2b4
>
> Another option is to simply use "git describe" but it doesn't provide
> info on amount of local commits so let's stick to own method for now.
>
> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
I don't think using the branch name is a good idea, as it may be a local
branch that still doesn't necessarily carry any information about the
remote branch it is based on.
Trying to base the branch name on the base branch (as it is already done
for the revision number and commit ID getver.sh returns) might be better,
but I'd prefer simply adding a branch name to a file that is read by
getver.sh as soon as a stable branch is created. It will need a bit of
additional work if the revision for a specific commit ID is requested
instead of the current state, but it should be doable.
Matthias
> ---
> scripts/getver.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/getver.sh b/scripts/getver.sh
> index 9175f411db..479cf25b7d 100755
> --- a/scripts/getver.sh
> +++ b/scripts/getver.sh
> @@ -40,7 +40,7 @@ try_git() {
> REV="${UPSTREAM_REV}+$((REV - UPSTREAM_REV))"
> fi
>
> - REV="${REV:+r$REV-$(git log -n 1 --format="%h" $UPSTREAM_BASE)}"
> + REV="${BRANCH}-${REV:+r$REV-$(git log -n 1 --format="%h" $UPSTREAM_BASE)}"
>
> ;;
> esac
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/lede-dev/attachments/20170622/b0f6cb62/attachment.sig>
More information about the Lede-dev
mailing list