summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2011-08-31 23:35:02 +0200
committerPeter Korsgaard <jacmet@sunsite.dk>2011-09-17 08:14:11 +0200
commitf082c7c5cf72296566dcf92bba4fcb4c95f2186f (patch)
tree755b968c86505d8746ba179a2e3751d0f0415703 /scripts
parent3e304db0f0ef583efb250a19663259bb6dc60c93 (diff)
support: move scripts/ to a new support/ directory
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-ext3-img152
-rwxr-xr-xscripts/copy.sh20
-rwxr-xr-xscripts/graph-depends169
-rwxr-xr-xscripts/mkmakefile47
-rwxr-xr-xscripts/pkg-stats284
-rwxr-xr-xscripts/setlocalversion72
6 files changed, 0 insertions, 744 deletions
diff --git a/scripts/build-ext3-img b/scripts/build-ext3-img
deleted file mode 100755
index 1cab710c2..000000000
--- a/scripts/build-ext3-img
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/bin/sh
-
-BLOCKSIZE=516096
-WORKING_DIR=`pwd`
-
-echo "This script will create a bootable ext3 image from buildroot."
-
-echo "Enter the path to the image (${WORKING_DIR})"
-read IMG_PATH
-
-if [ "${IMAGE_PATH}" = "" ]; then
- IMAGE_PATH=${WORKING_DIR}
-fi
-
-echo "Enter the name of the image file (buildroot.img)"
-read IMG_NAME
-
-if [ "${IMAGE_NAME}" = "" ]; then
- IMAGE_NAME="buildroot.img"
-fi
-
-IMAGE=${IMAGE_PATH}/${IMAGE_NAME}
-
-echo "Enter the path and filename for the root filesystem"
-echo "tarball that you want to install into the image"
-read ROOT_PATH
-
-if [ "${ROOT_PATH}" = "" ]; then
- echo "Error: you must specify a path."
- exit 1
-fi
-
-CYLINDERS=`du --summarize --block-size=${BLOCKSIZE} ${ROOT_PATH}`
-BYTE_SIZE=`du --summarize --block-size=${BLOCKSIZE} --human-readable ${ROOT_PATH}`
-
-CYLINDERS=${CYLINDERS%${ROOT_PATH}}
-BYTE_SIZE=${BYTE_SIZE%${ROOT_PATH}}
-
-CYLINDERS=`expr ${CYLINDERS} "*" 2`
-
-echo "Now I will create an ext3 image file"
-echo "using ${CYLINDERS} cylinders, with ${BLOCKSIZE} bytes per block"
-echo "in other words, ${BYTE_SIZE}bytes..."
-
- dd if=/dev/zero of=${IMAGE} bs=${BLOCKSIZE}c count=${CYLINDERS}
-
-# Create file partition and filesystem
-
- # STEP 1. create partition
- /sbin/losetup /dev/loop3 ${IMAGE}
- # probably should figure out how to use GNU parted to do this non-interactively
- /sbin/fdisk -u -C${CYLINDERS} -S63 -H16 /dev/loop3
- /sbin/losetup -d /dev/loop3
-
- # STEP 2. make file system (ext3)
- /sbin/losetup -o 32256 /dev/loop3 ${IMAGE}
- /sbin/mkfs.ext3 /dev/loop3
- /sbin/losetup -d /dev/loop3
-
-# Install Software to the image
- mkdir -p ${IMAGE_PATH}/temp
- mount -o offset=32256,loop ${IMAGE} ${IMAGE_PATH}/temp
- tar -xvf ${ROOT_PATH} --directory ${IMAGE_PATH}/temp
- # make sure to unmount the image
- umount ${IMAGE_PATH}/temp
- rm -rf ${IMAGE_PATH}/temp
-
-# Create a VMware .vmx file
-cat > ${IMAGE_PATH}/buildroot.vmx <<EOF
-config.version = "8"
-virtualHW.version = "3"
-
-uuid.location = "56 4d 5c cc 3d 4a 43 29-55 89 5c 28 1e 7e 06 58"
-uuid.bios = "56 4d 5c cc 3d 4a 43 29-55 89 5c 28 1e 7e 06 58"
-
-uuid.action = "create"
-checkpoint.vmState = ""
-
-displayName = "Buildroot"
-annotation = ""
-guestinfo.vmware.product.long = ""
-guestinfo.vmware.product.url = "http://dcgrendel.be/vmbuilder/"
-
-guestOS = "linux"
-numvcpus = "1"
-memsize = "256"
-paevm = "FALSE"
-sched.mem.pshare.enable = "TRUE"
-MemAllowAutoScaleDown = "FALSE"
-
-MemTrimRate = "-1"
-
-nvram = "nvram"
-
-mks.enable3d = "FALSE"
-vmmouse.present = "TRUE"
-
-tools.syncTime = "TRUE"
-tools.remindinstall = "FALSE"
-
-isolation.tools.hgfs.disable = "FALSE"
-isolation.tools.dnd.disable = "FALSE"
-isolation.tools.copy.enable = "TRUE"
-isolation.tools.paste.enabled = "TRUE"
-gui.restricted = "FALSE"
-
-ethernet0.present = "TRUE"
-ethernet0.connectionType = "bridged"
-ethernet0.addressType = "generated"
-ethernet0.generatedAddress = "00:0c:29:7e:06:58"
-ethernet0.generatedAddressOffset = "0"
-
-usb.present = "TRUE"
-usb.generic.autoconnect = "FALSE"
-
-sound.present = "TRUE"
-sound.virtualdev = "es1371"
-
-ide0:0.present = "TRUE"
-ide0:0.fileName = "buildroot.vmdk"
-ide0:0.deviceType = "disk"
-ide0:0.mode = ""
-ide0:0.redo = ""
-ide0:0.writeThrough = "FALSE"
-ide0:0.startConnected = "TRUE"
-
-ide1:0.present = "FALSE"
-ide1:0.fileName = ""
-ide1:0.deviceType = "disk"
-ide1:0.mode = ""
-ide1:0.redo = ""
-ide1:0.writeThrough = "FALSE"
-ide1:0.startConnected = "FALSE"
-
-floppy0.present = "FALSE"
-
-serial0.present = "FALSE"
-
-serial1.present = "FALSE"
-
-parallel0.present = "FALSE"
-
-EOF
-
-# Install GRUB
- /sbin/grub --no-floppy --batch <<EOT
- device (hd0) ${IMAGE}
- geometry (hd0) ${CYLINDERS} 16 63
- root (hd0,0)
- setup (hd0)
- quit
- EOT
diff --git a/scripts/copy.sh b/scripts/copy.sh
deleted file mode 100755
index 508ed56af..000000000
--- a/scripts/copy.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-
-STAGING_DIR=$1
-TARGET_DIR=$2
-
-echo "Copying development files to target..."
-
-cp -af ${STAGING_DIR}/usr/include ${TARGET_DIR}/usr
-
-for LIBSDIR in /lib /usr/lib; do
- for WILDCARD in *.a *.la; do
- for FILE_PATH in `find ${STAGING_DIR}${LIBSDIR} -name ${WILDCARD}`; do
- STAGING_STRIPPED=${FILE_PATH##${STAGING_DIR}}
- EXTENDED_DIR=${STAGING_STRIPPED%/${WILDCARD}}
- mkdir -p ${TARGET_DIR}${EXTENDED_DIR}
- cp -fa ${FILE_PATH} ${TARGET_DIR}${STAGING_STRIPPED}
- #echo ${TARGET_DIR}${STAGING_STRIPPED}
- done
- done
-done
diff --git a/scripts/graph-depends b/scripts/graph-depends
deleted file mode 100755
index 4d82282f5..000000000
--- a/scripts/graph-depends
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/python
-
-# Usage (the graphviz package must be installed in your distribution)
-# ./scripts/graph-depends [package-name] > test.dot
-# dot -Tpdf test.dot -o test.pdf
-#
-# With no arguments, graph-depends will draw a complete graph of
-# dependencies for the current configuration. With an argument,
-# graph-depends will draw a graph of dependencies for the given
-# package name.
-#
-# Limitations
-#
-# * Some packages have dependencies that depend on the Buildroot
-# configuration. For example, many packages have a dependency on
-# openssl if openssl has been enabled. This tool will graph the
-# dependencies as they are with the current Buildroot
-# configuration.
-#
-# * The X.org package definitions are only included when
-# BR2_PACKAGE_XORG7 is enabled, so if this option is not enabled,
-# it isn't possible to graph the dependencies of X.org stack
-# components.
-#
-# Copyright (C) 2010 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-
-import sys
-import subprocess
-
-# In FULL_MODE, we draw the full dependency graph for all selected
-# packages
-FULL_MODE = 1
-
-# In PKG_MODE, we only draw the dependency graph for a given package
-PKG_MODE = 2
-
-mode = 0
-
-if len(sys.argv) == 1:
- mode = FULL_MODE
-elif len(sys.argv) == 2:
- mode = PKG_MODE
- rootpkg = sys.argv[1]
-else:
- print "Usage: graph-depends [package-name]"
- sys.exit(1)
-
-allpkgs = []
-unknownpkgs = []
-
-# Execute the "make show-targets" command to get the list of the main
-# Buildroot TARGETS and return it formatted as a Python list. This
-# list is used as the starting point for full dependency graphs
-def get_targets():
- sys.stderr.write("Getting targets\n")
- cmd = ["make", "show-targets"]
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- output = p.communicate()[0].strip()
- if p.returncode != 0:
- return None
- if output == '':
- return []
- return output.split(' ')
-
-# Execute the "make <pkg>-show-depends" command to get the list of
-# dependencies of a given package, and return the list of dependencies
-# formatted as a Python list.
-def get_depends(pkg):
- sys.stderr.write("Getting dependencies for %s\n" % pkg)
- cmd = ["make", "%s-show-depends" % pkg]
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- output = p.communicate()[0].strip()
- if p.returncode != 0:
- return None
- if output == '':
- return []
- return output.split(' ')
-
-# Recursive function that builds the tree of dependencies for a given
-# package. The dependencies are built in a list called 'dependencies',
-# which contains tuples of the form (pkg1 ->
-# pkg2_on_which_pkg1_depends) and the function finally returns this
-# list.
-def get_all_depends(pkg):
- dependencies = []
-
- # We already have the dependencies for this package
- if pkg in allpkgs:
- return
- allpkgs.append(pkg)
- depends = get_depends(pkg)
-
- # We couldn't get the dependencies of this package, because it
- # doesn't use the generic or autotools infrastructure. Add it to
- # unknownpkgs so that it is later rendered in red color to warn
- # the user.
- if depends == None:
- unknownpkgs.append(pkg)
- return
-
- # This package has no dependency.
- if depends == []:
- return
-
- # Add dependencies to the list of dependencies
- for dep in depends:
- dependencies.append((pkg, dep))
-
- # Recurse into the dependencies
- for dep in depends:
- newdeps = get_all_depends(dep)
- if newdeps != None:
- dependencies += newdeps
-
- return dependencies
-
-# The Graphviz "dot" utility doesn't like dashes in node names. So for
-# node names, we strip all dashes.
-def pkg_node_name(pkg):
- return pkg.replace("-","")
-
-# In full mode, start with the result of get_targets() to get the main
-# targets and then use get_all_depends() for each individual target.
-if mode == FULL_MODE:
- targets = get_targets()
- dependencies = []
- allpkgs.append('all')
- for tg in targets:
- # Skip uninteresting targets
- if tg == 'target-generic-issue' or \
- tg == 'target-finalize' or \
- tg == 'erase-fakeroots' or \
- tg == 'target-generic-hostname':
- continue
- dependencies.append(('all', tg))
- deps = get_all_depends(tg)
- if deps != None:
- dependencies += deps
-
-# In pkg mode, start directly with get_all_depends() on the requested
-# package
-elif mode == PKG_MODE:
- dependencies = get_all_depends(rootpkg)
-
-# Start printing the graph data
-print "digraph G {"
-
-# First, the dependencies. Usage of set allows to remove duplicated
-# dependencies in the graph
-for dep in set(dependencies):
- print "%s -> %s" % (pkg_node_name(dep[0]), pkg_node_name(dep[1]))
-
-# Then, the node attributes: color, style and label.
-for pkg in allpkgs:
- if pkg == 'all':
- print "all [label = \"ALL\"]"
- print "all [color=lightblue,style=filled]"
- continue
-
- print "%s [label = \"%s\"]" % (pkg_node_name(pkg), pkg)
-
- if pkg in unknownpkgs:
- print "%s [color=red,style=filled]" % pkg_node_name(pkg)
- elif mode == PKG_MODE and pkg == rootpkg:
- print "%s [color=lightblue,style=filled]" % pkg_node_name(rootpkg)
- else:
- print "%s [color=grey,style=filled]" % pkg_node_name(pkg)
-
-print "}"
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
deleted file mode 100755
index cef2ec707..000000000
--- a/scripts/mkmakefile
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/bin/sh
-# Generates a small Makefile used in the root of the output
-# directory, to allow make to be started from there.
-# The Makefile also allow for more convenient build of external modules
-
-# Usage
-# $1 - Kernel src directory
-# $2 - Output directory
-
-
-test ! -r $2/Makefile -o -O $2/Makefile || exit 0
-# Only overwrite automatically generated Makefiles
-# (so we do not overwrite buildroot Makefile)
-if test -e $2/Makefile && ! grep -q Automatically $2/Makefile
-then
- exit 0
-fi
-if [ "${quiet}" != "silent_" ]; then
- echo " GEN $2/Makefile"
-fi
-
-cat << EOF > $2/Makefile
-# Automatically generated by $0: don't edit
-
-lastword = \$(word \$(words \$(1)),\$(1))
-makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
-
-MAKEARGS := -C $1
-MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
-
-MAKEFLAGS += --no-print-directory
-
-.PHONY: all \$(MAKECMDGOALS)
-
-all := \$(filter-out all Makefile,\$(MAKECMDGOALS))
-
-all:
- \$(MAKE) \$(MAKEARGS) \$(all)
-
-Makefile:;
-
-\$(all): all
- @:
-
-%/: all
- @:
-EOF
diff --git a/scripts/pkg-stats b/scripts/pkg-stats
deleted file mode 100755
index 7bb292830..000000000
--- a/scripts/pkg-stats
+++ /dev/null
@@ -1,284 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2009 by Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-# This script generates an HTML file that contains a report about all
-# Buildroot packages, their usage of the different package
-# infrastructure and possible cleanup actions
-#
-# Run the script from the Buildroot toplevel directory:
-#
-# ./scripts/pkg-stats > /tmp/pkg.html
-#
-
-echo "<head>
-<style type=\"text/css\">
-table {
- width: 100%;
-}
-td {
- border: 1px solid black;
-}
-td.centered {
- text-align: center;
-}
-tr.wrong td {
- background: #ff9a69;
-}
-tr.correct td {
- background: #d2ffc4;
-}
-</style>
-</head>
-
-<a href=\"#results\">Results</a><br/>
-
-<table>
-<tr>
-<td rowspan=\"2\">Id</td>
-<td rowspan=\"2\">Package</td>
-<td>Patch count</td>
-<td colspan=\"2\" class=\"centered\">AUTOTARGETS</td>
-<td colspan=\"2\" class=\"centered\">GENTARGETS</td>
-<td colspan=\"2\" class=\"centered\">CMAKETARGETS</td>
-<td colspan=\"2\" class=\"centered\">manual</td>
-<td rowspan=\"2\" class=\"centered\">Actions</td>
-</tr>
-<tr>
-<td class=\"centered\">host</td>
-<td class=\"centered\">target</td>
-<td class=\"centered\">host</td>
-<td class=\"centered\">target</td>
-<td class=\"centered\">host</td>
-<td class=\"centered\">target</td>
-<td class=\"centered\">host</td>
-<td class=\"centered\">target</td>
-</tr>"
-
-convert_to_generic_target=0
-convert_to_generic_host=0
-convert_to_autotools=0
-total_patch_count=0
-cnt=1
-for i in $(find package/ -name '*.mk') ; do
-
- if test \
- $i = "package/java/java.mk" -o \
- $i = "package/games/games.mk" -o \
- $i = "package/multimedia/multimedia.mk" -o \
- $i = "package/customize/customize.mk" -o \
- $i = "package/gnuconfig/gnuconfig.mk" -o \
- $i = "package/matchbox/matchbox.mk" -o \
- $i = "package/x11r7/x11r7.mk" ; then
- echo "skipping $i" 1>&2
- continue
- fi
-
- cnt=$((cnt+1))
-
- is_auto_host=0
- is_auto_target=0
- is_cmake_host=0
- is_cmake_target=0
- is_pkg_target=0
- is_pkg_host=0
- is_manual_target=0
- is_manual_host=0
-
- if grep -E "\(call AUTOTARGETS,[^,]*,[^,]*,host\)" $i > /dev/null ; then
- is_auto_host=1
- fi
-
- if grep -E "\(call AUTOTARGETS,[^,]*,[^,]*(,target|)\)" $i > /dev/null ; then
- is_auto_target=1
- fi
-
- if grep -E "\(call GENTARGETS,[^,]*,[^,]*,host\)" $i > /dev/null ; then
- is_pkg_host=1
- fi
-
- if grep -E "\(call GENTARGETS,[^,]*,[^,]*(,target|)\)" $i > /dev/null ; then
- is_pkg_target=1
- fi
-
- if grep -E "\(call CMAKETARGETS,[^,]*,[^,]*,host\)" $i > /dev/null ; then
- is_cmake_host=1
- fi
-
- if grep -E "\(call CMAKETARGETS,[^,]*,[^,]*(,target|)\)" $i > /dev/null ; then
- is_cmake_target=1
- fi
-
- pkg=$(basename $i)
- pkg=${pkg%.mk}
-
- if grep "^host-$pkg:" $i > /dev/null ; then
- is_manual_host=1
- fi
-
- if test $is_pkg_target -eq 0 -a $is_auto_target -eq 0 -a $is_cmake_target -eq 0; then
- is_manual_target=1
- fi
-
- tasks=""
-
- if [ $is_manual_target -eq 1 ] ; then
- if grep "/configure" $i > /dev/null ; then
- tasks=$tasks"<li>convert package to autotools ?</li>"
- convert_to_target_autotools=$((convert_to_target_autotools+1))
- else
- tasks=$tasks"<li>convert to generic target</li>"
- convert_to_generic_target=$((convert_to_generic_target+1))
- fi
- fi
-
- if [ $is_manual_host -eq 1 ]; then
- if grep "/configure" $i > /dev/null ; then
- tasks=$tasks"<li>convert package to autotools ?</li>"
- convert_to_host_autotools=$((convert_to_host_autotools+1))
- else
- tasks=$tasks"<li>convert to generic host</li>"
- convert_to_generic_host=$((convert_to_generic_host+1))
- fi
- fi
-
- if test -n "$tasks" ; then
- echo "<tr class=\"wrong\">"
- else
- echo "<tr class=\"correct\">"
- fi
-
- echo "<td>$cnt</td>"
- echo "<td>$i</td>"
-
- package_dir=$(dirname $i)
- patch_count=$(find ${package_dir} -name '*.patch' | wc -l)
- total_patch_count=$(($total_patch_count+$patch_count))
-
- if test $patch_count -lt 1 ; then
- patch_count_color="#00ff00"
- elif test $patch_count -lt 5 ; then
- patch_count_color="#ffc600"
- else
- patch_count_color="#ff0000"
- fi
-
- echo "<td class=\"centered\" style=\"color: $patch_count_color; font-weight: bold;\">"
- echo $patch_count
- echo "</td>"
-
- echo "<td class=\"centered\">"
- if [ $is_auto_host -eq 1 ] ; then
- echo "<b>YES</b>"
- else
- echo "NO"
- fi
- echo "</td>"
-
- echo "<td class=\"centered\">"
- if [ $is_auto_target -eq 1 ] ; then
- echo "<b>YES</b>"
- else
- echo "NO"
- fi
- echo "</td>"
-
- echo "<td class=\"centered\">"
- if [ $is_pkg_host -eq 1 ] ; then
- echo "<b>YES</b>"
- else
- echo "NO"
- fi
- echo "</td>"
-
- echo "<td class=\"centered\">"
- if [ $is_pkg_target -eq 1 ] ; then
- echo "<b>YES</b>"
- else
- echo "NO"
- fi
- echo "</td>"
-
- echo "<td class=\"centered\">"
- if [ $is_cmake_host -eq 1 ] ; then
- echo "<b>YES</b>"
- else
- echo "NO"
- fi
- echo "</td>"
-
- echo "<td class=\"centered\">"
- if [ $is_cmake_target -eq 1 ] ; then
- echo "<b>YES</b>"
- else
- echo "NO"
- fi
- echo "</td>"
-
- echo "<td class=\"centered\">"
- if [ $is_manual_host -eq 1 ] ; then
- echo "<b>YES</b>"
- else
- echo "NO"
- fi
- echo "</td>"
-
- echo "<td class=\"centered\">"
- if [ $is_manual_target -eq 1 ] ; then
- echo "<b>YES</b>"
- else
- echo "NO"
- fi
- echo "</td>"
-
- echo "<td>"
- echo "<ul>"
- echo $tasks
- echo "</ul>"
- echo "</td>"
-
- echo "</tr>"
-
-done
-echo "</table>"
-
-echo "<table>"
-echo "<tr>"
-echo "<td>Packages to convert to generic target</td>"
-echo "<td>$convert_to_generic_target</td>"
-echo "</tr>"
-echo "<tr>"
-echo "<td>Packages to convert to generic host</td>"
-echo "<td>$convert_to_generic_host</td>"
-echo "</tr>"
-echo "<tr>"
-echo "<td>Packages to convert to target autotools</td>"
-echo "<td>$convert_to_target_autotools</td>"
-echo "</tr>"
-echo "<tr>"
-echo "<td>Packages to convert to host autotools</td>"
-echo "<td>$convert_to_host_autotools</td>"
-echo "</tr>"
-echo "<tr>"
-echo "<td>Number of patches in all packages</td>"
-echo "<td>$total_patch_count</td>"
-echo "</tr>"
-echo "<tr>"
-echo "<td>TOTAL</td>"
-echo "<td>$cnt</td>"
-echo "</tr>"
-echo "</table>"
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
deleted file mode 100755
index 8d6fe909f..000000000
--- a/scripts/setlocalversion
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/sh
-# Print additional version information for non-release trees.
-
-usage() {
- echo "Usage: $0 [srctree]" >&2
- exit 1
-}
-
-cd "${1:-.}" || usage
-
-# Check for git and a git repo.
-if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
- # Do we have an untagged version?
- if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then
- if tag=`git describe 2>/dev/null`; then
- echo $tag | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
- else
- printf '%s%s' -g $head
- fi
- fi
-
- # Is this git on svn?
- if git config --get svn-remote.svn.url >/dev/null; then
- printf -- '-svn%s' "`git svn find-rev $head`"
- fi
-
- # Are there uncommitted changes?
- git update-index --refresh --unmerged > /dev/null
- if git diff-index --name-only HEAD | grep -v "^scripts/package" \
- | read dummy; then
- printf '%s' -dirty
- fi
-
- # All done with git
- exit
-fi
-
-# Check for mercurial and a mercurial repo.
-if hgid=`hg id 2>/dev/null`; then
- tag=`printf '%s' "$hgid" | cut -d' ' -f2`
-
- # Do we have an untagged version?
- if [ -z "$tag" -o "$tag" = tip ]; then
- id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
- printf '%s%s' -hg "$id"
- fi
-
- # Are there uncommitted changes?
- # These are represented by + after the changeset id.
- case "$hgid" in
- *+|*+\ *) printf '%s' -dirty ;;
- esac
-
- # All done with mercurial
- exit
-fi
-
-# Check for svn and a svn repo.
-if rev=`LANG=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
- rev=`echo $rev | awk '{print $NF}'`
- changes=`LANG=C svn status 2>/dev/null | grep '^[AMD]' | wc -l`
-
- # Are there uncommitted changes?
- if [ $changes != 0 ]; then
- printf -- '-svn%s%s' "$rev" -dirty
- else
- printf -- '-svn%s' "$rev"
- fi
-
- # All done with svn
- exit
-fi