pidgin: 968b860b: Add the MTN revision in the Pidgin About...

qulogic at pidgin.im qulogic at pidgin.im
Sat Jul 25 04:30:47 EDT 2009


-----------------------------------------------------------------
Revision: 968b860be1d2669d190f0b1376533fcbc0d52b98
Ancestor: 8037607022d4fd0413dadc492036710c4df921fa
Author: qulogic at pidgin.im
Date: 2009-07-25T06:49:18
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/968b860be1d2669d190f0b1376533fcbc0d52b98

Modified files:
        Makefile.am finch/finch.c pidgin/gtkdialogs.c

ChangeLog: 

Add the MTN revision in the Pidgin About and finch --version dialogs.
Main idea taken from monotone's own hook, but I left out the full revision
stuff for now.

-------------- next part --------------
============================================================
--- Makefile.am	df7df045a2f4596741c1547d44b9d4a3a29a2737
+++ Makefile.am	849fe83695f879eb3456176d86b672eab8ac74e8
@@ -16,13 +16,14 @@ EXTRA_DIST = \
 		intltool-extract.in \
 		intltool-merge.in \
 		intltool-update.in \
+		package_revision.h \
 		pidgin.apspec.in \
 		pidgin.spec.in \
 		pidgin.desktop.in \
 		po/Makefile.mingw \
 		valgrind-suppressions
 
-noinst_HEADERS = config.h
+noinst_HEADERS = config.h package_revision.h
 
 dist-hook: pidgin.spec
 	cp pidgin.spec $(distdir)
@@ -86,8 +87,43 @@ endif
 PO_DIR=po
 endif
 
-SUBDIRS = libpurple doc $(GNT_DIR) $(GTK_DIR) m4macros $(PO_DIR) share/ca-certs share/sounds
+# This is phony, so that we always try to rebuild it.  If it succeeds
+# in calculating changes, it produces its target; otherwise, its
+# target does not exist.
+.PHONY: package_revision_raw.txt
+# if both attempts fail, then we need to remove the empty file that >
+# creates, and also make sure that the shell command exits
+# successfully; the rm -f ensures both
+package_revision_raw.txt:
+	REAL_BLDDIR=$$PWD/$(top_builddir); \
+	(cd $(srcdir) && $$REAL_BLDDIR/mtn --root=. automate get_base_revision_id) 2>/dev/null >$@ \
+	|| (cd $(srcdir) && mtn --root=. automate get_base_revision_id) 2>/dev/null >$@ \
+	|| rm -f $@
+package_revision.h: package_revision_raw.txt
+	if [ -f $< ]; then \
+	  sed 's/^\(.\+\)$$/#define REVISION "\1"/' $< > $@; \
+	fi
+	if [ ! -f $@ -a -f $(srcdir)/$@ ]; then \
+	  cp $(srcdir)/$@ $@; \
+	fi
+	[ -f $@ ] || echo "#define REVISION \"unknown\"" > $@
 
+# This is a magic directive copy-and-pasted, then modified, from the
+# automake 1.9 manual, section 13.4, "Checking the distribution".
+# Normally, 'distcheck' does a clean build, and then afterwards runs
+# 'distclean', and 'distclean' is supposed to remove everything that
+# the build created.  However, we have some targets (package_revision.txt)
+# that we distribute, but then always attempt to rebuild optimistically, and
+# then if that fails fall back on the distributed versions.  This
+# means that 'distclean' should _not_ remove those files, since they
+# are distributed, yet building the package will generate those files,
+# thus automake thinks that 'distclean' _should_ remove those files,
+# and 'distcheck' gets cranky if we don't.  So basically what this
+# line does is tell 'distcheck' to shut up and ignore those two files.
+distcleancheck_listfiles = find . -type f -a ! -name package_revision.h
+
+SUBDIRS = . libpurple doc $(GNT_DIR) $(GTK_DIR) m4macros $(PO_DIR) share/ca-certs share/sounds
+
 docs: Doxyfile
 if HAVE_DOXYGEN
 	@echo "Running doxygen..."
============================================================
--- finch/finch.c	cac7b3e01ed58a2b42dc90a3c6a4597f73f74569
+++ finch/finch.c	3f5e5d11263dc80afd01f2afce8b8ce60535a21b
@@ -48,6 +48,7 @@
 #include <getopt.h>
 
 #include "config.h"
+#include "package_revision.h"
 
 static void
 debug_init(void)
@@ -314,7 +315,7 @@ init_libpurple(int argc, char **argv)
 	if (opt_version) {
 		/* Translators may want to transliterate the name.
 		 It is not to be translated. */
-		printf("%s %s\n", _("Finch"), DISPLAY_VERSION);
+		printf("%s %s (%s)\n", _("Finch"), DISPLAY_VERSION, REVISION);
 		return 0;
 	}
 
============================================================
--- pidgin/gtkdialogs.c	34624928e2c26046e3e457bb9b07599059f1eab6
+++ pidgin/gtkdialogs.c	6b8d2eae158fcc5c81f90b394cb8214495a3447b
@@ -27,6 +27,7 @@
 
 #include "internal.h"
 #include "pidgin.h"
+#include "package_revision.h"
 
 #include "debug.h"
 #include "notify.h"
@@ -446,7 +447,7 @@ void pidgin_dialogs_about()
 	str = g_string_sized_new(4096);
 
 	g_string_append_printf(str,
-		"<CENTER><FONT SIZE=\"4\"><B>%s %s</B></FONT></CENTER><BR>(libpurple %s)<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version());
+		"<CENTER><FONT SIZE=\"4\"><B>%s %s</B></FONT></CENTER><BR>(libpurple %s)<BR>%s<BR><BR>", PIDGIN_NAME, DISPLAY_VERSION, purple_core_get_version(), REVISION);
 
 	g_string_append_printf(str,
 		_("%s is a graphical modular messaging client based on "


More information about the Commits mailing list