diff options
author | Max Eliaser <max.eliaser@intel.com> | 2014-06-10 13:24:15 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-06-13 12:31:38 +0100 |
commit | 0a4ba77f66aff34fe7781f209cea9a012ff9d8e5 (patch) | |
tree | a2812dcfe3081764ce7768668d515b71a62f7634 /meta | |
parent | a6815586798b02fd25d96590dda1d042392686fa (diff) | |
download | poky-0a4ba77f66aff34fe7781f209cea9a012ff9d8e5.tar.gz |
texinfo-dummy-native: Create recipe w/ scripts to stand in for Texinfo utils.
More work toward eliminating the dependency on the host system's Texinfo--
Python scripts that understand the same command-line options as the Texinfo
utilities, and create blank output files if appropriate, but don't actually
do any of the work done by those utilities.
This will be necessary to avoid circular dependencies when we start explicitly
tracking dependencies on texinfo-native; i.e. texinfo-native ->
autoconf-native -> texinfo-native. If we have all native recipes that inherit
texinfo.bbclass depend on texinfo-dummy-native instead of texinfo-native, the
cycle is broken.
It may also provide a performance gain by skipping the actual work of
formatting and generating documentation files.
(From OE-Core rev: 0d8d5a2d44988d32a5c8b995202a12ac106ba93c)
Signed-off-by: Max Eliaser <max.eliaser@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
3 files changed, 171 insertions, 0 deletions
diff --git a/meta/recipes-extended/texinfo-dummy-native/texinfo-dummy-native.bb b/meta/recipes-extended/texinfo-dummy-native/texinfo-dummy-native.bb new file mode 100644 index 0000000000..b5420a3e5f --- /dev/null +++ b/meta/recipes-extended/texinfo-dummy-native/texinfo-dummy-native.bb | |||
@@ -0,0 +1,30 @@ | |||
1 | DESCRIPTION = "Fake version of the texinfo utility suite" | ||
2 | SECTION = "console/utils" | ||
3 | LICENSE = "MIT" | ||
4 | LIC_FILES_CHKSUM = "file://COPYING;md5=d6bb62e73ca8b901d3f2e9d71542f4bb" | ||
5 | DEPENDS = "" | ||
6 | PV = "1.0" | ||
7 | |||
8 | SRC_URI = "file://template.py file://COPYING" | ||
9 | |||
10 | S = "${WORKDIR}" | ||
11 | |||
12 | NATIVE_PACKAGE_PATH_SUFFIX = "/${PN}" | ||
13 | |||
14 | inherit native | ||
15 | |||
16 | do_install_name() { | ||
17 | FILENAME="${D}${bindir}/$1" | ||
18 | # Using ln causes problems with rm_work | ||
19 | cp -T "${S}/template.py" "$FILENAME" | ||
20 | chmod +x $FILENAME | ||
21 | } | ||
22 | |||
23 | do_install() { | ||
24 | mkdir -p "${D}${bindir}" | ||
25 | for i in makeinfo pod2texi texi2dvi pdftexi2dvi texindex texi2pdf \ | ||
26 | txixml2texi texi2any install-info ginstall-info \ | ||
27 | update-info-dir; do | ||
28 | do_install_name $i | ||
29 | done | ||
30 | } | ||
diff --git a/meta/recipes-extended/texinfo-dummy-native/texinfo-dummy/COPYING b/meta/recipes-extended/texinfo-dummy-native/texinfo-dummy/COPYING new file mode 100644 index 0000000000..531cbe723d --- /dev/null +++ b/meta/recipes-extended/texinfo-dummy-native/texinfo-dummy/COPYING | |||
@@ -0,0 +1,19 @@ | |||
1 | Copyright (c) 2014 Intel Corp. | ||
2 | |||
3 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
4 | of this software and associated documentation files (the "Software"), to deal | ||
5 | in the Software without restriction, including without limitation the rights | ||
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
7 | copies of the Software, and to permit persons to whom the Software is | ||
8 | furnished to do so, subject to the following conditions: | ||
9 | |||
10 | The above copyright notice and this permission notice shall be included in | ||
11 | all copies or substantial portions of the Software. | ||
12 | |||
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
19 | THE SOFTWARE. | ||
diff --git a/meta/recipes-extended/texinfo-dummy-native/texinfo-dummy/template.py b/meta/recipes-extended/texinfo-dummy-native/texinfo-dummy/template.py new file mode 100644 index 0000000000..4dc31a90f6 --- /dev/null +++ b/meta/recipes-extended/texinfo-dummy-native/texinfo-dummy/template.py | |||
@@ -0,0 +1,122 @@ | |||
1 | #! /usr/bin/env python2.7 | ||
2 | |||
3 | # template.py (and other filenames) | ||
4 | # By Max Eliaser (max.eliaser@intel.com) | ||
5 | |||
6 | # Copyright (c) 2014 Intel Corp. | ||
7 | |||
8 | # Permission is hereby granted, free of charge, to any person obtaining a copy | ||
9 | # of this software and associated documentation files (the "Software"), to deal | ||
10 | # in the Software without restriction, including without limitation the rights | ||
11 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
12 | # copies of the Software, and to permit persons to whom the Software is | ||
13 | # furnished to do so, subject to the following conditions: | ||
14 | |||
15 | # The above copyright notice and this permission notice shall be included in | ||
16 | # all copies or substantial portions of the Software. | ||
17 | |||
18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
19 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
20 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
21 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
22 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
23 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
24 | # THE SOFTWARE. | ||
25 | |||
26 | # This program acts like a dummy version of the texinfo utilities, creating | ||
27 | # the right output files but leaving them blank. It will parse out the name | ||
28 | # of the executable from argv[0] and emulate the corresponding program, so | ||
29 | # multiple copies of this script will exist under different names. | ||
30 | |||
31 | import sys, os | ||
32 | |||
33 | olong = "--output=" | ||
34 | Elong = "--macro-expand=" | ||
35 | |||
36 | |||
37 | this_binary = sys.argv[0].split ("/")[-1] | ||
38 | |||
39 | # To be outputted if functionality that hasn't been stubbed yet is invoked. | ||
40 | stub_msg = """ | ||
41 | This stand-in version of %s is not yet fully capable of emulating the real | ||
42 | version from the GNU texinfo suite. If you see this message, file a bug report | ||
43 | with details on the recipe that failed. | ||
44 | """ % this_binary | ||
45 | |||
46 | # Autotools setups query the version, so this is actually necessary. Some of | ||
47 | # them (lookin' at you, eglibc) actually look for the substring "GNU texinfo," | ||
48 | # so we put that substring in there without actually telling a lie. | ||
49 | version_str = """ %s (fake texinfo, emulating GNU texinfo) 5.2 | ||
50 | |||
51 | Super amazing version which is totally not fake in any way whatsoever. | ||
52 | Copyright (C) 2014 Intel Corp. Distributed under the terms of the MIT | ||
53 | license. | ||
54 | """ % this_binary | ||
55 | |||
56 | simple_binaries = "pod2texi texi2dvi pdftexi2dvi texindex texi2pdf \ | ||
57 | txixml2texi install-info ginstall-info \ | ||
58 | update-info-dir".split () | ||
59 | |||
60 | # These utilities use a slightly different set of options and flags. | ||
61 | complex_binaries = "makeinfo texi2any".split () | ||
62 | |||
63 | valid_binaries = simple_binaries + complex_binaries | ||
64 | |||
65 | # For generating blank output files. | ||
66 | def touch_file (path): | ||
67 | f = open (path, "w") | ||
68 | f.close () | ||
69 | |||
70 | assert this_binary in valid_binaries, \ | ||
71 | this_binary + " is not one of " + ', '.join (valid_binaries) | ||
72 | |||
73 | if "--version" in sys.argv: | ||
74 | print version_str | ||
75 | sys.exit (0) | ||
76 | |||
77 | # For debugging | ||
78 | log_interceptions = False | ||
79 | if log_interceptions: | ||
80 | f = open ("/tmp/intercepted_" + this_binary, "a") | ||
81 | f.write (' '.join ([this_binary] + sys.argv[1:]) + '\n') | ||
82 | f.close () | ||
83 | |||
84 | # Look through the options and flags, and if necessary, touch any output | ||
85 | # files. | ||
86 | arg_idx = 1 | ||
87 | while arg_idx < len (sys.argv): | ||
88 | arg = sys.argv [arg_idx] | ||
89 | |||
90 | if arg == "--": | ||
91 | break | ||
92 | |||
93 | # Something like -I . can result in a need for this (specifically the .) | ||
94 | elif len (arg) < 2: | ||
95 | pass | ||
96 | |||
97 | # Check if -o or --output is specified. These can be used at most once. | ||
98 | elif arg[0] == '-' and arg[1] != '-' and arg[len (arg) - 1] == 'o': | ||
99 | touch_file (sys.argv[arg_idx + 1]) | ||
100 | sys.exit (0) | ||
101 | elif arg.startswith (olong): | ||
102 | touch_file (arg.split ("=")[1]) | ||
103 | sys.exit (0) | ||
104 | |||
105 | # Check for functionality that isn't implemented yet. | ||
106 | else: | ||
107 | assert arg[1] == '-' or 'E' not in arg or \ | ||
108 | this_binary in simple_binaries, \ | ||
109 | "-E option not yet supported" + stub_msg | ||
110 | |||
111 | assert not arg.startswith (Elong), \ | ||
112 | Elong[:-1] + " option not yet supported" + stub_msg | ||
113 | |||
114 | arg_idx += 1 | ||
115 | |||
116 | # The -o/--output option overrides the default. For makeinfo and texi2any, | ||
117 | # that default is to look for a @setfilename command in the input file. | ||
118 | # Otherwise, printing nothing to stdout and then exiting should suffice. | ||
119 | assert this_binary in simple_binaries, \ | ||
120 | "Don't know how to get default output file name from input file!" + \ | ||
121 | stub_msg | ||
122 | |||