Rough documentation patch follows. Creates an initial build system for guilt man pages written in asciidoc. A good deal of the build/configuration system was borrowed from git but has been customized for guilt. Also includes guilt-init.txt and guilt.txt man pages. Signed-off-by: Brandon Philips -- diff --git a/Documentation/Makefile b/Documentation/Makefile new file mode 100644 index 0000000..e6b0ce6 --- /dev/null +++ b/Documentation/Makefile @@ -0,0 +1,62 @@ +MAN1_TXT= $(wildcard guilt-*.txt) +MAN7_TXT=guilt.txt + +DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT)) + +DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT)) +DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT)) + +prefix?=$(HOME) +bindir?=$(prefix)/bin +mandir?=$(prefix)/man +man1dir=$(mandir)/man1 +man7dir=$(mandir)/man7 +# DESTDIR= + +ASCIIDOC=asciidoc +ASCIIDOC_EXTRA = +INSTALL?=install +DOC_REF = origin/man + +all: html man + +html: $(DOC_HTML) + +$(DOC_HTML) $(DOC_MAN1) $(DOC_MAN7): asciidoc.conf + +man: man1 man7 +man1: $(DOC_MAN1) +man7: $(DOC_MAN7) + +install: man + $(INSTALL) -d -m755 $(DESTDIR)$(man1dir) $(DESTDIR)$(man7dir) + $(INSTALL) -m644 $(DOC_MAN1) $(DESTDIR)$(man1dir) + $(INSTALL) -m644 $(DOC_MAN7) $(DESTDIR)$(man7dir) + +# +# Determine "include::" file references in asciidoc files. +# +doc.dep : $(wildcard *.txt) build-docdep.perl + rm -f $@+ $@ + perl ./build-docdep.perl >$@+ + mv $@+ $@ + +-include doc.dep + +cmds.txt: cmd-list.perl $(MAN1_TXT) + perl ./cmd-list.perl + +guilt.7 guilt.html: guilt.txt + +clean: + rm -f *.xml *.html *.1 *.7 doc.dep + rm -f cmds.txt + +%.html : %.txt + $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf $(ASCIIDOC_EXTRA) $< + +%.1 %.7 : %.xml + xmlto -m callouts.xsl man $< + +%.xml : %.txt + $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf $< diff --git a/Documentation/asciidoc.conf b/Documentation/asciidoc.conf new file mode 100644 index 0000000..3a2fcb8 --- /dev/null +++ b/Documentation/asciidoc.conf @@ -0,0 +1,40 @@ +## guiltlink: macro +# +# Usage: guiltlink:command[manpage-section] +# +# Note, {0} is the manpage section, while {target} is the command. +# +# Show guilt link as: (
); if section is defined, else just show +# the command. + +[attributes] +caret=^ +startsb=[ +endsb=] +tilde=~ + +ifdef::backend-docbook[] +[guiltlink-inlinemacro] +{0%{target}} +{0#} +{0#{target}{0}} +{0#} +endif::backend-docbook[] + + +ifdef::backend-docbook[] +# "unbreak" docbook-xsl v1.68 for manpages. v1.69 works with or without this. +[listingblock] +{title} + +| + +{title#} +endif::backend-docbook[] + +ifdef::backend-xhtml11[] +[guiltlink-inlinemacro] +{target}{0?({0})} +endif::backend-xhtml11[] + + diff --git a/Documentation/build-docdep.perl b/Documentation/build-docdep.perl new file mode 100755 index 0000000..8a07d43 --- /dev/null +++ b/Documentation/build-docdep.perl @@ -0,0 +1,50 @@ +#!/usr/bin/perl + +my %include = (); +my %included = (); + +for my $text (<*.txt>) { + open I, '<', $text || die "cannot read: $text"; + while () { + if (/^include::/) { + chomp; + s/^include::\s*//; + s/\[\]//; + $include{$text}{$_} = 1; + $included{$_} = 1; + } + } + close I; +} + +# Do we care about chained includes??? +my $changed = 1; +while ($changed) { + $changed = 0; + while (my ($text, $included) = each %include) { + for my $i (keys %$included) { + # $text has include::$i; if $i includes $j + # $text indirectly includes $j. + if (exists $include{$i}) { + for my $j (keys %{$include{$i}}) { + if (!exists $include{$text}{$j}) { + $include{$text}{$j} = 1; + $included{$j} = 1; + $changed = 1; + } + } + } + } + } +} + +while (my ($text, $included) = each %include) { + if (! exists $included{$text} && + (my $base = $text) =~ s/\.txt$//) { + my ($suffix) = '1'; + if ($base eq 'guilt') { + $suffix = '7'; # yuck... + } + print "$base.html $base.$suffix : ", join(" ", keys %$included), "\n"; + } +} diff --git a/Documentation/callouts.xsl b/Documentation/callouts.xsl new file mode 100644 index 0000000..6a361a2 --- /dev/null +++ b/Documentation/callouts.xsl @@ -0,0 +1,30 @@ + + + + + + + .sp + + + + + + + .br + + + + + + + + + + + + + + diff --git a/Documentation/cmd-list.perl b/Documentation/cmd-list.perl new file mode 100755 index 0000000..3ef7a0d --- /dev/null +++ b/Documentation/cmd-list.perl @@ -0,0 +1,51 @@ +# + +sub format_one { + my ($out, $name) = @_; + my ($state, $description); + open I, '<', "$name.txt" or die "No such file $name.txt"; + while () { + if (/^NAME$/) { + $state = 1; + next; + } + if ($state == 1 && /^----$/) { + $state = 2; + next; + } + next if ($state != 2); + chomp; + $description = $_; + last; + } + close I; + if (!defined $description) { + die "No description found in $name.txt"; + } + if (my ($verify_name, $text) = ($description =~ /^($name) - (.*)/)) { + print $out "guiltlink:$name\[1\]::\n"; + print $out "\t$text.\n\n"; + } + else { + die "Description does not match $name: $description"; + } +} + +my %cmds = (); +while () { + next if /^#/; + + chomp; + my ($name, $cat) = /^(\S+)\s+(.*)$/; + push @{$cmds{$cat}}, $name; +} + +my $out = "cmds.txt"; +@manpages = ; +open O, '>', "$out+" or die "Cannot open output file $out+"; +foreach $name (@manpages) { + $name =~ m/(\S+).txt/; + format_one(\*O, $1); +} +close O; +rename "$out+", "$out"; diff --git a/Documentation/guilt-init.txt b/Documentation/guilt-init.txt new file mode 100644 index 0000000..839f258 --- /dev/null +++ b/Documentation/guilt-init.txt @@ -0,0 +1,37 @@ +guilt-init(1) +============= + +NAME +---- +guilt-init - Initialize guilt for use in a git repository + + +SYNOPSIS +-------- +'guilt-init' + +DESCRIPTION +----------- +Initialize a git repository for use with guilt + +EXAMPLES +-------- +First, get a repository to work on. Here's one that we'll use as an example: +$ git-clone git://git.kernel.org/pub/scm/linux/kernel/jsipek/guilt-hello.git + +Now, it initialize the patches directory using guilt's init command: +$ cd hello +$ guilt-init + +Author +------ +Written by Josef "Jeff" Sipek + +Documentation +-------------- +Documentation by Brandon Philips + +GUILT +----- +Part of the guilt[7] suite + diff --git a/Documentation/guilt.txt b/Documentation/guilt.txt new file mode 100644 index 0000000..9d8294d --- /dev/null +++ b/Documentation/guilt.txt @@ -0,0 +1,64 @@ +guilt(7) +======== + +NAME +---- +guilt - quilt on top of git + + +SYNOPSIS +-------- +'guilt' COMMAND [ARGS] + +DESCRIPTION +----------- + +Andrew Morton originally developed a set of scripts for maintaining kernel +patches outside of any SCM tool. Others extended these into a suite called +quilt [2]. The basic idea behind quilt is to maintain patches instead of +maintaining source files. Patches can be added, removed or reordered, and +they can be refreshed as you fix bugs or update to a new base revision. +quilt is very powerful, but it is not integrated with the underlying SCM +tools. This makes it difficult to visualize your changes. + +Guilt allows one to use quilt functionality on top of a Git repository. +Changes are maintained as patches which are committed into Git. Commits can +be removed or reordered, and the underlying patch can be refreshed based on +changes made in the working directory. The patch directory can also be +placed under revision control, so you can have a separate history of changes +made to your patches. + +PATCHES DIRECTORY +----------------- + +In Guilt, all the patches are stored in .git/patches/$branch/, where $branch +is the name of the branch being worked on. This means that one can have a +independent series of patches for each branch present in the repository. +Each of these per-branch directories contains 2 special files: + +series: This file contains a list of all the patch filenames relative to the +per-branch patch directory. Empty and commented out lines are ignored. + +status: This file contains the state of the stack. What patches are applied. + + +GUILT COMMANDS +-------------- +All commands can be called with or without a dash. e.g. 'quilt add' or +'quilt-add' + +include::cmds.txt[] + +Author +------ +Written by Josef "Jeff" Sipek + +Documentation +-------------- +Documentation by Brandon Philips and Josef "Jeff" Sipek + + +GUILT +----- +Part of the guilt[7] suite + diff --git a/Makefile b/Makefile index 5d21c17..ae5878c 100644 --- a/Makefile +++ b/Makefile @@ -21,11 +21,17 @@ SCRIPTS = guilt \ guilt-top \ guilt-unapplied +doc: + $(MAKE) -C Documentation all + .PHONY: all -all: +all: doc @echo "Nothing to build, it is all bash :)" @echo "Try make install" +install-doc: + $(MAKE) -C Documentation install + .PHONY: install install: install -d $(PREFIX)/bin/ @@ -34,3 +40,6 @@ install: .PHONY: test test: make -C regression all + +clean: + $(MAKE) -C Documentation clean