From: John P. Davis Date: Mon, 4 Oct 2004 13:10:32 +0000 (+0000) Subject: new -s option for creating snapshots X-Git-Tag: CATALYST_2_0_6_916~929 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ac746eff536399d61e8d290dab48a87cc4f65115;p=catalyst.git new -s option for creating snapshots git-svn-id: svn+ssh://svn.gentoo.org/var/svnroot/catalyst/trunk@444 d1e1f19c-881f-0410-ab34-b69fee027534 --- diff --git a/ChangeLog b/ChangeLog index 4433046b..d99b7560 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for gentoo/src/catalyst # Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.86 2004/09/29 06:44:26 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/ChangeLog,v 1.87 2004/10/04 13:10:32 zhen Exp $ + + 04 Oct 2004; John Davis catalyst: + added a new -s/ --snapshot option. no more using --cli to create snapshots, + just do -s version_stamp 29 Sep 2004; John Davis targets/stage2/stage2-chroot.sh: bugfix #60502 - the stage2 target can now resume the bootstrapping process diff --git a/catalyst b/catalyst index bc2c63e8..586be0e5 100755 --- a/catalyst +++ b/catalyst @@ -1,7 +1,7 @@ #!/usr/bin/python # Copyright 1999-2004 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.47 2004/09/13 14:27:07 zhen Exp $ +# $Header: /var/cvsroot/gentoo/src/catalyst/catalyst,v 1.48 2004/10/04 13:10:32 zhen Exp $ # Maintained in full by John Davis @@ -13,7 +13,7 @@ __version__="1.0.9" conf_values={} def usage(): - print "Usage catalyst [options] [-C variable=value...]" + print "Usage catalyst [options] [-C variable=value...] [ -s identifier]" print " -h --help print this help message" print " -v --version display version information" print " -d --debug enable debugging" @@ -21,12 +21,16 @@ def usage(): print " -C --cli catalyst commandline (MUST BE LAST OPTION)" print " -f --file read specfile" print " -V --verbose verbose output" + print " -s --snapshot generate a Portage snapshot" print print "Usage examples:" print print "Using the commandline option (-C, --cli) to build a Portage snapshot:" print "catalyst -C target=snapshot version_stamp=my_date" print + print "Using the snapshot option (-s, --snapshot) to build a Portage snapshot:" + print "catalyst -s 2004.3" + print print "Using the specfile option (-f, --file) to build a stage target:" print "catalyst -f stage1-specfile.spec" @@ -180,8 +184,8 @@ if __name__ == "__main__": # parse out the command line arguments try: - opts,args = getopt.getopt(sys.argv[1:], "hvdc:C:f:V", ["help", "version", "debug",\ - "config=", "cli=", "file=", "verbose"]) + opts,args = getopt.getopt(sys.argv[1:], "hvdc:C:f:Vs:", ["help", "version", "debug",\ + "config=", "cli=", "file=", "verbose","snapshot="]) except getopt.GetoptError: usage() @@ -220,22 +224,20 @@ if __name__ == "__main__": sys.exit(1) if o in ("-d", "--debug"): - conf_values["DEBUG"]="1" - - # the debug option cannot be used alone - if not ('-f' in myopts or '--file' in myopts) or ('-C' in myopts or '--cli' in myopts): + if len(sys.argv) < 3: print "!!! catalyst: please specify one of either -f or -C\n" usage() sys.exit(2) + else: + conf_values["DEBUG"]="1" if o in ("-c", "--config"): - myconfig=a - - # the config file option cannot be used alone - if not ('-f' in myopts or '--file' in myopts) or ('-C' in myopts or '--cli' in myopts): + if len(sys.argv) < 3: print "!!! catalyst: please specify one of either -f or -C\n" usage() sys.exit(2) + else: + myconfig=a if o in ("-C", "--cli"): x=sys.argv.index(o)+1 @@ -247,13 +249,21 @@ if __name__ == "__main__": myspecfile=a if o in ("-V", "--verbose"): - conf_values["VERBOSE"]="1" - - # the verbosity option cannot be used alone - if not ('-f' in myopts or '--file' in myopts) or ('-C' in myopts or '--cli' in myopts): + if len(sys.argv) < 3: print "!!! catalyst: please specify one of either -f or -C\n" usage() sys.exit(2) + else: + conf_values["VERBOSE"]="1" + + if o in ("-s", "--snapshot"): + if len(sys.argv) < 3: + print "!!! catalyst: missing snapshot identifier\n" + usage() + sys.exit(2) + else: + mycmdline.append("target=snapshot") + mycmdline.append("version_stamp="+a) # import configuration file and import our main module using those settings parse_config(myconfig) @@ -268,7 +278,7 @@ if __name__ == "__main__": if mycmdline: addlargs=do_cli(mycmdline) - + # everything is setup, so the build is a go try: build_target(addlargs, targetmap)