dovecot-2.2-pigeonhole: Forgot to add and ignore new files in la...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Wed Oct 29 20:37:16 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/b33926368ddf
changeset: 1946:b33926368ddf
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Wed Oct 29 21:37:07 2014 +0100
description:
Forgot to add and ignore new files in latest commit.

diffstat:

 .hgignore         |   1 +
 is-tagged.py      |  57 ++++++++++++++++++++++++++++++++++++++++++++++
 update-version.sh |  67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 125 insertions(+), 0 deletions(-)

diffs (143 lines):

diff -r a1e57385b267 -r b33926368ddf .hgignore
--- a/.hgignore	Wed Oct 29 03:05:43 2014 +0100
+++ b/.hgignore	Wed Oct 29 21:37:07 2014 +0100
@@ -12,6 +12,7 @@
 config.rpath
 configure
 configure.scan
+pigeonhole-version.h
 libtool
 libtool-shared
 ltconfig
diff -r a1e57385b267 -r b33926368ddf is-tagged.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/is-tagged.py	Wed Oct 29 21:37:07 2014 +0100
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+    Checks if the current revision of the repository is a tagged revision,
+    but not 'tip'.
+
+    usage:
+    python is-tagged.py [/path/to/repo]
+    if no path is given, the current working directory will be used.
+
+    Exit status:
+      0 if the current revision is a tagged version OR
+        if the current revision was used for signing/tagging OR
+        if path is not a Mercurial repository OR
+        if module import should fail for some reason
+      1 if the current revision has no tag, except 'tip'
+"""
+import re
+import sys
+try:
+    from mercurial import hg, ui
+except ImportError:  # no Mercurial at all
+    sys.exit(0)
+try:
+    from mercurial.error import Abort, RepoError
+except ImportError:
+    try:
+        from mercurial.repo import RepoError
+        from mercurial.util import Abort
+    except ImportError:  # something old/new?
+        sys.exit(0)
+
+RE = r'^Added\s(?:signature|tag)\s(?:[\w\.]+\s)?for\schangeset\s[\da-f]{12,}$'
+
+
+def main():
+    if len(sys.argv) > 1:
+        path = sys.argv[1].strip()
+    else:
+        path = '.'
+    try:
+        repo = hg.repository(ui.ui(), path)
+    except (Abort, RepoError):  # no/bad repo? no extra version info
+        return 0
+    parents_id = repo.dirstate.parents()[0]
+    ctx = repo.changectx(parents_id)
+    if re.match(RE, ctx.description()):  # tag or sig was added for a release
+        return 0
+    for tag, nodeid in repo.tags().iteritems():
+        if tag != 'tip' and parents_id == nodeid:  # tagged
+            return 0
+    # not tagged
+    return 1
+
+
+if __name__ == '__main__':
+    sys.exit(main())
diff -r a1e57385b267 -r b33926368ddf update-version.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/update-version.sh	Wed Oct 29 21:37:07 2014 +0100
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+SRCDIR="${1:-`pwd`}"
+BUILDDIR="${2:-`pwd`}"
+VERSION_H="pigeonhole-version.h"
+VERSION_HT="pigeonhole-version.h.tmp"
+
+abspath()
+{ #$1 the path
+  #$2 1 -> SRCDIR || 2 -> BUILDDIR
+	old=`pwd`
+	cd "${1}"
+	if [ ${2} -eq 1 ]; then
+		SRCDIR=`pwd`
+	else
+		BUILDDIR=`pwd`
+	fi
+	cd "$old"
+}
+
+abspath "${SRCDIR}" 1
+abspath "${BUILDDIR}" 2
+
+# when using a different BUILDDIR just copy from SRCDIR, if there is no .hg
+if [ "${BUILDDIR}" != "${SRCDIR}" ]; then
+	if [ ! -d "${SRCDIR}/.hg" ]  && [ -f "${SRCDIR}/${VERSION_H}" ]; then
+		cmp -s "${SRCDIR}/${VERSION_H}" "${BUILDDIR}/${VERSION_H}"
+		if [ $? -ne 0 ]; then
+			cp "${SRCDIR}/${VERSION_H}" "${BUILDDIR}/${VERSION_H}"
+			exit 0
+		fi
+	fi
+fi
+
+# Don't generate dovecot-version.h if the source tree has no .hg dir but
+# a dovecot-version.h. This may be the result of a release/nightly tarball.
+[ ! -d "${SRCDIR}/.hg" ] && [ -f "${BUILDDIR}/${VERSION_H}" ] && exit 0
+
+# Lets generate the dovecot-version.h
+[ -f "${BUILDDIR}/${VERSION_HT}" ] && rm -f "${BUILDDIR}/${VERSION_HT}"
+python "${SRCDIR}/is-tagged.py" "${SRCDIR}"
+if [ $? = 1 ]; then
+	# older hg doesn't recognize option -i
+	#HGID=`hg -R ${SRCDIR} id -i 2>/dev/null`
+	HGID=`hg -R ${SRCDIR} id 2>/dev/null | awk '{print $1}'`
+	cat > "${BUILDDIR}/${VERSION_HT}" <<EOF
+#ifndef PIGEONHOLE_VERSION_H
+#define PIGEONHOLE_VERSION_H
+
+#define PIGEONHOLE_VERSION_FULL PIGEONHOLE_VERSION" (${HGID})"
+
+#endif /* PIGEONHOLE_VERSION_H */
+EOF
+else
+	cat > "${BUILDDIR}/${VERSION_HT}" <<EOF
+#ifndef PIGEONHOLE_VERSION_H
+#define PIGEONHOLE_VERSION_H
+
+#define PIGEONHOLE_VERSION_FULL PIGEONHOLE_VERSION
+
+#endif /* PIGEONHOLE_VERSION_H */
+EOF
+fi
+
+cmp -s "${BUILDDIR}/${VERSION_H}" "${BUILDDIR}/${VERSION_HT}" && \
+	rm -f "${BUILDDIR}/${VERSION_HT}" || \
+	mv -f "${BUILDDIR}/${VERSION_HT}" "${BUILDDIR}/${VERSION_H}"


More information about the dovecot-cvs mailing list