Implement tag translation

Busybox uses tags with underscores instead of dots.
This commit translates between the two forms in the
shell script.
This commit is contained in:
Mikaël Bouillot 2017-04-10 22:00:54 +02:00
parent dbe813ce88
commit 3ae5fac4bf
2 changed files with 27 additions and 9 deletions

View file

@ -18,7 +18,7 @@
<div id="logo">
<h1>Linux Cross Reference</h1>
<h2><a href="http://free-electrons.com">Free Electrons: Embedded Linux Experts</a></h2>
<p>&nbsp;&bull;&nbsp;<a href="/linux/v4.9/source">Linux</a>&nbsp;&bull;&nbsp;<a href="/u-boot/v2016.11/source">U-Boot</a>&nbsp;&bull;&nbsp;<a href="/busybox/1_26_1/source">Busybox</a>&nbsp;&bull;&nbsp;</p>
<p>&nbsp;&bull;&nbsp;<a href="/linux/v4.9/source">Linux</a>&nbsp;&bull;&nbsp;<a href="/u-boot/v2016.11/source">U-Boot</a>&nbsp;&bull;&nbsp;<a href="/busybox/1.26.1/source">Busybox</a>&nbsp;&bull;&nbsp;</p>
<p>
&nbsp;&bull;&nbsp;<a href="$vvar/source">source navigation</a>&nbsp;&bull;&nbsp;<a href="$vvar/ident">identifier search</a>&nbsp;&bull;&nbsp;<a href="$vvar/search">freetext search</a>&nbsp;&bull;&nbsp;<a href="http://lxr.free-electrons.com" style="color:#00FF00">Back to LXR</a>&nbsp;&bull;&nbsp;
</p>

View file

@ -35,16 +35,29 @@ denormalize()
echo $1 | cut -c 2-
}
project=$(basename `dirname $LXR_REPO_DIR`)
case $project in
busybox)
version_dir() { tr '_.' '._'; }
version_rev() { tr '._' '_.'; }
;;
*)
version_dir() { cat; }
version_rev() { cat; }
;;
esac
case $cmd in
list-tags)
tags=$(
git tag |
version_dir |
sed 's/$/.0/' |
sort -V |
sed 's/\.0$//'
)
if [ $1 = '-h' ]; then
project=$(basename `dirname $LXR_REPO_DIR`)
if [ "$1" = '-h' ]; then
case $project in
linux)
echo "$tags" |
@ -71,7 +84,7 @@ case $cmd in
busybox)
echo "$tags" |
tac |
sed -r 's/^([0-9])_([0-9]*)(.*)$/v\1 \1_\2 \1_\2\3/'
sed -r 's/^([0-9])\.([0-9]*)(.*)$/v\1 \1.\2 \1.\2\3/'
;;
*)
echo "$tags" |
@ -85,7 +98,8 @@ case $cmd in
;;
get-type)
git cat-file -t "$1:`denormalize $2`" 2>/dev/null
v=`echo $1 | version_rev`
git cat-file -t "$v:`denormalize $2`" 2>/dev/null
;;
get-blob)
@ -93,11 +107,13 @@ case $cmd in
;;
get-file)
git cat-file blob "$1:`denormalize $2`" 2>/dev/null
v=`echo $1 | version_rev`
git cat-file blob "$v:`denormalize $2`" 2>/dev/null
;;
get-dir)
git ls-tree -l "$1:`denormalize $2`" 2>/dev/null |
v=`echo $1 | version_rev`
git ls-tree -l "$v:`denormalize $2`" 2>/dev/null |
awk '{print $2" "$5" "$4}' |
grep -v ' \.' |
sort -t ' ' -k 1,1r -k 2,2
@ -114,7 +130,8 @@ case $cmd in
format='\1'
fi
git ls-tree -r "$1" |
v=`echo $1 | version_rev`
git ls-tree -r "$v" |
sed -r "s/^\S* blob (\S*)\t(([^/]*\/)*(.*))$/$format/"
;;
@ -122,7 +139,8 @@ case $cmd in
if [ "$1" = -b ]; then
ref=$2
else
ref="$1:`denormalize $2`"
v=`echo $1 | version_rev`
ref="$v:`denormalize $2`"
fi
git cat-file blob $ref 2>/dev/null |