1 # Copyright (C) 2007, Thomas Leonard
2 # See the README file for details, or visit http://0install.net.
5 from zeroinstall
import SafeException
7 release_uri
= 'http://0install.net/2007/interfaces/0release.xml'
12 def init_releases_directory(feed
):
13 files
= os
.listdir('.')
15 raise SafeException("This command must be run from an empty directory!\n(this one contains %s)" % (', '.join(files
[:5])))
17 print "Setting up releases directory for %s" % feed
.get_name()
19 master_feed_name
= feed
.get_name().replace(' ', '-') + '.xml'
22 make_release
= file('make-release.bat', 'w')
23 make_release
.write("""@echo off
25 :: The directory people will download the releases from.
26 :: This will appear in the remote feed file.
27 ::set ARCHIVE_DIR_PUBLIC_URL=http://placeholder.org/releases/%%RELEASE_VERSION%%
28 set ARCHIVE_DIR_PUBLIC_URL=
30 :: The path to the main feed.
31 :: The new version is added here when you publish a release.
32 ::set MASTER_FEED_FILE="$HOME/public_html/feeds/MyProg.xml"
33 set MASTER_FEED_FILE=%s
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 :: If unset, you'll have to upload it yourself.
39 ::set ARCHIVE_UPLOAD_COMMAND=scp %%* me@myhost:/var/www/releases/%%RELEASE_VERSION%%/
40 set ARCHIVE_UPLOAD_COMMAND=
42 :: A shell command to upload the master feed (%%MASTER_FEED_FILE%%) and
43 :: related files to your web server. It will be downloaded using the
44 :: feed's URL. If unset, you'll have to upload it yourself.
45 ::set MASTER_FEED_UPLOAD_COMMAND=scp %%* me@myhost:/var/www/feeds/
46 set MASTER_FEED_UPLOAD_COMMAND=
48 :: Your public version control repository. When publishing, the new
49 :: HEAD and the release tag will be pushed to this using a command
50 :: such as "git-push main master v0.1"
51 :: If unset, you'll have to update it yourself.
52 ::set PUBLIC_SCM_REPOSITORY=origin
53 set PUBLIC_SCM_REPOSITORY=
56 0launch %s --release %s ^
57 --archive-dir-public-url="%%ARCHIVE_DIR_PUBLIC_URL%%" ^
58 --master-feed-file="%%MASTER_FEED_FILE%%" ^
59 --archive-upload-command="%%ARCHIVE_UPLOAD_COMMAND%%" ^
60 --master-feed-upload-command="%%MASTER_FEED_UPLOAD_COMMAND%%" ^
61 --public-scm-repository="%%PUBLIC_SCM_REPOSITORY%%" ^
63 """ % (master_feed_name
, release_uri
, feed
.local_path
))
65 print "Success - created script:\n %s" % os
.path
.abspath('make-release.bat')
67 make_release
= file('make-release', 'w')
68 make_release
.write("""#!/bin/sh
70 # The directory people will download the releases from.
71 # This will appear in the remote feed file.
72 #ARCHIVE_DIR_PUBLIC_URL='http://placeholder.org/releases/$RELEASE_VERSION'
73 ARCHIVE_DIR_PUBLIC_URL=
75 # The path to the main feed.
76 # The new version is added here when you publish a release.
77 #MASTER_FEED_FILE="$HOME/public_html/feeds/MyProg.xml"
80 # A shell command to upload the generated archive file to the
81 # public server (corresponds to $ARCHIVE_DIR_PUBLIC_URL, which is
82 # used to download it again).
83 # If unset, you'll have to upload it yourself.
84 #ARCHIVE_UPLOAD_COMMAND='scp "$@" me@myhost:/var/www/releases/$RELEASE_VERSION/'
85 ARCHIVE_UPLOAD_COMMAND=
87 # A shell command to upload the master feed ($MASTER_FEED_FILE) and
88 # related files to your web server. It will be downloaded using the
89 # feed's URL. If unset, you'll have to upload it yourself.
90 #MASTER_FEED_UPLOAD_COMMAND='scp "$@" me@myhost:/var/www/feeds/'
91 MASTER_FEED_UPLOAD_COMMAND=
93 # Your public version control repository. When publishing, the new
94 # HEAD and the release tag will be pushed to this using a command
95 # such as "git-push main master v0.1"
96 # If unset, you'll have to update it yourself.
97 #PUBLIC_SCM_REPOSITORY=origin
98 PUBLIC_SCM_REPOSITORY=
101 exec 0launch %s --release %s \\
102 --archive-dir-public-url="$ARCHIVE_DIR_PUBLIC_URL" \\
103 --master-feed-file="$MASTER_FEED_FILE" \\
104 --archive-upload-command="$ARCHIVE_UPLOAD_COMMAND" \\
105 --master-feed-upload-command="$MASTER_FEED_UPLOAD_COMMAND" \\
106 --public-scm-repository="$PUBLIC_SCM_REPOSITORY" \\
108 """ % (master_feed_name
, release_uri
, feed
.local_path
))
110 os
.chmod('make-release', 0775 & ~umask
)
111 print "Success - created script:\n %s" % os
.path
.abspath('make-release')
112 print "Now edit it with your local settings."
113 print "Then, create new releases by running it."