Patchwork [v2,2/6] manual: add package-list.txt generation support

login
register
mail settings
Submitter Samuel Martin
Date Nov. 29, 2012, 7:47 a.m.
Message ID <1354175268-6909-1-git-send-email-s.martin49@gmail.com>
Download mbox | patch
Permalink /patch/202672/
State Superseded
Headers show

Comments

Samuel Martin - Nov. 29, 2012, 7:47 a.m.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---

Change since v1:

* move the generation code in a script that is called in manual.mk (as suggested by Arnout)
* remove unneeded comment in the generated output (as suggested by Arnout)

---
 docs/manual/manual.mk                  |  3 +++
 support/scripts/gen-manual-pkg-list.sh | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100755 support/scripts/gen-manual-pkg-list.sh
Arnout Vandecappelle - Nov. 29, 2012, 8:48 p.m.
On 29/11/12 08:47, Samuel Martin wrote:
>
> Signed-off-by: Samuel Martin<s.martin49@gmail.com>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
  (untested)

  But since I'm pedantic, I still have some comments :-)

[snip]
> diff --git a/support/scripts/gen-manual-pkg-list.sh b/support/scripts/gen-manual-pkg-list.sh
> new file mode 100755
> index 0000000..f11b4de
> --- /dev/null
> +++ b/support/scripts/gen-manual-pkg-list.sh
> @@ -0,0 +1,19 @@
> +#!/bin/sh
> +##
> +## gen-manual-pkg-list.sh
> +##
> +## Author(s):
> +##  - Samuel MARTIN<s.martin49@gmail.com>
> +##
> +## Copyright (C) 2012 Samuel MARTIN

  If you add a copyright statement, ideally you should also refer to the GPL:

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.

(The fact that you put the Copyright statement there makes it look as if
it's proprietary.  Adding the GPL reference disambiguates it.  Of course,
it is implied by the global buildroot license even if you leave out the
GPL reference.)

> +##
> +
> +# Generate the manual package-list.txt content (in asciidoc format) and print it
> +# to the standard output.
> +
> +printf "\n//\n// Autogenerated file\n//\n\n"
> +printf "[[package-list]]\n"
> +printf "Available packages\n"
> +printf -- "------------------\n\n"

  Since this is now part of a script, you can just cat a here document.
Much more readable.

> +grep -rlE --color=never '\((autotools|cmake|generic)-package\)' package | \

  We globally unexport GREP_OPTIONS, so the --color=never is redundant.
In addition, it would barf on non-gnu-grep.


  Regards,
  Arnout

> +  sed -ne '/.*\/\(.*\).mk$/ s//* \1/p' | sort

Patch

diff --git a/docs/manual/manual.mk b/docs/manual/manual.mk
index aa20534..d8437ba 100644
--- a/docs/manual/manual.mk
+++ b/docs/manual/manual.mk
@@ -24,6 +24,9 @@  $$(O)/docs/$(1)/$(1).$(4): docs/$(1)/$(1).txt $$($(call UPPERCASE,$(1))_SOURCES)
 	  -D $$(@D) $$<
 endef
 
+$(TOPDIR)/docs/manual/package-list.txt:
+	$(TOPDIR)/support/scripts/gen-manual-pkg-list.sh > $@
+
 ################################################################################
 # GENDOC -- generates the make targets needed to build asciidoc documentation.
 #
diff --git a/support/scripts/gen-manual-pkg-list.sh b/support/scripts/gen-manual-pkg-list.sh
new file mode 100755
index 0000000..f11b4de
--- /dev/null
+++ b/support/scripts/gen-manual-pkg-list.sh
@@ -0,0 +1,19 @@ 
+#!/bin/sh
+##
+## gen-manual-pkg-list.sh
+##
+## Author(s):
+##  - Samuel MARTIN <s.martin49@gmail.com>
+##
+## Copyright (C) 2012 Samuel MARTIN
+##
+
+# Generate the manual package-list.txt content (in asciidoc format) and print it
+# to the standard output.
+
+printf "\n//\n// Autogenerated file\n//\n\n"
+printf "[[package-list]]\n"
+printf "Available packages\n"
+printf -- "------------------\n\n"
+grep -rlE --color=never '\((autotools|cmake|generic)-package\)' package | \
+  sed -ne '/.*\/\(.*\).mk$/ s//* \1/p' | sort