summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2007-11-07 16:22:07 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2007-11-07 16:22:07 +0100
commita341a7fafd1d39f02be34430852d2c0736ca5447 (patch)
tree8b07ea318e33e55c88e5524ef5e2c1bdd6e4fc3c
parent0cb782ade9552ed0e393e4baf7565661c3420edb (diff)
downloadndim-git-utils-a341a7fafd1d39f02be34430852d2c0736ca5447.tar.gz
ndim-git-utils-a341a7fafd1d39f02be34430852d2c0736ca5447.tar.xz
ndim-git-utils-a341a7fafd1d39f02be34430852d2c0736ca5447.zip
Add new utilities: git-follow, git-buildmsg
-rw-r--r--Makefile.am5
-rw-r--r--NEWS3
-rw-r--r--configure.ac4
-rwxr-xr-xgit-amb/git-amb.in46
-rw-r--r--git-buildmsg/Makefile-files4
-rw-r--r--git-buildmsg/git-buildmsg222
-rw-r--r--git-follow/Makefile-files4
-rw-r--r--git-follow/generate-patches.sh45
-rw-r--r--git-follow/git-follow.in44
-rw-r--r--git-follow/rebase-all.sh16
-rw-r--r--git-follow/upload-patches.sh7
-rw-r--r--git-ndim-sh/Makefile-files6
-rw-r--r--git-ndim-sh/git-ndim-sh.in50
13 files changed, 414 insertions, 42 deletions
diff --git a/Makefile.am b/Makefile.am
index dbe29fc..3dc1cbf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,12 +6,16 @@ man1_MANS =
UPLOAD_FILES =
doc_DATA =
dist_doc_DATA =
+AM_INSTALLCHECK_STD_OPTIONS_EXEMPT =
ACLOCAL_AMFLAGS = -I m4 --install
include Makefile-files
include doc/Makefile-files
+include git-ndim-sh/Makefile-files
include git-amb/Makefile-files
+include git-buildmsg/Makefile-files
+include git-follow/Makefile-files
if HAVE_NDIM_MAN2TXT
.man.txt:
@@ -37,6 +41,7 @@ upload: $(UPLOAD_FILES) dist tag
done
rsync -avz --delete "$(UPLOAD_DIR)/" $(RSYNC_HOST):$(RSYNC_DIR)/$(PACKAGE_TARNAME)/
rm -rf "$(UPLOAD_DIR)"
+ if test -d "$(top_srcdir)/.git"; then git push public master; fi
clean-local:
rm -rf "$(UPLOAD_DIR)"
diff --git a/NEWS b/NEWS
index 5886954..4f9f51c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+ndim-git-utils 1.14.1
+
+
ndim-git-utils 1.14
git-amb:
* Use proper lower level git tools (thanks to #git!)
diff --git a/configure.ac b/configure.ac
index 7bd5330..4af6c34 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
AC_PREREQ(2.61)
AC_INIT([ndims git utilities],
- [1.14],
+ [1.14.1],
[hun@n-dimensional.de],
[ndim-git-utils])
AC_CONFIG_AUX_DIR([auto-aux])
@@ -24,6 +24,8 @@ NDIM_DETECT_MAN2TXT()dnl
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([git-amb/git-amb.man])
AC_CONFIG_FILES([git-amb/git-amb])
+AC_CONFIG_FILES([git-follow/git-follow])
+AC_CONFIG_FILES([git-ndim-sh/git-ndim-sh])
AC_OUTPUT
########################################################################
diff --git a/git-amb/git-amb.in b/git-amb/git-amb.in
index 892dd60..0adceb6 100755
--- a/git-amb/git-amb.in
+++ b/git-amb/git-amb.in
@@ -23,50 +23,14 @@
# Known to work and tested with
# - git 1.5.3.4
# Should also work with git 1.2 and possibly older.
-unset CDPATH
+unset CDPATH
SED="${SED-sed}"
-if test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`"
-then :;
-else
- echo "$self: FATAL: This shell does not support POSIX sh \$() command substitution" >&2
- exit 1
-fi
-
-if test "x$(moo() { echo "meh"; }; moo)" = "xmeh"; then :;
-else
- echo "$self: FATAL: This shell does not support POSIX sh functions" >&2
- exit 1
-fi
-
-self="$(basename "$0")"
-bindir="$(cd "$(dirname "$0")" && pwd)"
-prefixdir="$(dirname "$bindir")"
-
-case "$1" in
- -V|--version)
- echo "$self (@PACKAGE_NAME@) @PACKAGE_VERSION@"
- exit 0
- ;;
- -h|--help)
- for manpage in \
- "${prefixdir}/share/man/man1/${self}.1.gz" \
- "${prefixdir}/share/man/man1/${self}.1" \
- "${prefixdir}/man/man1/${self}.1.gz" \
- "${prefixdir}/man/man1/${self}.1" \
- ;
- do
- if test -s "$manpage"
- then
- if man "$manpage" 2> /dev/null
- then
- exit 0
- fi
- fi
- done
- ;;
-esac
+self=`basename "$0"`
+selfdir=`dirname "$0"`
+selfdir=`cd "$selfdir" && pwd`
+. "$selfdir/git-ndim-sh"
SUBDIRECTORY_OK="yes"
USAGE="<command> [params...]"
diff --git a/git-buildmsg/Makefile-files b/git-buildmsg/Makefile-files
new file mode 100644
index 0000000..88ad8f4
--- /dev/null
+++ b/git-buildmsg/Makefile-files
@@ -0,0 +1,4 @@
+# -*- makefile -*-
+bin_SCRIPTS += git-buildmsg/git-buildmsg
+EXTRA_DIST += git-buildmsg/git-buildmsg
+UPLOAD_FILES += git-buildmsg/git-buildmsg
diff --git a/git-buildmsg/git-buildmsg b/git-buildmsg/git-buildmsg
new file mode 100644
index 0000000..c6be42d
--- /dev/null
+++ b/git-buildmsg/git-buildmsg
@@ -0,0 +1,222 @@
+#!/bin/sh
+#
+# Generate some basic versioning information which can be piped to a header.
+#
+# Copyright (c) 2006-2007 Luc Verhaegen <libv@skynet.be>
+# Copyright (C) 2007 Hans Ulrich Niedermann <hun@n-dimensional.de>
+#
+# The author thanks the nice people on #git for the assistance!
+#
+# Simple testing of this script:
+# env SED="/sbin/busybox sed" \
+# /sbin/busybox sh git-buildmsg --example > moo.c \
+# && gcc -Wall -Wextra -Wno-unused -o moo moo.c \
+# && ./moo
+# (bash and other seds should also do)
+#
+# Ideas:
+# * Output for languages other than C (Erlang, Python, Perl, sh, ...)
+
+# The caller may have found these programs for us
+SED="${SED-sed}"
+
+# Initialize
+GIT_DIR=".git"
+working_dir="$(pwd)"
+
+# Who am I?
+self="$(basename "$0")"
+
+# Defaults
+ifndef_symbol="GIT_VERSION_H"
+outfile="-"
+print_example=false
+srcdir="$(pwd)"
+
+# Parse command line parameter, affecting defaults
+while [ "x$1" != "x" ]
+do
+ case "$1" in
+ --example)
+ print_example=:
+ ;;
+ -o|--output)
+ if shift; then
+ outfile="$1"
+ if [ "x$outfile" = "x-" ]; then
+ : # keep default ifndef_symbol
+ else
+ ifndef_symbol=`basename "$outfile" | $SED 's|\.|_|g; s|[^A-Za-z0-9_]||g' | tr a-z A-Z`
+ fi
+ else
+ echo "$self: Fatal: \"$1\" option requires parameter." >&2
+ exit 1
+ fi
+ ;;
+ --version)
+ echo "$self (@PACKAGE_NAME@) @PACKAGE_VERSION@"
+ exit
+ ;;
+ --help)
+ echo "Supported params: --help, --example, -o|--output"
+ exit
+ ;;
+ -s|--srcdir)
+ if shift; then
+ if test -d "$1"; then
+ srcdir="$1"
+ else
+ echo "$self: Fatal: \"$1\" not a directory."
+ exit 1
+ fi
+ else
+ echo "$self: Fatal: \"$1\" option requires directory parameter."
+ exit 1
+ fi
+ ;;
+ *)
+ echo "$self: Fatal: Invalid command line paramenter: \"$1\"" >&2
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+# If not printing to stdout, redirect stdout to output file
+rename_new_output=false
+if [ "x$outfile" = "x-" ]
+then
+ : # keep using stdout
+else
+ exec 1> "${outfile}.new"
+fi
+
+# Done with creating output files, so we can change to source dir
+cd "$srcdir"
+
+# Write program header
+cat<<EOF
+/*
+ * Basic versioning gathered from the git repository.
+ * Automatically generated by $0.
+ */
+
+#ifndef ${ifndef_symbol}
+#define ${ifndef_symbol} 1
+
+EOF
+
+# Detect git tools (should work with old and new git versions)
+git_found=yes
+for git_tool in git-symbolic-ref git-rev-parse git-diff-files git-diff-index
+do
+ [ x`which $git_tool 2>/dev/null` = "x" ] && { git_found=no; break; }
+done
+
+# Determine and write git specific defines
+if [ "x$git_found" = "xyes" ]; then
+ if [ -e "$GIT_DIR/index" ]; then
+ echo "/* This is a git repository */"
+ echo "#define GIT_USED 1"
+ echo ""
+
+ # Commit SHA-ID
+ git_shaid=`git-rev-parse HEAD | $SED -n 's/^\(.\{8\}\).*/\1/p'`
+ echo "/* Git SHA ID of last commit */"
+ echo "#define GIT_SHAID \"${git_shaid}..\""
+ echo ""
+
+ # Branch
+ git_branch=`git-symbolic-ref HEAD | $SED -n 's|^refs/heads/||p'`
+ echo "/* Branch this tree is on */"
+ echo "#define GIT_BRANCH \"$git_branch\""
+ echo ""
+
+ # Any uncommitted changes we should know about?
+ # Or technically: Are the working tree or index dirty?
+ if git-diff-files --quiet && git-diff-index --cached --quiet HEAD; then
+ echo "/* SHA-ID uniquely defines the state of this code */"
+ echo "#undef GIT_UNCOMMITTED"
+ else
+ echo "/* Local changes might be breaking things */"
+ echo "#define GIT_UNCOMMITTED 1"
+ fi
+ else
+ echo "/* This is not a git repository */"
+ echo "#undef GIT_USED"
+ fi
+else
+ echo "/* git is not installed */"
+ echo "#undef GIT_USED"
+fi
+
+# Define a few immediately useful message strings
+cat<<EOF
+
+/* Define GIT_MESSAGE such that
+ * printf("%s: built from %s", argv[0], GIT_MESSAGE);
+ * forms a proper sentence.
+ */
+
+#ifdef GIT_USED
+
+# ifdef GIT_UNCOMMITTED
+# define GIT_WITH_WITHOUT_UNCOMMITTED " + changes"
+# else
+# define GIT_WITH_WITHOUT_UNCOMMITTED ""
+# endif /* GIT_UNCOMMITTED */
+
+# define GIT_MESSAGE \\
+ "git branch " GIT_BRANCH ", " \\
+ "commit " GIT_SHAID GIT_WITH_WITHOUT_UNCOMMITTED
+
+#else
+# define GIT_MESSAGE "non-git sources"
+#endif /* GIT_USED */
+
+#endif /* ${ifndef_symbol} */
+EOF
+
+# Example program
+if "$print_example"
+then
+ cat<<EOF
+
+/* example program demonstrating the use of git_version.sh output */
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char *argv[])
+{
+ const char *const idx = strrchr(argv[0], '/');
+ const char *const prog = (idx)?(idx+1):(argv[0]);
+#ifdef PACKAGE_VERSION
+ printf("%s: version %s, built from %s\n", prog, PACKAGE_VERSION, GIT_MESSAGE);
+#elif defined(GIT_USED)
+ printf("%s: built from %s\n", prog, GIT_MESSAGE);
+#endif
+ return 0;
+}
+EOF
+fi
+
+# Change back to working dir for the remaining output file manipulations.
+cd "$working_dir"
+
+# If necessary, overwrite outdated output file with new one
+if [ "x$outfile" != "x-" ]
+then
+ if [ -f "$outfile" ]; then
+ if cmp "$outfile" "$outfile.new" > /dev/null; then
+ echo "$self: Output is unchanged, keeping $outfile" >&2
+ rm -f "$outfile.new"
+ else
+ echo "$self: Output has changed, updating $outfile" >&2
+ mv -f "$outfile.new" "$outfile"
+ fi
+ else
+ mv -f "$outfile.new" "$outfile"
+ fi
+fi
+
+# THE END.
diff --git a/git-follow/Makefile-files b/git-follow/Makefile-files
new file mode 100644
index 0000000..26d78b9
--- /dev/null
+++ b/git-follow/Makefile-files
@@ -0,0 +1,4 @@
+# -*- makefile -*-
+bin_SCRIPTS += git-follow/git-follow
+EXTRA_DIST += git-follow/git-follow.in
+UPLOAD_FILES += git-follow/git-follow
diff --git a/git-follow/generate-patches.sh b/git-follow/generate-patches.sh
new file mode 100644
index 0000000..bf2c17a
--- /dev/null
+++ b/git-follow/generate-patches.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+set -x
+
+repourl="http://radeonhd.lauft.net/xf86-video-radeonhd.git/"
+sedhtml="s/&/\&amp;/g; s/@/\&#x40;/g; s/</\&lt;/g; s/>/\&gt;/g;"
+
+rm -f "patches/"*/[0-9][0-9][0-9][0-9]-*.patch
+rmdir "patches/"*
+
+while read start from to dir restofline
+do
+ if echo "$start" | grep '^#' > /dev/null; then continue; fi
+ git format-patch -o "patches/$dir" --start-number "$start" "$from".."$to"
+ if test "x$to" = "x$dir"; then
+ {
+ echo "<h1 style='margin:0;'>${to} branch</h1>"
+ echo "<p><tt>git pull ${repourl} ${to}</tt></p>"
+ } > "patches/$dir/HEADER.html"
+ echo "IndexIgnore .." > "patches/$dir/.htaccess"
+ {
+ sedcmds=""
+ for f in "patches/$dir/"[0-9]*.patch; do
+ b="$(basename "$f")"
+ commit="$(sed -n '1s/^From \([a-z0-9]\{1,\}\).*/\1/p' "$f")"
+ sedcmds="${sedcmds} s|\(${commit}\)|<a href=\"$b\">\1</a>|;"
+ echo "AddDescription \"$(sed -n 's|^Subject: [PATCH[^\]*] \(.*\)|\1|p' "$f" | sed "${sedhtml}")\" ${b}" >> "patches/$dir/.htaccess"
+ done
+ echo "$commits"
+ echo "<pre style=\"\">"
+ git log --stat "${from}..${to}" | sed "${sedhtml}${sedcmds}"
+ echo "</pre>"
+ } > "patches/$dir/README.html"
+ fi
+done<<EOF
+#1 master ndim-trivial-fixes ndim-trivial-fixes
+#1 ndim-trivial-fixes ndim-doc ndim-doc
+1 ndim-trivial-fixes ndim-git-version ndim-git-version
+101 ndim-doc ndim/update-docs manpage-update
+201 ndim-doc ndim/update-docs-auto manpage-update
+301 ndim-doc ndim/update-man-sed manpage-update
+EOF
+
+( cd patches && tar cvfz ndim-all-radeonhd-patches.tar.gz --exclude .htaccess --exclude '*~' --exclude '*.tar.gz' --exclude 'HEADER.html' .)
+
+ls -l patches
diff --git a/git-follow/git-follow.in b/git-follow/git-follow.in
new file mode 100644
index 0000000..7d8d4b6
--- /dev/null
+++ b/git-follow/git-follow.in
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+unset CDPATH
+SED="${SED-sed}"
+
+self=`basename "$0"`
+selfdir=`dirname "$0"`
+selfdir=`cd "$selfdir" && pwd`
+. "$selfdir/git-ndim-sh"
+
+SUBDIRECTORY_OK="yes"
+USAGE="<command> [params...]"
+
+LONG_USAGE="\
+Let a local subtree of branches follow a remote origin without too much merging.
+For more details, see the ${self}(1) man page."
+. git-sh-setup
+
+require_work_tree
+
+# Abort on error
+set -e
+
+gf_init() {
+ git config follow.tree | while read from to restofline; do
+ if test "x#" = "x$(echo "$from" | sed -n '1s/^\(.\).*/\1/p')"; then continue; fi
+ echo "ITEM"
+ echo " From: $from"
+ echo " To: $to"
+ done
+}
+
+# The great command case
+command="$1"
+if shift; then
+ case "$command" in *)
+ die "Invalid command line parameter: \"$command\""
+ ;;
+ esac
+else
+ die "Command required"
+fi
+
+# End of file.
diff --git a/git-follow/rebase-all.sh b/git-follow/rebase-all.sh
new file mode 100644
index 0000000..02676c7
--- /dev/null
+++ b/git-follow/rebase-all.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -x
+while read branch base restofline
+do
+ git rebase "$base" "$branch" || exit "$?"
+done<<EOF
+master origin
+ndim-trivial-fixes master
+ndim-doc ndim-trivial-fixes
+ndim/update-docs ndim-doc
+ndim/update-docs-auto ndim-doc
+ndim/update-man-sed ndim-doc
+fedora/generate-xinf ndim-trivial-fixes
+ndim-conntest-checks ndim-trivial-fixes
+EOF
diff --git a/git-follow/upload-patches.sh b/git-follow/upload-patches.sh
new file mode 100644
index 0000000..88da064
--- /dev/null
+++ b/git-follow/upload-patches.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -x
+rsync -avz --delete patches/ "${RSYNC_HOST}:${RSYNC_DIR}/patches/"
+for branch in "" ndim-trivial-fixes ndim-doc ndim-git-version
+do
+ git push -f public ${branch}
+done
diff --git a/git-ndim-sh/Makefile-files b/git-ndim-sh/Makefile-files
new file mode 100644
index 0000000..4b4c626
--- /dev/null
+++ b/git-ndim-sh/Makefile-files
@@ -0,0 +1,6 @@
+# -*- makefile -*-
+
+bin_SCRIPTS += git-ndim-sh/git-ndim-sh
+EXTRA_DIST += git-ndim-sh/git-ndim-sh.in
+UPLOAD_FILES += git-ndim-sh/git-ndim-sh
+AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += git-ndim-sh/git-ndim-sh
diff --git a/git-ndim-sh/git-ndim-sh.in b/git-ndim-sh/git-ndim-sh.in
new file mode 100644
index 0000000..6856629
--- /dev/null
+++ b/git-ndim-sh/git-ndim-sh.in
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# Designed to be sourced.
+case "$(basename "$0")" in
+ git-ndim-sh|git-ndim-sh.in)
+ echo "This script is not supposed to be executed." >&2
+ echo "Source it instead." >&2
+ exit 1
+ ;;
+esac
+
+if test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`"
+then :;
+else
+ echo "$self: FATAL: This shell does not support POSIX sh \$() command substitution" >&2
+ exit 1
+fi
+
+if test "x$(moo() { echo "meh"; }; moo)" = "xmeh"; then :;
+else
+ echo "$self: FATAL: This shell does not support POSIX sh functions" >&2
+ exit 1
+fi
+
+bindir="$(cd "$(dirname "$0")" && pwd)"
+prefixdir="$(dirname "$bindir")"
+
+case "$1" in
+ -V|--version)
+ echo "$self (@PACKAGE_NAME@) @PACKAGE_VERSION@"
+ exit 0
+ ;;
+ -h|--help)
+ for manpage in \
+ "${prefixdir}/share/man/man1/${self}.1.gz" \
+ "${prefixdir}/share/man/man1/${self}.1" \
+ "${prefixdir}/man/man1/${self}.1.gz" \
+ "${prefixdir}/man/man1/${self}.1" \
+ ;
+ do
+ if test -s "$manpage"
+ then
+ if man "$manpage" 2> /dev/null
+ then
+ exit 0
+ fi
+ fi
+ done
+ ;;
+esac