* [Buildroot] [PATCH 3/6] manual: add deprecated-list.txt generation support
2012-11-28 21:40 [Buildroot] [PATCH 1/6] manual: trivial fix Samuel Martin
2012-11-28 21:40 ` [Buildroot] [PATCH 2/6] manual: add package-list.txt generation support Samuel Martin
@ 2012-11-28 21:40 ` Samuel Martin
2012-11-28 21:40 ` [Buildroot] [PATCH 4/6] manual: add manual-update-lists and manual-clean-lists targets Samuel Martin
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Samuel Martin @ 2012-11-28 21:40 UTC (permalink / raw)
To: buildroot
The whole deprecated-list.txt file is generated by the deprecated.py
script by searching for symbols depending on BR2_DEPRECATED in the
Buildroot code base.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
docs/manual/manual.mk | 3 +
support/scripts/deprecated.py | 144 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 147 insertions(+)
create mode 100755 support/scripts/deprecated.py
diff --git a/docs/manual/manual.mk b/docs/manual/manual.mk
index c4a21b2..a344efe 100644
--- a/docs/manual/manual.mk
+++ b/docs/manual/manual.mk
@@ -44,6 +44,9 @@ $(TOPDIR)/docs/manual/package-list.txt:
sed -e 's;.*\?/\(.*\?\).mk;* \1;' | \
sort >> $@
+$(TOPDIR)/docs/manual/deprecated-list.txt:
+ python2 $(TOPDIR)/support/scripts/deprecated.py > $@
+
################################################################################
# GENDOC -- generates the make targets needed to build asciidoc documentation.
#
diff --git a/support/scripts/deprecated.py b/support/scripts/deprecated.py
new file mode 100755
index 0000000..cd8c288
--- /dev/null
+++ b/support/scripts/deprecated.py
@@ -0,0 +1,144 @@
+#!/usr/bin/env python
+##
+## deprecated-packages.py
+##
+## Author(s):
+## - Samuel MARTIN <s.martin49@gmail.com>
+##
+## Copyright (C) 2012 Samuel MARTIN
+##
+
+# Python 2.7 script searching for kconfig symbols depending on 'BR2_DEPRECATED'
+# and generating (printing to the standard output) the manual file in asciidoc.
+
+import os
+import re
+import sys
+
+
+ASCIIDOC_HEADER = """\
+//
+// Autogenerated file
+//
+
+[[deprecated]]
+Deprecated list
+---------------
+
+The following stuff are marked as _deprecated_ in Buildroot due to
+their status either too old or unmaintained.
+
+// Please check and sort by grepping the source running:
+//
+// $ git grep -EB4 'depends on BR2_DEPRECATED'
+//
+// and:
+//
+// $ git grep -EB4 'depends on BR2_DEPRECATED' | \\
+// grep -Eo '(:|-).*?(config|comment) BR2_.*'
+"""
+
+NOT_SEARCHED = (".git", "board", "configs", "docs", "output", "support")
+
+# Relative path to category data map
+# key: relative path from buildroot topdir to the search location
+# value: (rank_in_menuconfig, category_name, recursive_search)
+# rank_in_menuconfig is used for ordering the diplaying
+# category_name is used in the diplaying
+# recursive_search when searching for deprecated stuff
+CAT_DIR2DATA = {
+ 'arch' : (0, "target architecture", True),
+ '.' : (1, "build options", False),
+ 'toolchain' : (2, "toolchain", True),
+ 'system' : (3, "system configuration", True),
+ 'package' : (4, "package selection", True),
+ 'fs' : (5, "filesystem images", True),
+ 'boot' : (6, "bootloaders", True),
+ 'linux' : (7, "kernel", True),
+ }
+
+DEPR_SYMBOL = "BR2_DEPRECATED"
+
+_REGEX = r"config BR2_(.*?)\n" + \
+ "((.*?(?!config)(prompt|bool|string|int) \"(.*?)\".*?|[^\n]+)\n)*" + \
+ "(.*?(?!config )" + DEPR_SYMBOL + ".*?)\n" + \
+ "((.*?(?!config)(prompt|bool|string|int) \"(.*?)\".*?|[^\n]+)\n)*"
+
+REGEX = re.compile(_REGEX, flags=re.MULTILINE)
+
+
+def _get_buildroot_topdir():
+ topdir = os.path.join(os.path.dirname(__file__), "..", "..")
+ topdir = os.path.abspath(topdir)
+ return topdir
+
+def get_dir_list():
+ root = _get_buildroot_topdir()
+ dirs = ['.']
+ for dir_ in os.listdir(root):
+ if dir_ in NOT_SEARCHED:
+ continue
+ dir__ = os.path.join(root, dir_)
+ if not os.path.isdir(dir__):
+ continue
+ dirs += [dir_]
+ return dirs
+
+def find_deprecated(root, recursive):
+ deprecated = list()
+ for root_, _, files_ in os.walk(root):
+ if not recursive and root_ != root:
+ break
+ for file_ in files_:
+ if not file_.startswith("Config.in"):
+ continue
+ with open(os.path.join(root_, file_), "r") as f:
+ content = f.read()
+ if not DEPR_SYMBOL in content:
+ continue
+ found = REGEX.findall(content)
+ if found:
+ deprecated += found
+ return deprecated
+
+
+class Category():
+
+ def __init__(self, directory):
+ self.path = os.path.join(_get_buildroot_topdir(), directory)
+ rank, name, rec = CAT_DIR2DATA.get(directory, (99, directory, True))
+ self.name = name
+ self.rank = rank
+ self.depr_items = find_deprecated(self.path, rec)
+
+ def __str__(self):
+ items_ = list()
+ for item in self.depr_items:
+ name_ = item[0].lower().replace("_", " ")
+ name_ = re.sub("^package ", "", name_)
+ vers = re.sub(".*?(version )?([0-9].*)", r'\2', name_)
+ if vers:
+ vers = re.sub(" ", ".", vers)
+ name_ = re.sub("(version )?([0-9].*)", vers, name_)
+ symbol = item[4]
+ if not symbol:
+ symbol = item[9]
+ items_ += ["** %-25s +[%s]+" % (name_, symbol)]
+ items_.sort()
+ output = "\n* %s:\n\n" % self.name.capitalize()
+ output += "\n".join(items_)
+ output += "\n"
+ return output
+
+def main():
+ categories = [Category(directory) for directory in get_dir_list()]
+ categories = [category for category in categories if category.depr_items]
+ categories.sort(cmp=lambda x, y: x.rank - y.rank if x.rank != y.rank \
+ else cmp(x.name, y.name))
+ output = ASCIIDOC_HEADER
+ for category in categories:
+ output += str(category)
+ print output
+
+if __name__ == "__main__":
+ main()
--
1.8.0.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [Buildroot] [PATCH 6/6] manual: add generated *-list.txt
2012-11-28 21:40 [Buildroot] [PATCH 1/6] manual: trivial fix Samuel Martin
` (3 preceding siblings ...)
2012-11-28 21:40 ` [Buildroot] [PATCH 5/6] Makefile: add to the release target a warning about the manual updates Samuel Martin
@ 2012-11-28 21:40 ` Samuel Martin
4 siblings, 0 replies; 7+ messages in thread
From: Samuel Martin @ 2012-11-28 21:40 UTC (permalink / raw)
To: buildroot
* update package-list.txt (formerly named pkg-list.txt)
* update deprecated-list.txt
* update appendix.txt (which include these 2 generated files)
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
docs/manual/appendix.txt | 13 ++---
docs/manual/deprecated-list.txt | 68 ++++++++++++++++----------
docs/manual/{pkg-list.txt => package-list.txt} | 12 +++++
3 files changed, 57 insertions(+), 36 deletions(-)
rename docs/manual/{pkg-list.txt => package-list.txt} (96%)
diff --git a/docs/manual/appendix.txt b/docs/manual/appendix.txt
index 6f1e9f3..4524073 100644
--- a/docs/manual/appendix.txt
+++ b/docs/manual/appendix.txt
@@ -5,15 +5,8 @@ Appendix
include::makedev-syntax.txt[]
-[[package-list]]
-Available packages
-------------------
-// docs/manaual/pkg-list.txt is generated using the following command:
-// $ git grep -E '\((autotools|cmake|generic)-package\)' package/ | \
-// cut -d':' -f1 | grep '\.mk$' | \
-// sed -e 's;.*\?/\(.*\?\).mk;* \1;' | \
-// sort > docs/manual/pkg-list.txt
-
-include::pkg-list.txt[]
+// autogenerated
+include::package-list.txt[]
+// autogenerated
include::deprecated-list.txt[]
diff --git a/docs/manual/deprecated-list.txt b/docs/manual/deprecated-list.txt
index 6dc87a4..1efab7f 100644
--- a/docs/manual/deprecated-list.txt
+++ b/docs/manual/deprecated-list.txt
@@ -1,4 +1,6 @@
-// -*- mode:doc -*- ;
+//
+// Autogenerated file
+//
[[deprecated]]
Deprecated list
@@ -7,40 +9,54 @@ Deprecated list
The following stuff are marked as _deprecated_ in Buildroot due to
their status either too old or unmaintained.
-// list generated using the followings command:
+// Please check and sort by grepping the source running:
+//
// $ git grep -EB4 'depends on BR2_DEPRECATED'
-// and
+//
+// and:
+//
// $ git grep -EB4 'depends on BR2_DEPRECATED' | \
// grep -Eo '(:|-).*?(config|comment) BR2_.*'
-//
-// Need manual checks and sorting.
-* Packages:
+* Build options:
-** +busybox+ 1.18.x
-** +customize+
-** +lzma+
-** +microperl+
-** +netkitbase+
-** +netkittelnet+
-** +pkg-config+
-** +squashfs3+
-** +ttcp+
+** have devfiles +[development files in target filesystem]+
+** have documentation +[documentation on the target]+
* Toolchain:
-** +gdb+ 6.8
-** +gdb+ 7.0.1
-** +gdb+ 7.1
-** +kernel headers+ 2.6.37
-** +kernel headers+ 2.6.38
-** +kernel headers+ 2.6.39
+** gcc target +[gcc]+
+** gdb +[Build gdb debugger for the Target]+
+** gdb 6.8 +[gdb 6.8]+
+** gdb 7.0.1 +[gdb 7.0.1]+
+** gdb 7.1 +[gdb 7.1]+
+** kernel headers 2.6.37 +[Linux 2.6.37.x kernel headers]+
+** kernel headers 2.6.38 +[Linux 2.6.38.x kernel headers]+
+** kernel headers 2.6.39 +[Linux 2.6.39.x kernel headers]+
+
+* Package selection:
+
+** autoconf +[autoconf]+
+** automake +[automake]+
+** binutils 2.20 +[binutils 2.20]+
+** busybox 1.18.x +[BusyBox 1.18.x]+
+** customize +[customize]+
+** libtool +[libtool]+
+** lzma +[lzma]+
+** make +[make]+
+** microperl +[microperl]+
+** netkitbase +[netkitbase]+
+** netkittelnet +[netkittelnet]+
+** pkg config +[pkg-config]+
+** squashfs3 +[squashfs3]+
+** ttcp +[ttcp]+
+
+* Filesystem images:
+
+** target rootfs squashfs3 +[3.x]+
* Bootloaders:
-** +u-boot+ 2011-06
-** +u-boot+ 2011-09
-
-* Output images:
+** target uboot 2011.06 +[2011.06]+
+** target uboot 2011.09 +[2011.09]+
-** squashfs3 image
diff --git a/docs/manual/pkg-list.txt b/docs/manual/package-list.txt
similarity index 96%
rename from docs/manual/pkg-list.txt
rename to docs/manual/package-list.txt
index 5d9b54f..d8b2530 100644
--- a/docs/manual/pkg-list.txt
+++ b/docs/manual/package-list.txt
@@ -1,3 +1,14 @@
+//
+// Autogenerated file
+//
+
+[[package-list]]
+Available packages
+------------------
+
+// docs/manaual/pkg-list.txt is generated using the following command:
+// git grep -E '\((autotools|cmake|generic)-package\)' package/ | \n// cut -d':' -f1 | grep '\.mk$' | \n// sed -e 's;.*\?/\(.*\?\).mk;* \1;' | \n// sort > docs/manual/pkg-list.txt
+
* acl
* acpid
* alsa-lib
@@ -346,6 +357,7 @@
* luaexpat
* luafilesystem
* luajit
+* lua-msgpack-native
* luasocket
* lvm2
* lzma
--
1.8.0.1
^ permalink raw reply related [flat|nested] 7+ messages in thread