1 /*
2 *Copyright (c) 2008 Texas Instruments and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Texas Instruments - initial implementation
10 *
11 * */
12
13 package xdc.tools.repoman;
14
15 /*!
16 * ======== xdc.tools.repoman.Main ========
17 * Repository Manager tool
18 *
19 * This tool creates and manages package repositories. It displays
20 * information about archived packages, extracts archived packages,
21 * extracts repositories from bundles and deletes packages from
22 * repositories.
23 *
24 * Information about archived packages can be displayed with
25 * the '-t' and '-n' options. The '-p' argument is used to
26 * specify a directory in which to search. If the '-p' arg is omitted,
27 * the current directory is searched. Specific packages can searched
28 * for by specifying one or more package names, or one or more package
29 * archives at the end of the command line. If no packages are specified,
30 * information on all packages found in the search directory will be
31 * displayed.
32 *
33 * Archived packages can be extracted to a repository with the '-x'
34 * option. '-x -D' will extract dependent packages, too. '-x -R' will
35 * recursively extract dependent packages. If any of the packages in
36 * the specified package list are not compatible, the operation will
37 * be aborted. '-F' can be used to force all packages to be extracted,
38 * regardles of compatibility. The '-p' arg is used to specify a
39 * directory to search in. If not specified, the current directory will
40 * be searched. The '-x' option also extracts a repository or packages
41 * from a bundle. In this case, the last argument specifies the bundle
42 * from which to extract the repository. The repository to be extracted
43 * is specified with the '-b' arg. If just packages are to be extracted,
44 * one or more package names should follow the name of the repository
45 * that they should be extracted from.
46 *
47 * Packages can be deleted from a repository with '-d'. If the package
48 * has any subdirectores that contain packages, they will be left intact.
49 * After the package is deleted, if the package has no subdirectories
50 * with packages, empty directories that are part of the fully qualified
51 * package will be deleted, too.
52 *
53 * Packages can be copied between repositories with '-c'. If the package
54 * being copied already exists in the destination repository, it will be
55 * deleted prior to being replaced.
56 *
57 * The '-r' argument specifies a destination repository. If '-r' is
58 * omitted, the repository of the current package is used. If there is
59 * no current package, the current directory is used.
60 *
61 * When a package name is given, it can be specified in full, such as
62 * 'ti.platforms.sim6xxx', or the wildcard characters '*' and '?' may be
63 * used, as in 'ti.platforms.*' or 'ti.catalog.c??00'. A version/key can
64 * also be attached to a package name in the following manner:
65 * 'ti.platforms.c6000[1,0,0,0,313835]'. A prefix of the full version/key
66 * may also be used: 'ti.platforms.c6000[1,0]'.
67 *
68 * If a package name has multiple matches either with or without a
69 * version/key specified, the most recent will be selected. Wildcards may
70 * also be used when naming a package archive file.
71 *
72 * @a(Examples) 73 * xs xdc.tools.repoman -t
74 * @p(dlist) 75 * Displays all info on all archived packages in the current directory
76 * @p 77 *
78 * xs xdc.tools.repoman -t -p C:\xdc-o19\exports
79 * @p(dlist) 80 * Displays all info on all archived packages in C:\xdc-o19\exports
81 * @p 82 *
83 * xs xdc.tools.repoman -t -p C:\xdc-o19\exports ti.platforms.*
84 * @p(dlist) 85 * Displays all info on archived packages whose names begin with
86 * ti.platforms. in C:\xdc-o19\exports
87 * @p 88 *
89 * xs xdc.tools.repoman -t -p C:\xdc-o19\exports ti_platforms*.tar
90 * @p(dlist) 91 * Displays all info on packages in files that match ti_platforms*.tar
92 * in C:\xdc-o19\exports
93 * @p 94 *
95 * xs xdc.tools.repoman -t -p C:\xdc-o19\exports ti.catalog.c6000 ti.catalog.sim6xxx
96 * @p(dlist) 97 * Displays all info on archived packages ti.catalog.c6000 and
98 * ti.catalog.sim6xxx in C:\xdc-o19\exports
99 * @p 100 *
101 * xs xdc.tools.repoman -x
102 * @p(dlist) 103 * Extracts all archived packages in the current directory to the current
104 * repository
105 * @p 106 *
107 * xs xdc.tools.repoman -x -r C:\myrepo\packages -p C:\exports
108 * @p(dlist) 109 * Extracts all archived packages in C:\exports to C:\myrepo\packages
110 * repository
111 * @p 112 *
113 * xs xdc.tools.repoman -x -r C:\myrepo\packages -p C:\exports ti.catalog.*
114 * @p(dlist) 115 * Extracts packages matching ti.catalog.* from c:\exports to
116 * c:\myrepo\packages
117 * @p 118 *
119 * xs xdc.tools.repoman -x -r C:\myrepo\packages C:\exports\ti_catalog*.tar
120 * @p(dlist) 121 * Extracts packages from files matching C:\exports\ti_catalog*.tar
122 * to c:\myrepo\packages
123 * @p 124 *
125 * xs xdc.tools.repoman -x -r C:\myrepo\packages C:\exports\ti_catalog*.tar
126 * @p(dlist) 127 * Extracts packages from files matching C:\exports\ti_catalog*.tar
128 * to c:\myrepo\packages
129 * @p 130 *
131 * xs xdc.tools.repoman -x -R -r C:\myrepo -p C:\xdc-o19\exports ti.platforms.sim6xxx
132 * @p(dlist) 133 * Extracts the package ti.platforms.sim6xxx and all recursively
134 * dependent packages from C:\xdc-o19\exports to C:\myrepo
135 * @p 136 *
137 * xs xdc.tools.repoman -x -r C:\ -b packages C:\exports\xdc_core.tar.gz
138 * @p(dlist) 139 * Extracts the repository 'packages' from bundle
140 * C:\exports\xdc_core.tar.gz to C:\
141 * @p 142 *
143 * xs xdc.tools.repoman -x -r C:\myrepo -b examples ti.xdais.dm.examples.videnc1_copy
144 * C:\xdais_6_24.tar.gz
145 * @p(dlist) 146 * Extracts the package ti.xdais.dm.examples.videnc1_copy from repository
147 * 'examples' in bundle
148 * C:\xdais_6_24.tar.gz to C:\myrepo
149 * @p 150 *
151 * xs xdc.tools.repoman -c -r C:\destdir\packages -p C:\srcdir\packages ti.catalog.c6000
152 * @p(dlist) 153 * Copies the package ti.catalog.c6000 from C:\srcdir\packages to
154 * C:\destdir\packages
155 * @p 156 *
157 * xs xdc.tools.repoman --rsave -f c:/repoinfo.rmn -p c:/pkgarchives;c:/testpkgs c:/myrepo
158 * @p(dlist) 159 * Saves package information for repository c:/myrepo to file c:/repoinfo.rmn.
160 * Also saves the search path c:/pkgarchives;c:/testpkgs
161 * @p 162 *
163 * xs xdc.tools.repoman --rrestore -f c:/repoinfo.rmn -p c:/pkgarchives;c:/testpkgs
164 * @p(dlist) 165 * Restores all of the packages in the repository referenced in
166 * c:/repoinfo.rmn. Uses the search path c:/pkgarchives;c:/testpkgs to find
167 * and copy packages. Will create the repository if it doesn't exist.
168 * @p 169 *
170 * xs xdc.tools.repoman --rcreate -f c:/repoinfo.rmn -p
171 * c:/pkgarchives;c:/testpkgs c:/mynewrepo
172 * @p(dlist) 173 * Creates the new repository c:/mynewrepo from the repository referenced in
174 * the file c:/repoinfo.rmn. Uses the search path c:/pkgarchives;c:/testpkgs
175 * to find and copy packages. If successful, the newly created repository
176 * will be identical to its predecessor referenced in c:/repoinfo.rmn.
177 * @p 178 *
179 * xs xdc.tools.repoman --providerId my_codec_engine c:/codec_engine_2_23/mypackages
180 * @p(dlist) 181 * Assigns the providerId attribute in c:/codec_engine_2_23/mypackages/.repo.xml
182 * the value my_codec_engine. If c:/codec_engine_2_23/mypackages/.repo.xml does not
183 * exist, it will be created.
184 * @p 185 *
186 */
187 metaonlymodule Main inherits xdc.tools.ICmd {
188
189 overrideconfig String usage[] = [
190 '-t [-v] [-p pathname] [packagename...|packagefile...]',
191 '-n [-v] [-p pathname] [packagename...|packagefile...]',
192 '-x [-v] [-D] [-R] [-F] [-r destrepo] [-p path] packagename...|packagefile...',
193 '-x [-v] [-D] [-R] [-F] [-r destrepo] [-p path] -b bundlerepository [packagename...] bundleFile',
194 '-d [-v] [-F] [-r destrepo] packagename...',
195 '-c [-v] [-F] [--provId providerId] [-r destrepo] [-p pathname] packagename...',
196 '--rsave -f file [-p searchpath] repository...',
197 '--rrestore -f file [-p searchpath] [index-spec]',
198 '--rcreate -f file [-p searchpath] [index-spec] destrepository...',
199 '[-F] --providerId providerId [repository...]'
200 ];
201
202 /*! represents a repository in a bundle */
203 @XmlDtd
204 metaonlystruct Repo {
205 String name;
206 String pkg[];
207 }
208
209 @XmlDtd
210 metaonlystruct Pkg {
211 String name;
212 String file;
213 String release;
214 String label;
215 String version;
216 String date;
217 String buildable;
218 String reqs[];
219 String refs[];
220 Repo repository[];
221 }
222
223 @XmlDtd
224 metaonlystruct Results {
225 Pkg pkg[]; /*! array of package info structures */
226 }
227
228 @XmlDtd
229 metaonlystruct PkgName {
230 String name;
231 Repo repository[];
232 }
233
234 @XmlDtd
235 metaonlystruct NameResults {
236 PkgName pkgName[]; /*! array of PkgName structures */
237 }
238
239 instance:
240
241 //!Display package info
242 @CommandOption('t')
243 config Bool infoFlag = false;
244
245 //!Display package names only
246 @CommandOption('n')
247 config Bool namesFlag = false;
248
249 //!Extract package(s)
250 @CommandOption('x')
251 config Bool extractFlag = false;
252
253 //!Delete package(s)
254 @CommandOption('d')
255 config Bool deleteFlag = false;
256
257 //!Path arg
258 @CommandOption('p')
259 config String pathArg = null;
260
261 //!Repository arg
262 @CommandOption('r')
263 config String repositoryArg = null;
264
265 //!Include package dependencies
266 @CommandOption('D')
267 config Bool dependentFlag = false;
268
269 //!Recursive include package dependencies
270 @CommandOption('R')
271 config Bool recursiveDepFlag = false;
272
273 //!Return an array of strings
274 @CommandOption('a')
275 config Bool arrFlag = false;
276
277 //!Return a Results struct as XML
278 @CommandOption('X')
279 config Bool xmlFlag = false;
280
281 //!Print informative messages during execution
282 @CommandOption('v')
283 config Bool verboseFlag = false;
284
285 //!Bundle repository arg
286 @CommandOption('b')
287 config String bundleRepositoryArg = null;
288
289 //!Force incompatible packages
290 @CommandOption('F')
291 config Bool forceFlag = false;
292
293 //!Copy package(s)
294 @CommandOption('c')
295 config Bool copyFlag = false;
296
297 //!file arg to save/restore repository
298 @CommandOption('f')
299 config String fileArg = null;
300
301 //!Save a repository's information to file
302 @CommandOption('rsave')
303 config Bool rsaveFlag = false;
304
305 //!Restore one or more repositories from information in file
306 @CommandOption('rrestore')
307 config Bool rrestoreFlag = false;
308
309 //!Create one or more repositories from information in file
310 @CommandOption('rcreate')
311 config Bool rcreateFlag = false;
312
313 //! providerId for a repository
314 @CommandOption('providerId')
315 config string provIdArg = null;
316
317 }
318
319
320 /*
321 * @(#) xdc.tools.repoman; 1, 0, 0, 0,140; 9-4-2009 20:38:12; /db/ztree/library/trees/xdctools-c24x/src/
322 */
323