/[gli]/branches/overhaul/src/GLIPortage.py
Gentoo

Diff of /branches/overhaul/src/GLIPortage.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1310 Revision 1311
3# This source code is distributed under the terms of version 2 of the GNU 3# This source code is distributed under the terms of version 2 of the GNU
4# General Public License as published by the Free Software Foundation, a copy 4# General Public License as published by the Free Software Foundation, a copy
5# of which can be found in the main directory of this project. 5# of which can be found in the main directory of this project.
6Gentoo Linux Installer 6Gentoo Linux Installer
7 7
8$Id: GLIPortage.py,v 1.46 2006/02/20 17:26:24 agaffney Exp $ 8$Id: GLIPortage.py,v 1.47 2006/02/20 18:15:17 agaffney Exp $
9""" 9"""
10 10
11import re 11import re
12import os 12import os
13import sys 13import sys
230 if add_to_world: 230 if add_to_world:
231 for package in packages: 231 for package in packages:
232 self.add_pkg_to_world(package) 232 self.add_pkg_to_world(package)
233 233
234 234
235def usage(): 235def usage(progname):
236 print """ 236 print """
237Usage: GLIPortage.py [-c|--chroot-dir <chroot directory>] [-g|--grp] [-s|--stage3] [-h|--help] 237Usage: %s [-c|--chroot-dir <chroot directory>] [-g|--grp] [-s|--stage3] [-h|--help]
238 238
239Options: 239Options:
240 240
241 -c|--chroot-dir Specifies the directory where your chroot is. This is 241 -c|--chroot-dir Specifies the directory where your chroot is. This is
242 "/mnt/gentoo" by default. 242 "/mnt/gentoo" by default.
246 246
247 -s|--stage3 Create a stage3 equivelant in the chroot directory by using 247 -s|--stage3 Create a stage3 equivelant in the chroot directory by using
248 files from the LiveCD. 248 files from the LiveCD.
249 249
250 -h|--help Display this help 250 -h|--help Display this help
251""" 251""" % (progname)
252 252
253if __name__ == "__main__": 253if __name__ == "__main__":
254 chroot_dir = "/mnt/gentoo" 254 chroot_dir = "/mnt/gentoo"
255 mode = None 255 mode = None
256 grp_packages = [] 256 grp_packages = []
257 progname = sys.argv.pop(0)
257 while len(sys.argv): 258 while len(sys.argv):
258 arg = sys.argv.pop(0) 259 arg = sys.argv.pop(0)
259 if arg == "-c" or arg == "--chroot-dir": 260 if arg == "-c" or arg == "--chroot-dir":
260 chroot_dir = sys.argv.pop(0) 261 chroot_dir = sys.argv.pop(0)
261 elif arg == "-g" or arg == "--grp": 262 elif arg == "-g" or arg == "--grp":
262 mode = "grp" 263 mode = "grp"
263 elif arg == "-s" or arg == "--stage3": 264 elif arg == "-s" or arg == "--stage3":
264 mode = "stage3" 265 mode = "stage3"
265 elif arg == "-h" or arg == "--help": 266 elif arg == "-h" or arg == "--help":
266 usage() 267 usage(progname)
267 sys.exit(0) 268 sys.exit(0)
268 elif arg[0] == "-": 269 elif arg[0] == "-":
269 usage() 270 usage(progname)
270 sys.exit(1) 271 sys.exit(1)
271 else: 272 else:
272 grp_packages.append(arg) 273 grp_packages.append(arg)
273 274
274 gliportage = GLIPortage(chroot_dir, True, None, False, None, None) 275 gliportage = GLIPortage(chroot_dir, True, None, False, None, None)
330 print "Stage3 equivelant generation complete!" 331 print "Stage3 equivelant generation complete!"
331 elif mode == "grp": 332 elif mode == "grp":
332 for pkg in grp_packages: 333 for pkg in grp_packages:
333 if not gliportage.get_best_version_vdb(pkg): 334 if not gliportage.get_best_version_vdb(pkg):
334 print "Package " + pkg + " is not available for install from the LiveCD" 335 print "Package " + pkg + " is not available for install from the LiveCD"
336 continue
335 pkglist = gliportage.get_deps(pkg) 337 pkglist = gliportage.get_deps(pkg)
336 for tmppkg in pkglist: 338 for i, tmppkg in enumerate(pkglist):
339 print "Copying " + tmppkg + " (" + str(i+1) + "/" + str(len(pkglist)) + ")"
337 gliportage.copy_pkg_to_chroot(tmppkg) 340 gliportage.copy_pkg_to_chroot(tmppkg)
338 gliportage.add_pkg_to_world(pkg) 341 gliportage.add_pkg_to_world(pkg)
339 print "GRP install complete!" 342 print "GRP install complete!"
340 else: 343 else:
341 print "You must specify an operating mode (-g or -s)!" 344 print "You must specify an operating mode (-g or -s)!"
342 usage() 345 usage(progname)
343 sys.exit(1) 346 sys.exit(1)

Legend:
Removed from v.1310  
changed lines
  Added in v.1311

  ViewVC Help
Powered by ViewVC 1.1.20