1 # Copyright (C) 2007, Thomas Leonard
2 # See the README file for details, or visit http://0install.net.
5 from zeroinstall
import SafeException
6 from zeroinstall
.injector
import reader
, model
8 release_uri
= 'http://0install.net/2007/interfaces/0release.xml'
13 def init_releases_directory(iface
):
14 files
= os
.listdir('.')
16 raise SafeException("This command must be run from an empty directory!\n(this one contains %s)" % (', '.join(files
[:5])))
18 print "Setting up releases directory for %s" % iface
.get_name()
20 master_feed_name
= iface
.get_name().replace(' ', '-') + '.xml'
22 make_release
= file('make-release', 'w')
23 make_release
.write("""#!/bin/sh
25 # The directory people will download the releases from.
26 # This will appear in the remote feed file.
27 #ARCHIVE_DIR_PUBLIC_URL=http://placeholder.org/releases
28 ARCHIVE_DIR_PUBLIC_URL=
30 # The path to the main feed.
31 # The new version is added here when you publish a release.
32 #MASTER_FEED_FILE="$HOME/public_html/feeds/MyProg.xml"
35 # A shell command to upload the generated archive file to the
36 # public server (corresponds to $ARCHIVE_DIR_PUBLIC_URL, which is
37 # used to download it again).
38 #ARCHIVE_UPLOAD_COMMAND='scp "$@" me@myhost:/var/www/releases/'
39 ARCHIVE_UPLOAD_COMMAND=
41 # A shell command to upload the master feed ($MASTER_FEED_FILE)
42 # to your web server. It will be downloaded using the feed's URL.
43 #MASTER_FEED_UPLOAD_COMMAND='scp "$@" me@myhost:/var/www/feeds/'
44 MASTER_FEED_UPLOAD_COMMAND=
47 exec 0launch %s --release %s \\
48 --archive-dir-public-url="$ARCHIVE_DIR_PUBLIC_URL" \\
49 --master-feed-file="$MASTER_FEED_FILE" \\
50 --archive-upload-command="$ARCHIVE_UPLOAD_COMMAND" \\
51 --master-feed-upload-command="$MASTER_FEED_UPLOAD_COMMAND" \\
53 """ % (master_feed_name
, release_uri
, iface
.uri
))
55 os
.chmod('make-release', 0775 & ~umask
)
56 print "Success - created script:\n %s\nNow edit it with your local settings." % os
.path
.abspath('make-release')
57 print "Then, create new releases by running it."