From b9af225f58e45c7fae7eb9d3689fe939243e7578 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Tue, 16 May 2017 23:30:20 -0700 Subject: Implement "milestones" for packages Also get rid of dependency on GNU sort. Signed-off-by: Alexey Neyman diff --git a/config/binutils/binutils.in b/config/binutils/binutils.in index 69787ef..5e5cc67 100644 --- a/config/binutils/binutils.in +++ b/config/binutils/binutils.in @@ -5,11 +5,19 @@ comment "GNU binutils" source "config/versions/binutils.in" config BINUTILS_HAS_HASH_STYLE - default y if BINUTILS_V_2_23_2_or_later || BINUTILS_LINARO_V_2_23_2_2013_10_4_or_later + default y if BINUTILS_MS_2_23 bool config BINUTILS_HAS_GOLD - default y if BINUTILS_V_2_23_2_or_later || BINUTILS_LINARO_V_2_23_2_2013_10_4_or_later + default y if BINUTILS_MS_2_23 + bool + +config BINUTILS_HAS_PLUGINS + default y if BINUTILS_MS_2_23 + bool + +config BINUTILS_HAS_PKGVERSION_BUGURL + default y if BINUTILS_MS_2_23 bool # gold only suports the listed architectures @@ -25,14 +33,6 @@ config BINUTILS_GOLD_SUPPORT depends on BINUTILS_GOLD_SUPPORTS_ARCH depends on ! STATIC_TOOLCHAIN -config BINUTILS_HAS_PLUGINS - default y if BINUTILS_V_2_23_2_or_later || BINUTILS_LINARO_V_2_23_2_2013_10_4_or_later - bool - -config BINUTILS_HAS_PKGVERSION_BUGURL - default y if BINUTILS_V_2_23_2_or_later || BINUTILS_LINARO_V_2_23_2_2013_10_4_or_later - bool - # Force using the BFD linker if needed. There are two options: # - For some C libraries (eg. glibc at least), BFD ld must be # built and be selected by default. diff --git a/config/cc/gcc.in b/config/cc/gcc.in index a87b7db..427fc97 100644 --- a/config/cc/gcc.in +++ b/config/cc/gcc.in @@ -32,7 +32,7 @@ config CC_GCC_GOLD default y config CC_GCC_HAS_LIBMPX - depends on GCC_V_5_4_0_or_later || GCC_LINARO_V_5_4_2017_01_or_later + depends on GCC_MS_5 bool config CC_LANG_JAVA_USE_ECJ diff --git a/maintainer/gen-versions.sh b/maintainer/gen-versions.sh index ca6766d..83a2eb5 100755 --- a/maintainer/gen-versions.sh +++ b/maintainer/gen-versions.sh @@ -186,9 +186,10 @@ run_template() config_dir=config/versions template=maintainer/kconfig-versions.template -declare -A pkg_forks +declare -A pkg_forks pkg_milestones declare -a pkg_masters pkg_nforks pkg_all +# Convert the argument to a Kconfig-style macro kconfigize() { local v="${1}" @@ -197,6 +198,158 @@ kconfigize() echo "${v^^}" } +# Helper for cmp_versions: compare an upstream/debian portion of +# a version. Returns 0 if equal, otherwise echoes "-1" or "1" and +# returns 1. +equal_versions() +{ + local v1="${1}" + local v2="${2}" + local p1 p2 + + # Compare alternating non-numerical/numerical portions, until + # non-equal portion is found or either string is exhausted. + while [ -n "${v1}" -a -n "${v2}" ]; do + # Find non-numerical portions and compare lexicographically + p1="${v1%%[0-9]*}" + p2="${v2%%[0-9]*}" + v1="${v1#${p1}}" + v2="${v2#${p2}}" + #debug "lex [${p1}] v [${p2}]" + if [ "${p1}" \< "${p2}" ]; then + echo "-1" + return 1 + elif [ "${p1}" \> "${p2}" ]; then + echo "1" + return 1 + fi + #debug "rem [${v1}] v [${v2}]" + # Find numerical portions and compare numerically + p1="${v1%%[^0-9]*}" + p2="${v2%%[^0-9]*}" + v1="${v1#${p1}}" + v2="${v2#${p2}}" + #debug "num [${p1}] v [${p2}]" + if [ "${p1:-0}" -lt "${p2:-0}" ]; then + echo "-1" + return 1 + elif [ "${p1:-0}" -gt "${p2:-0}" ]; then + echo "1" + return 1 + fi + #debug "rem [${v1}] v [${v2}]" + done + if [ -n "${v1}" ]; then + echo "1" + return 1 + elif [ -n "${v2}" ]; then + echo "-1" + return 1 + fi + return 0 +} + +# Compare two version strings, similar to sort -V. But we don't +# want to depend on GNU sort availability on the host. +# See http://www.debian.org/doc/debian-policy/ch-controlfields.html +# for description of what the version is expected to be. +# Returns "-1", "0" or "1" if first version is earlier, same or +# later than the second. +cmp_versions() +{ + local v1="${1}" + local v2="${2}" + local e1=0 e2=0 u1 u2 d1=0 d2=0 + + # Case-insensitive comparison + v1="${v1^^}" + v2="${v2^^}" + + # Find if the versions contain epoch part + case "${v1}" in + *:*) + e1="${v1%%:*}" + v1="${v1#*:}" + ;; + esac + case "${v2}" in + *:*) + e2="${v2%%:*}" + v2="${v2#*:}" + ;; + esac + + # Compare epochs numerically + if [ "${e1}" -lt "${e2}" ]; then + echo "-1" + return + elif [ "${e1}" -gt "${e2}" ]; then + echo "1" + return + fi + + # Find if the version contains a "debian" part. + # v1/v2 will now contain "upstream" part. + case "${v1}" in + *-*) + d1=${v1##*-} + v1=${v1%-*} + ;; + esac + case "${v2}" in + *-*) + d2=${v2##*-} + v2=${v2%-*} + ;; + esac + + # Compare upstream + if equal_versions "${v1}" "${v2}" && equal_versions "${d1}" "${d2}"; then + echo "0" + fi +} + +# Sort versions, descending +sort_versions() +{ + local sorted + local remains="$*" + local next_remains + local v vx found + + while [ -n "${remains}" ]; do + #debug "Sorting [${remains}]" + for v in ${remains}; do + found=yes + next_remains= + #debug "Candidate ${v}" + for vx in ${remains}; do + #debug "${v} vs ${vx} :: `cmp_versions ${v} ${vx}`" + case `cmp_versions ${v} ${vx}` in + 1) + next_remains+=" ${vx}" + ;; + 0) + ;; + -1) + found=no + #debug "Bad: earlier than ${vx}" + break + ;; + esac + done + if [ "${found}" = "yes" ]; then + # $v is less than all other members in next_remains + sorted+=" ${v}" + remains="${next_remains}" + #debug "Good candidate ${v} sorted [${sorted}] remains [${remains}]" + break + fi + done + done + echo "${sorted}" +} + read_file() { local l @@ -232,6 +385,7 @@ find_forks() else pkg_nforks[${1}]=$[pkg_nforks[${1}]+1] pkg_forks[${1}]="${1}${pkg_forks[${1}]}" + pkg_milestones[${1}]=`sort_versions ${info[milestones]}` pkg_masters+=( "${1}" ) fi } @@ -271,8 +425,8 @@ enter_fork() fi versions=`cd packages/${fork} && \ - for f in */version.desc; do [ -r "${f}" ] && echo "${f%/version.desc}"; done | \ - sort -rV | xargs echo` + for f in */version.desc; do [ -r "${f}" ] && echo "${f%/version.desc}"; done` + versions=`sort_versions ${versions}` set_iter version ${versions} info[all_versions]=${versions} @@ -292,10 +446,17 @@ enter_fork() fi } +set_latest_milestone() +{ + if [ `cmp_versions ${info[ms]} ${info[ver]}` -le 0 -a -z "${milestone}" ]; then + milestone=${info[ms_kcfg]} + fi +} + enter_version() { local version="${1}" - local tmp + local tmp milestone # Set defaults info[obsolete]= @@ -304,9 +465,28 @@ enter_version() eval `read_version_desc ${info[name]} ${version}` info[ver]=${version} info[kcfg]=`kconfigize ${version}` + # TBD do we need "prev" version? tmp=" ${info[all_versions]} " tmp=${tmp##* ${version} } info[prev]=`kconfigize ${tmp%% *}` + + # Find the latest milestone preceding this version + milestone= + do_foreach milestone set_latest_milestone + info[milestone]=${milestone} +} + +enter_milestone() +{ + local ms="${1}" + local tmp + + info[ms]=${ms} + info[ms_kcfg]=`kconfigize ${ms}` + + tmp=" ${info[all_milestones]} " + tmp=${tmp##* ${ms} } + info[ms_prev]=`kconfigize ${tmp%% *}` } rm -rf "${config_dir}" @@ -338,8 +518,11 @@ for p in "${pkg_masters[@]}"; do [master]=${p} \ [masterpfx]=`kconfigize ${p}` \ [nforks]=${pkg_nforks[${p}]} \ + [all_milestones]=${pkg_milestones[${p}]} \ ) set_iter fork ${pkg_forks[${p}]} + set_iter milestone ${pkg_milestones[${p}]} + # TBD check that origins are set for all forks if there is more than one? or is it automatic because of a missing variable check? # TBD get rid of the "origin" completely and use just the fork name? run_template "${template}" diff --git a/maintainer/kconfig-versions.template b/maintainer/kconfig-versions.template index c7ab53f..9a04f57 100644 --- a/maintainer/kconfig-versions.template +++ b/maintainer/kconfig-versions.template @@ -56,7 +56,7 @@ config @@pfx@@_SRC_DEVEL bool "Vendor repository" help Check out from vendor repository at: - @@repository@@ + @@repository_url@@ #!end-if config @@pfx@@_SRC_CUSTOM @@ -112,7 +112,15 @@ choice #!foreach version config @@pfx@@_V_@@kcfg@@ bool "@@ver@@" - select @@pfx@@_V_@@kcfg@@_or_later +#!if [ "@@obsolete@@" = "yes" ] + depends on OBSOLETE +#!end-if +#!if [ "@@experimental@@" = "yes" ] + depends on EXPERIMENTAL +#!end-if +#!if [ -n "@@milestone@@" ] + select @@masterpfx@@_MS_@@milestone@@ +#!end-if #!end-foreach endchoice @@ -128,13 +136,13 @@ config @@pfx@@_VERSION #!end-foreach default "unknown" -#!foreach version -config @@pfx@@_V_@@kcfg@@_or_later +#!end-foreach + +#!foreach milestone +config @@masterpfx@@_MS_@@ms_kcfg@@ bool -#!if [ -n "@@prev@@" ] - select @@pfx@@_V_@@prev@@_or_later +#!if [ -n "@@ms_prev@@" ] + select @@masterpfx@@_MS_@@ms_prev@@ #!end-if #!end-foreach - -#!end-foreach diff --git a/packages/binutils/package.desc b/packages/binutils/package.desc index 8ed4e5e..54845f8 100644 --- a/packages/binutils/package.desc +++ b/packages/binutils/package.desc @@ -1,3 +1,4 @@ repository="git git://sourceware.org/git/binutils-gdb.git" download_url="TBD other mirrors https://ftp.gnu.org/gnu/binutils/binutils-${version}.${format}" origin="GNU" +milestones="2.23" diff --git a/packages/gcc/package.desc b/packages/gcc/package.desc index efd8f80..ce6c216 100644 --- a/packages/gcc/package.desc +++ b/packages/gcc/package.desc @@ -1,3 +1,4 @@ repository="svn svn://gcc.gnu.org/svn/gcc" download_url="TBD other mirrors ftp://ftp.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.${format}" origin="GNU" +milestones="5" -- cgit v0.10.2-6-g49f6