Skip to content

Commit

Permalink
Add and document a new mechanism for displaying patches in running
Browse files Browse the repository at this point in the history
mutts' output.

--HG--
branch : HEAD
  • Loading branch information
Thomas Roessler committed Nov 6, 2001
1 parent 6b86512 commit 880fa74
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 10 deletions.
9 changes: 6 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SUBDIRS = m4 po intl doc contrib $(IMAP_SUBDIR)

bin_SCRIPTS = muttbug flea

BUILT_SOURCES = keymap_defs.h
BUILT_SOURCES = keymap_defs.h patches.h

bin_PROGRAMS = mutt @DOTLOCK_TARGET@ @PGPAUX_TARGET@
mutt_SOURCES = $(BUILT_SOURCES) \
Expand Down Expand Up @@ -79,7 +79,7 @@ EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h \
_regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \
mbyte.h lib.h extlib.c pgpewrap.c pgplib.h Muttrc.head Muttrc \
makedoc.c stamp-doc-rc README.SSL \
muttbug pgppacket.h depcomp ascii.h BEWARE
muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES

mutt_dotlock_SOURCES = mutt_dotlock.c
mutt_dotlock_LDADD = @LIBOBJS@
Expand All @@ -93,7 +93,7 @@ mutt_dotlock.c: dotlock.c
cp $(srcdir)/dotlock.c mutt_dotlock.c

CLEANFILES = mutt_dotlock.c stamp-doc-rc makedoc \
keymap_alldefs.h keymap_defs.h
keymap_alldefs.h keymap_defs.h patches.h

ACLOCAL_AMFLAGS = -I m4

Expand All @@ -116,6 +116,9 @@ keymap_alldefs.h: $(srcdir)/OPS $(srcdir)/OPS.PGP $(srcdir)/OPS.MIX $(srcdir)/ge
reldate:
echo 'const char *ReleaseDate = "'`date +%Y-%m-%d`'";' > $(srcdir)/reldate.h

patches.h: $(srcdir)/PATCHES
echo "const char *Patches = \"`tr '\n' '+' < $< | sed -e 's/\+$$//'`\";" > $@

install-exec-local:
if test -f $(DESTDIR)$(bindir)/mutt.dotlock && test -f $(DESTDIR)$(bindir)/mutt_dotlock ; then \
rm -f $(DESTDIR)$(bindir)/mutt.dotlock ; \
Expand Down
1 change: 1 addition & 0 deletions PATCHES
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
2 changes: 2 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ AM_CONFIG_HEADER(config.h)

mutt_cv_version=`cat $srcdir/VERSION`


AM_INIT_AUTOMAKE(mutt, $mutt_cv_version)


ALL_LINGUAS="de ru it es uk fr pl nl cs id sk ko el zh_TW zh_CN pt_BR eo gl sv da lt tr ja hu et"

AC_CANONICAL_HOST
Expand Down
5 changes: 3 additions & 2 deletions doc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ DISTFILES = Makefile.in dotlock.man \
manual.html \
stamp-doc-sgml \
stamp-doc-man \
instdoc.sh.in
instdoc.sh.in \
patch-notes.txt

srcdir_DOCFILES = PGP-Notes.txt applying-patches.txt \
devel-notes.txt
devel-notes.txt patch-notes.txt


topsrcdir_DOCFILES = COPYRIGHT GPL INSTALL ChangeLog \
Expand Down
38 changes: 38 additions & 0 deletions doc/patch-notes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Date: Tue, 6 Nov 2001 20:10:13 +0100
From: Thomas Roessler <roessler@does-not-exist.org>
To: mutt-dev@mutt.org
Subject: To those shipping patches
Mail-Followup-To: mutt-dev@mutt.org

We've repeatedly had bug reports in the recent past where it was
hard to see whether or not the problematic version of mutt had, say,
the compressed folders patch or the NNTP patch applied.

From 1.3.23.2 on, I'll include the following mechanism to add a
patch identifier to mutt's version ID: There's a new file called
.PATCHES in the source tree, which will be _empty_ in the official
distribution.

