1 2 3 4 5 6 7 8 9 10 11
12 package xdc.tools.path;
13
14 /*!
15 * ======== xdc.tools.path.Main ========
16 * Package Repository Path Display Tool
17 *
18 * This tool displays the packages located along the specified package
19 * repository path. Repositories can be specified by explicitly naming
20 * them via the `-Pr` option or implicitly by not passing `-Pr`; in
21 * this case, the set of repositories searched corresponds to the set of
22 * repositories defined by the current package path:
23 * @p(code)
24 * $XDCPATH;$XDCROOT/packages;^
25 * @p
26 *
27 * where `$XDCPATH` is the value of the the user settable prefix of
28 * the package path, `$XDCROOT` is the installation directory of the
29 * XDC tools, and `^` is the repository of the package in the current
30 * working directory (if it exists).
31 *
32 * @a(Examples)
33 *
34 * 1. To display information about the packages on the package path
35 * (in this example, the package path is just `C:/xdc-o00/packages`):
36 * @p(code)
37 * xs xdc.tools.path
38 * @p
39 *
40 * Output:
41 * @p(code)
42 * Package Name: gnu.gdb.jserver
43 * Repository: C:/xdc-o00/packages
44 * Release Name: gnu_gdb_jserver
45 * Label: default
46 * Compatibility Key: 1, 0, 0, 0, 87
47 * Date: 11/20/2006 20:38
48 *
49 * Package Name: gnu.targets
50 * Repository: C:/xdc-o00/packages
51 * Release Name: gnu_targets
52 * Label: default
53 * Compatibility Key: 1, 0, 0, 0, 194
54 * Date: 11/20/2006 20:38
55 *
56 * @p
57 *
58 * 2. To display the names of the packages on the package path
59 * (in this example, the package path is just `C:/xdc-o00/packages`):
60 * @p(code)
61 * xs xdc.tools.path -n
62 * @p
63 *
64 * Output:
65 * @p(code)
66 * gnu.gdb.jserver
67 * gnu.targets
68 * gnu.targets.rts470MV
69 * gnu.targets.rts470uC
70 * gnu.targets.rts5
71 *
72 * @p
73 *
74 * 3. To simply, echo the current package path:
75 * @p(code)
76 * xs xdc.tools.path -p
77 * @p
78 *
79 * Output:
80 * @p(code)
81 * C:/xdc-o00/packages
82 * @p
83 *
84 * 4. To display information about the packages "rooted" in the repository
85 * `C:/CCStudio_v3.3/bios_5_31/packages`:
86 * @p(code)
87 * xs xdc.tools.path -Pr C:/CCStudio_v3.3/bios_5_31/packages
88 * @p
89 *
90 * Output:
91 * @p(code)
92 * Package Name: ti.platforms.dsk5402
93 * Repository: C:/CCStudio_v3.3/bios_5_31/packages
94 * Release Name: ti_platforms_dsk5402
95 * Label: default
96 * Compatibility Key: 1, 0, 0, 24
97 * Date: 05/11/2006 19:10
98 *
99 * Package Name: ti.platforms.dsk5416
100 * Repository: C:/CCStudio_v3.3/bios_5_31/packages
101 * Release Name: ti_platforms_dsk5416
102 * Label: default
103 * Compatibility Key: 1, 0, 0, 24
104 * Date: 05/11/2006 19:10
105 *
106 * Package Name: ti.platforms.dsk5510
107 * Repository: C:/CCStudio_v3.3/bios_5_31/packages
108 * Release Name: ti_platforms_dsk5510
109 * Label: default
110 * Compatibility Key: 1, 0, 0, 24
111 * Date: 05/11/2006 19:10
112 *
113 * @p
114 *
115 * 5. To display the names of all packages in or below the directory
116 * `C:/CCStudio_v3.3/bios_5_31/packages`:
117 * @p(code)
118 * xs xdc.tools.path -n -PR C:/CCStudio_v3.3/bios_5_31/packages
119 * @p
120 *
121 * Output:
122 * @p(code)
123 * ti.platforms.dsk5402
124 * ti.platforms.dsk5416
125 * ti.platforms.dsk5510
126 * ti.platforms.dsk6211
127 *
128 * @p
129 *
130 * @see xdc.tools.path
131 */
132 metaonly module Main inherits xdc.tools.ICmd {
133
134 override config String usage[] = [
135 '[-n] [-x] [-v] [-H header] [-p] [-c] [-P package_base_dir ...|-Pr repository ...|-PR directory ...]'
136 ];
137
138 /*!
139 * ======== Pkg ========
140 * struct used for xml package info
141 */
142 @XmlDtd
143 metaonly struct Pkg {
144 String name;
145 String repository;
146 String release;
147 String label;
148 String key;
149 String date;
150 String providerId;
151 String producerId;
152 }
153
154 @XmlDtd
155 metaonly struct CheckResults {
156 String repository;
157 String warnings[];
158 }
159
160 /*!
161 * ======== Results ========
162 * return value for xml package info
163 */
164 @XmlDtd
165 metaonly struct Results {
166 String header; /*! user-specified header */
167 String path; /*! package path */
168 Pkg pkg[]; /*! array of packages */
169 CheckResults checkResults[];
170 }
171
172 /*!
173 * ======== NameResults ========
174 * return value for xml package names
175 */
176 @XmlDtd
177 metaonly struct NameResults {
178 String header; /*! user-specified header */
179 String path; /*! package path */
180 String name[]; /*! array of names */
181 CheckResults checkResults[];
182 }
183
184 /*!
185 * ======== PathResults ========
186 * return value for xml package path
187 */
188 @XmlDtd
189 metaonly struct PathResults {
190 String header; /*! user-specified header */
191 String path; /*! package path */
192 CheckResults checkResults[];
193 }
194
195 /*!
196 * ======== DirResults ========
197 * return value for xml directory echo
198 */
199 @XmlDtd
200 metaonly struct DirResults {
201 String header; /*! user-specified header */
202 String dir[]; /*! array of package base directories */
203 CheckResults checkResults[];
204 }
205
206 instance:
207
208 /*!
209 * Echo path
210 */
211 @CommandOption('p')
212 config Bool pathFlag = false;
213
214 /*!
215 * Display package names only
216 */
217 @CommandOption('n')
218 config Bool shortFlag = false;
219
220 /*!
221 * Return an array of strings
222 */
223 @CommandOption('a')
224 config Bool arrFlag = false;
225
226 /*!
227 * Return a Results struct as XML
228 */
229 @CommandOption('x')
230 config Bool xmlFlag = false;
231
232 /*!
233 * Print informative messages during execution
234 */
235 @CommandOption('v')
236 config Bool verboseFlag = false;
237
238 /*!
239 * Header label
240 */
241 @CommandOption('H')
242 config String header = null;
243
244 /*!
245 * Use specified directory args instead of xdc.path
246 */
247 @CommandOption('-Pr,d')
248 config Bool repositoriesFlag = false;
249
250 /*!
251 * Recursively find all packages
252 *
253 * Recursively descend into specified directories and find every
254 * package, including packages whose repository is not one of
255 * the specified directories.
256 */
257 @CommandOption('-PR')
258 config Bool recurseFlag = false;
259
260 /*!
261 * Only display information for the package directories
262 */
263 @CommandOption('-P')
264 config Bool directoriesFlag = false;
265
266 /*!
267 * Check repositories for possible errors
268 */
269 @CommandOption('c,--checkpath')
270 config Bool checkFlag = false;
271
272 }
273
274 275 276
277