Fix printing the branch used in Git

... and prefer exact specified name, if it exists.
More bootstrap script specifications for packages.

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2017-06-28 22:19:33 -07:00
parent f672e3df89
commit c7a924a073
9 changed files with 36 additions and 4 deletions

14
TODO
View File

@ -2,8 +2,18 @@ TBD
packages todo
[ ] mention custom glibc addons are no longer handled (even though they never fully were, ct-ng would be unable to fetch them unless they were secretly placed into the download area)
[ ] mention incompatibility of sample options
[ ] version-locked packages
[ ] make glibc-ports package for glibc <2.17 (it has its own repo)
[X] version-locked packages
[X] make glibc-ports package for glibc <2.17 (it has its own repo)
[ ] convert gen-kconfig to use templates
[ ] switch to checked in generated files (config/versions, config/gen) - take too long to generate
[ ] new packages
[ ] config.guess
[ ] gnulib
[ ] use gnulib in m4, gettext, libiconv, libtool
[ ] autoconf-archive
[ ] use to retrieve ax_pthread.m4 (gettext?)
[ ] some way of patching development sources - version based? or just directory with "apply-to-any-revision" patches.
[ ] dependencies like cloog
A (slightly) ordered set of tasks for crosstool-NG. Written in a cryptic language; contact me if you want to help with any of these :)

View File

@ -1,2 +1,3 @@
repository='git git://git.sv.gnu.org/autoconf'
bootstrap='autoreconf -vi'
mirrors='$(CT_Mirrors GNU autoconf)'

View File

@ -1,2 +1,3 @@
repository='git https://git.savannah.gnu.org/git/automake.git'
bootstrap='./bootstrap'
mirrors='$(CT_Mirrors GNU automake)'

View File

@ -1,2 +1,3 @@
repository='git git://git.savannah.gnu.org/libtool.git'
bootstrap='./bootstrap'
mirrors='$(CT_Mirrors GNU libtool)'

View File

@ -1,2 +1,3 @@
repository='git git://git.debian.org/git/collab-maint/ltrace.git'
bootstrap='./autogen.sh'
mirrors='http://ftp.debian.org/debian/pool/main/l/ltrace ftp:://ftp.debian.org/debian/pool/main/l/ltrace'

View File

@ -1,2 +1,3 @@
repository='git git://git.sv.gnu.org/m4'
bootstrap='./bootstrap'
mirrors='$(CT_Mirrors GNU m4)'

View File

@ -1,2 +1,3 @@
repository='git https://git.savannah.gnu.org/git/make.git'
bootstrap='autoreconf -i'
mirrors='$(CT_Mirrors GNU make)'

View File

@ -1,2 +1,3 @@
repository='git https://git.code.sf.net/p/strace/code'
bootstrap='./bootstrap'
mirrors='http://downloads.sourceforge.net/project/strace/strace/${CT_STRACE_VERSION}'

View File

@ -1629,6 +1629,7 @@ CT_GetVersion_git()
if [ -z "${devel_revision}" ]; then
local matches=`git ls-remote --exit-code "${devel_url}" --refs "${devel_branch}" \
|| echo "not found"`
local best using ref
# Cannot test $?, setting a trap on ERR prevents bash from returning the
# status code.
@ -1636,9 +1637,22 @@ CT_GetVersion_git()
CT_Abort "Failed to find git ref ${devel_branch} at ${devel_url}"
fi
if [ `echo "${matches}" | wc -l` -gt 1 ]; then
CT_DoLog WARN "Ambiguous ref ${devel_branch} at ${devel_url}, using first"
if echo "${matches}" | grep '[[:space:]]\(refs/heads/\)\?'"${devel_branch}\$" >/dev/null; then
# Try exact match, or prepended with "refs/heads". Some projects (e.g. binutils)
# have refs/original/refs/heads/master as well as refs/heads/master, and
# `git ls-remote refs/heads/master` prints both.
best=`echo "${matches}" | grep '[[:space:]]\(refs/heads/\)\?'"${devel_branch}\$"`
using="best match"
else
best=`echo "${matches}" | head -n1`
using="first"
fi
devel_revision=`echo "$matches" | head -n1 | cut -c1-8`
ref=`echo "${best}" | sed 's/.*[[:space:]]//'`
CT_DoLog WARN "Ambiguous ref ${devel_branch} at ${devel_url}, using ${using} (${ref})"
else
best="${matches}"
fi
devel_revision=`echo "${best}" | cut -c1-8`
CT_DoLog DEBUG "ref ${devel_branch} at ${devel_url} has cset of ${devel_revision}"
fi
basename="${pkg_name}-${devel_revision}"
@ -1647,6 +1661,7 @@ CT_GetVersion_git()
# Retrieve sources from Git.
CT_Download_git()
{
# Git does not allow making a shallow clone of a specific commit.
CT_DoExecLog ALL git clone "${devel_url}" "${pkg_name}"
CT_Pushd "${pkg_name}"
CT_DoExecLog ALL git checkout "${devel_revision}" --