summaryrefslogtreecommitdiffstats
path: root/templates/base/01_setup_pkg_revision.sh
blob: 034256c7d11cc725b22f55fdbe2908ef727cd386 (plain)
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

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: 
# use a function to be neutral with other fragments
function 01_setup_pkg_revision() {
    # BASH_SOURCE can't be used as this fragment is concatenated in a larger script
    local THIS=meta-agl/templates/base/01_setup_pkg_revision.sh

    # RPMREVISION and LOCALCONF must be set previously in the setup script
    [[ -z "$RPMREVISION" || -z "$LOCALCONF" ]] && return 0

    echo "INFO: using RPM revision schema $RPMREVISION"

    cat <<EOF >> $LOCALCONF

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# fragment {
# generated by $THIS "$RPMREVISION"
#

EOF

    case "$RPMREVISION" in
        prservice*)
            [[ $RPMREVISION =~ ^prservice(:([^ \t\n]+))?$ ]] && {
                echo "PRSERV_HOST ?= \"${BASH_REMATCH[2]:-localhost:0}\"" >> $LOCALCONF
            } || {
                echo "ERROR ($THIS): invalid address specified for PR Service"
                return 1
            }
            ;;
        timestamp)
            AGL_PR=$(date --utc '+%Y%m%d.%H%M%S')
            cat <<'EOF' >> $LOCALCONF
# to re-generate AGL_PR the same way as aglsetup does, run:
#   echo "AGL_PR ?= \"$(date --utc '+%Y%m%d.%H%M%S')\""
EOF
            echo "AGL_PR ?= \"${AGL_PR}\"" >> $LOCALCONF;
            cat <<'EOF' >> $LOCALCONF
PKGR = "${PR}${EXTENDPRAUTO}.${AGL_PR}"
PKGV = "${@ '${PV}'.replace('AUTOINC','${AGL_PR}')}"
BB_HASHBASE_WHITELIST_append = " PKGR PKGV"
EOF
            ;;
        value:*)
            echo "AGL_PR ?= \"${RPMREVISION#value:}\"" >> $LOCALCONF;
            cat <<'EOF' >> $LOCALCONF
PKGR = "${PR}${EXTENDPRAUTO}.${AGL_PR}"
PKGV = "${@ '${PV}'.replace('AUTOINC','${AGL_PR}')}"
BB_HASHBASE_WHITELIST_append = " PKGR PKGV"
EOF
            ;;
        none)
            # do nothing
            ;;
        *)
            echo "ERROR ($THIS): unknown package revision method '$REVISION'"
            return 1
            ;;
    esac

    cat <<'EOF' >> $LOCALCONF

#
# }
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
EOF

}

01_setup_pkg_revision
s="o">= pluginApis; return (plugin); };