On Thu, Dec 01, 2016 at 10:42:30PM +0100, Christian Boltz wrote:
> Am Mittwoch, 30. November 2016, 16:17:49 CET schrieb Steve Beattie:
> > Speaking of the odt files in the documentation directory...
> > 
> > documentaion: add Makefile to generate pdfs from odt files
> > 
> > The odt files in the documentation directory are hard to consume
> > in that form. This adds a Makefile that generates pdfs from the
> > odt files, using the unoconv tool, based on the idea/github tree
> > https://github.com/jessfraz/apparmor-docs from
> > Jessica Frazelle <m...@jessfraz.com>.
> 
> Good idea!
> 
> > That said, renaming the odt files to not have spaces would simplify
> > this a lot.
> 
> Indeed. Please do this first instead of commiting a Makefile with ugly 
> workarounds ;-)

Does the following work for people? (John, since you named and created
these docs originally, I've been expecting hatorade from you.)

  $ for file in *.odt ; do new_file=$(echo "${file}" | sed -e 's/ - /-/' -e 's/ 
/_/g') ; bzr mv "${file}" "${new_file}" ; done

It results in:

  documentation/AppArmor Developer 1 - Kernel Notes.odt => 
documentation/AppArmor_Developer_1-Kernel_Notes.odt
  documentation/AppArmor Developer 2 - policy layout and encoding.odt => 
documentation/AppArmor_Developer_2-policy_layout_and_encoding.odt
  documentation/AppArmor Developer 3 - HFA.odt => 
documentation/AppArmor_Developer_3-HFA.odt
  documentation/AppArmor Developer 4 - Policy compilation.odt => 
documentation/AppArmor_Developer_4-Policy_compilation.odt
  documentation/AppArmor Developer 5 - extending apparmor to userspace.odt => 
documentation/AppArmor_Developer_5-extending_apparmor_to_userspace.odt
  documentation/AppArmor Policy.odt => documentation/AppArmor_Policy.odt
  documentation/Techdoc - eHFA.odt => documentation/Techdoc-eHFA.odt

> For renaming all *.odt files to names without spaces:
> Acked-by: Christian Boltz <appar...@cboltz.de>
> 
> > Signed-off-by: Steve Beattie <st...@nxnw.org>
> > ---
> ...
> > +++ b/documentation/Makefile
> > @@ -0,0 +1,59 @@
> ...
> > +# cannot figure out how to get make to honor the %.odt dependency 
> > correctly 
> > +# so need to manually enter the list below
> > +%.pdf:
> > +   unoconv -v -f pdf --output "$@" $(call us,$(@:.pdf=.odt))
> 
> common/Make.rules has
> 
> %.1 %.2 %.3 %.4 %.5 %.6 %.7 %.8: %.pod
>     $(POD2MAN) $< --release=$(MAN_RELEASE) --center=AppArmor --stderr 
> --section=$(subst .,,$(suffix $@)) > $@
> 
> So I'd guess you need something like (untested!)
> 
> %.pdf: %.odt
>     unoconv -v -f pdf --output "$@" "$<"

Yes, that's exactly what it would be. It just doesn't work if the
odt filenames contain spaces.

Here's what the Makefile would look like after the renaming of the odt
files occurred (much simpler):

---
 documentation/Makefile |   36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

Index: b/documentation/Makefile
===================================================================
--- /dev/null
+++ b/documentation/Makefile
@@ -0,0 +1,36 @@
+# ----------------------------------------------------------------------
+#    Copyright (c) 2016 Canonical Ltd.
+#
+#    This program is free software; you can redistribute it and/or
+#    modify it under the terms of version 2 of the GNU General Public
+#    License published by the Free Software Foundation.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+# ----------------------------------------------------------------------
+NAME           = documentation
+all:
+COMMONDIR=../common/
+
+include $(COMMONDIR)/Make.rules
+
+all: docs
+
+SOURCES:= $(wildcard *.odt)
+DOCS:=$(SOURCES:.odt=.pdf)
+
+.PHONY: docs
+docs: $(DOCS)
+
+%.pdf: %.odt
+       unoconv -v -f pdf --output "$@" "$<"
+
+.PHONY: clean
+ifndef VERBOSE
+.SILENT: clean
+endif
+clean:
+       rm -f *.pdf
+

Thanks.

-- 
Steve Beattie
<sbeat...@ubuntu.com>
http://NxNW.org/~steve/

Attachment: signature.asc
Description: PGP signature

-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to