2 # Copyright (C) 2009, Thomas Leonard
3 # See the README file for details, or visit http://0install.net.
5 from optparse
import OptionParser
8 sys
.path
.insert(1, os
.environ
['0RELEASE_ZEROINSTALL'])
9 from zeroinstall
import SafeException
10 from zeroinstall
.injector
import reader
, model
14 parser
= OptionParser(usage
= """usage: %prog [options] LOCAL-FEED
16 Run this command from a new empty directory to set things up.""")
18 parser
.add_option("", "--builders", help="comma-separated list of builders for binaries", metavar
='LIST')
19 parser
.add_option("", "--build-slave", help="compile a binary a source release candidate", action
='store_true')
20 parser
.add_option("-k", "--key", help="GPG key to use for signing", action
='store', metavar
='KEYID')
21 parser
.add_option("-v", "--verbose", help="more verbose output", action
='count')
22 parser
.add_option("-r", "--release", help="make a new release", action
='store_true')
23 parser
.add_option("", "--archive-dir-public-url", help="remote directory for releases", metavar
='URL')
24 parser
.add_option("", "--master-feed-file", help="local file to extend with new releases", metavar
='PATH')
25 parser
.add_option("", "--archive-upload-command", help="shell command to upload releases", metavar
='COMMAND')
26 parser
.add_option("", "--master-feed-upload-command", help="shell command to upload feed", metavar
='COMMAND')
27 parser
.add_option("", "--public-scm-repository", help="the name of the repository to push to", metavar
='REPOS')
28 parser
.add_option("-V", "--version", help="display version information", action
='store_true')
30 (options
, args
) = parser
.parse_args()
33 print "0release (zero-install) " + version
34 print "Copyright (C) 2009 Thomas Leonard"
35 print "This program comes with ABSOLUTELY NO WARRANTY,"
36 print "to the extent permitted by law."
37 print "You may redistribute copies of this program"
38 print "under the terms of the GNU General Public License."
39 print "For more information about these matters, see the file named COPYING."
44 logger
= logging
.getLogger()
45 if options
.verbose
== 1:
46 logger
.setLevel(logging
.INFO
)
48 logger
.setLevel(logging
.DEBUG
)
50 if options
.build_slave
:
54 src_feed
, archive_file
, archive_dir_public_url
, target_feed
= args
56 compile.build_slave(src_feed
, archive_file
, archive_dir_public_url
, target_feed
)
63 local_feed_path
= args
[0]
66 if not os
.path
.exists(local_feed_path
):
67 raise SafeException("Local feed file '%s' does not exist" % local_feed_path
)
69 iface
= model
.Interface(model
.canonical_iface_uri(local_feed_path
))
70 reader
.update(iface
, local_feed_path
, local
= True)
74 release
.do_release(iface
, options
)
77 setup
.init_releases_directory(iface
)
78 except KeyboardInterrupt, ex
:
79 print >>sys
.stderr
, "Interrupted"
82 if options
.verbose
: raise
83 print >>sys
.stderr
, str(ex
)
86 if options
.verbose
: raise
87 print >>sys
.stderr
, str(ex
)
89 except SafeException
, ex
:
90 if options
.verbose
: raise
91 print >>sys
.stderr
, str(ex
)