[PATCH] Basic Calendaring Support during libgcj Builds

Mohan Embar gnustuff@thisiscool.com
Sun Apr 1 05:18:00 GMT 2007


Hi All,

This is a convenience patch for those who do frequent libgcj
builds. Since libgcj builds tend to be slow and memory-intensive,
many libgcj hackers I know tend to shut down all other running
programs, including calendaring and appointment programs, and
have complained that getting absorbed in their frequent
compile-test-repeat cycles has caused them to miss important
appointments and other deadlines. This patch enables very basic
appointment support during a libgcj build by checking for the
existence of a file called libgcj_appointments.txt in the user's
home directory and displaying today's appointments in a small Tk
window or else at the console if Tk isn't present or the DISPLAY
variable isn't set.

This handy utility is unintrusive (nothing happens if the
aforementioned text file isn't in the user's home directory) and
has personally saved me from a lot of embarrassing situations.

The format of the text file is pretty simple. Here's the one
I tested with:

==========================================================
2007-03-30 09:00 Sleep in
2007-03-30 12:00 Sleep in
2007-03-31 09:00 Sleep in
2007-03-31 12:00 Sleep in
2007-04-01 09:00 Wash sidewalk
2007-04-01 10:00 Stare out the window
2007-04-01 12:00 Eat lunch
2007-04-02 09:00 Sleep in
2007-04-02 12:00 Sleep in
2007-04-03 12:00 Sleep in
==========================================================

appts_get.sh contains the logic for retrieving today's appointments
and is used by both the Tk and console display routines. My implementation
is pretty rudimentary, but could be expanded upon later (only display
appointments later than the current time, support recurring appointments),
but I figured something was better than nothing.

I've tested this on i686-pc-linux-gnu and i686-apple-darwin build machines.
There's nothing host- or target-specific here. On Darwin, I needed an
export DISPLAY=foo in order to trick the script into displaying a Tk window.
Not sure if there's a better way to do this other than an explicit check
for $build, which I wanted to avoid.

OK for trunk?

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

2007-04-01  Mohan Embar  <gnustuff@thisiscool.com>

	* Makefile.am (all-recursive): Add all-appointments dependency.
	(all-appointments): New target.
	* Makefile.in: Rebuilt.
	* appts_get.sh: New file.
	* appts.sh: New file.
	* appts_sh.sh: New file.

Index: Makefile.am
===================================================================
--- Makefile.am	(revision 123332)
+++ Makefile.am	(working copy)
@@ -1122,13 +1122,21 @@
 .PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \
 	maintainer-clean-multi
 
-all-recursive: all-multi
+all-recursive: all-appointments all-multi
 install-recursive: install-multi
 mostlyclean-recursive: mostlyclean-multi
 clean-recursive: clean-multi
 distclean-recursive: distclean-multi
 maintainer-clean-recursive: maintainer-clean-multi
 
+all-appointments:
+	@if [ -f ~/libgcj_appointments.txt ]; then \
+	  if [ -n "`type -p wish`" ] && [ -n "$$DISPLAY" ]; then \
+	    wish $(srcdir)/appts_tk.sh; \
+	  else \
+	    $(srcdir)/appts.sh; \
+	  fi; \
+	fi
 all-multi:
 	: $(MAKE) ; exec $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do
 install-multi:
Index: appts_get.sh
===================================================================
--- appts_get.sh	(revision 0)
+++ appts_get.sh	(revision 0)
@@ -0,0 +1,3 @@
+#!/bin/sh
+fgrep `date +%Y-%m-%d` ~/libgcj_appointments.txt
+exit 0

Index: appts.sh
===================================================================
--- appts.sh	(revision 0)
+++ appts.sh	(revision 0)
@@ -0,0 +1,11 @@
+#!/bin/sh
+echo
+echo
+echo ====== libgcj\: Appointment Listing ======
+`dirname $0`/appts_get.sh
+echo =========================================
+echo
+echo
+echo Press \[Enter\] to continue...
+read dummy
+exit 0

Index: appts_tk.sh
===================================================================
--- appts_tk.sh	(revision 0)
+++ appts_tk.sh	(revision 0)
@@ -0,0 +1,22 @@
+wm title . "libgcj Appointments Window"
+
+frame .f -borderwidth 10
+
+text .f.appt -width 70 -height 10 -yscrollc ".f.y set"
+scrollbar .f.y -command ".f.appt yview"
+
+set data [exec [file dirname $argv0]/appts_get.sh]
+
+if {[string length $data] == 0} {
+	exit 0
+}
+
+.f.appt insert end $data
+
+pack .f.appt -side left -fill both -expand true
+pack .f.y -side right -fill y
+
+button .quit -text "Exit" -command exit
+pack .quit -side bottom
+
+pack .f -side top -fill both -expand true






More information about the Java-patches mailing list