This file's format is one patch ID per line. Patch IDs should be
short, and follow the format "<initials>.<patch-description>". An
example would be "vvv.nntp" for Vsevolod's NNTP patch, or
"rr.compress" for Roland Rosenfeld's compressed folder patch.

In order to properly construct this file, please include the
following chunk with your patch, replacing <your-id-here> by your
patch ID.

------------------------------snip------------------------------
--- PATCHES~ Tue Nov 6 19:59:33 2001
+++ PATCHES Tue Nov 6 19:59:42 2001
@@ -1,0 +1 @@
+<your-id-here>
------------------------------snip------------------------------

The patch IDs will be used to construct mutt's version number as
displayed when mutt is run with the 'v' command line switch, and as
displayed on the User-Agent header.

--
Thomas Roessler http://log.does-not-exist.org/

8 changes: 4 additions & 4 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "keymap.h"
#include "mailbox.h"
#include "url.h"
#include "reldate.h"

#include <string.h>
#include <stdlib.h>
Expand Down Expand Up @@ -83,7 +82,8 @@ void mutt_exit (int code)

static void mutt_usage (void)
{
printf ("Mutt %s (%s)\n", MUTT_VERSION, ReleaseDate);
puts (mutt_make_version ());

puts _(
"usage: mutt [ -nRyzZ ] [ -e <cmd> ] [ -F <file> ] [ -m <type> ] [ -f <file> ]\n\
mutt [ -nx ] [ -e <cmd> ] [ -a <file> ] [ -F <file> ] [ -H <file> ] [ -i <file> ] [ -s <subj> ] [ -b <addr> ] [ -c <addr> ] <addr> [ ... ]\n\
Expand Down Expand Up @@ -118,7 +118,7 @@ static void show_version (void)
{
struct utsname uts;

printf ("Mutt %s (%s)\n", MUTT_VERSION, ReleaseDate);
puts (mutt_make_version());
puts (_(Notice));

uname (&uts);
Expand Down Expand Up @@ -583,7 +583,7 @@ int main (int argc, char **argv)
show_version ();
break;
default:
printf ("Mutt %s (%s)\n", MUTT_VERSION, ReleaseDate);
puts (mutt_make_version ());
puts (_(Copyright));
puts (_(ReachingUs));
exit (0);
Expand Down
17 changes: 17 additions & 0 deletions muttlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#include "mx.h"
#include "url.h"

#include "reldate.h"
#include "patches.h"

#ifdef USE_IMAP
#include "imap.h"
#endif
Expand Down Expand Up @@ -1284,3 +1287,17 @@ time_t mutt_decrease_mtime (const char *f, struct stat *st)

return mtime;
}

const char *mutt_make_version (void)
{
static char vstring[STRING];
const char *p = mutt_make_patches ();
snprintf (vstring, sizeof (vstring), "Mutt %s%s%s (%s)",
MUTT_VERSION, *p ? "+" : "", p, ReleaseDate);
return vstring;
}

const char *mutt_make_patches (void)
{
return Patches;
}
3 changes: 3 additions & 0 deletions protos.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ char *mutt_pgp_hook (ADDRESS *);
#endif /* HAVE_PGP */
char *mutt_make_date (char *, size_t);

const char *mutt_make_version (void);
const char *mutt_make_patches (void);

const char *mutt_fqdn(short);

void mutt_account_hook (const char* url);
Expand Down
5 changes: 4 additions & 1 deletion sendlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "pager.h"
#include "charset.h"


#include <string.h>
#include <stdlib.h>
#include <unistd.h>
Expand Down Expand Up @@ -1660,8 +1661,10 @@ int mutt_write_rfc822_header (FILE *fp, ENVELOPE *env, BODY *attach,

if (mode == 0 && !privacy && option (OPTXMAILER))
{
const char *p = mutt_make_patches ();
/* Add a vanity header */
fprintf (fp, "User-Agent: Mutt/%s\n", MUTT_VERSION);
fprintf (fp, "User-Agent: Mutt/%s%s%s\n", MUTT_VERSION, *p ? "+" : "",
p);
}

/* Add any user defined headers */
Expand Down

0 comments on commit 880fa74

Please sign in to comment.