Changeset 8307474 for git-version.sh


Ignore:
Timestamp:
12/04/2021 03:28:15 PM (2 years ago)
Author:
Thomas Trepl (Moody) <thomas@…>
Branches:
lazarus
Children:
e6974d1
Parents:
b22e4ceb (diff), edd2feb7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'trunk' into lazarus

File:
1 edited

Legend:

Unmodified
Added
Removed
  • git-version.sh

    rb22e4ceb r8307474  
    11#!/bin/sh
     2
     3if [ "$1" = sysv ]; then
     4        SYSV="INCLUDE"
     5        SYSTEMD="IGNORE "
     6elif [ "$1" = systemd ]; then
     7        SYSV="IGNORE "
     8        SYSTEMD="INCLUDE"
     9else
     10        echo You must provide either \"sysv\" or \"systemd\" as argument
     11        exit 1
     12fi
     13
     14echo "<!ENTITY % sysv    \"$SYSV\">"     >  conditional.ent
     15echo "<!ENTITY % systemd \"$SYSTEMD\">"  >> conditional.ent
    216
    317if ! git status > /dev/null; then
    418        # Either it's not a git repository, or git is unavaliable.
    519        # Just workaround.
    6         echo "<!ENTITY version           \"unknown\">"         >  version.ent
    7         echo "<!ENTITY versiond          \"unknown-systemd\">" >> version.ent
     20        echo "<!ENTITY year              \"????\">"            >  version.ent
     21        echo "<!ENTITY version           \"unknown\">"        >> version.ent
    822        echo "<!ENTITY releasedate       \"unknown\">"         >> version.ent
    9         echo "<!ENTITY copyrightdate     \"1999-2021\">"       >> version.ent
     23        echo "<!ENTITY pubdate           \"unknown\">"         >> version.ent
    1024        exit 0
    1125fi
     
    1933year=$(date --date "$commit_date" "+%Y")
    2034month=$(date --date "$commit_date" "+%B")
    21 month_digit=$(date --date "$commit_date" "+%m")
    2235day_digit=$(date --date "$commit_date" "+%d")
    2336day=$(echo $day_digit | sed 's/^0//')
     
    3346
    3447sha="$(git describe --abbrev=1)"
    35 if git describe --all --match trunk > /dev/null 2> /dev/null; then
    36         sha=$(echo "$sha" | sed 's/-g[^-]*$//')
    37 fi
    38 version="$sha"
     48version=$(echo "$sha" | sed 's/-g[^-]*$//')
    3949
    4050if [ "$(git diff HEAD | wc -l)" != "0" ]; then
     
    4252fi
    4353
    44 echo "<!ENTITY day               \"$day_digit\">"          >  version.ent
    45 echo "<!ENTITY month             \"$month_digit\">"        >> version.ent
    46 echo "<!ENTITY year              \"$year\">"               >> version.ent
    47 echo "<!ENTITY copyrightdate     \"2001-$year\">"          >> version.ent
     54echo "<!ENTITY year              \"$year\">"               >  version.ent
    4855echo "<!ENTITY version           \"$version\">"            >> version.ent
    4956echo "<!ENTITY releasedate       \"$full_date\">"          >> version.ent
Note: See TracChangeset for help on using the changeset viewer.