~ed.so/duplicity/0.6-webdav_fixes

« back to all changes in this revision

Viewing changes to dist/makeweb

  • Committer: Kenneth Loafman
  • Date: 2011-11-25 19:16:30 UTC
  • Revision ID: kenneth@loafman.com-20111125191630-y829tehwhr9mcl61
Not used.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
3
 
#
4
 
# Copyright 2002 Ben Escoto <ben@emerose.org>
5
 
# Copyright 2007 Kenneth Loafman <kenneth@loafman.com>
6
 
#
7
 
# This file is part of duplicity.
8
 
#
9
 
# Duplicity is free software; you can redistribute it and/or modify it
10
 
# under the terms of the GNU General Public License as published by the
11
 
# Free Software Foundation; either version 2 of the License, or (at your
12
 
# option) any later version.
13
 
#
14
 
# Duplicity is distributed in the hope that it will be useful, but
15
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
 
# General Public License for more details.
18
 
#
19
 
# You should have received a copy of the GNU General Public License
20
 
# along with duplicity; if not, write to the Free Software Foundation,
21
 
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
 
 
23
 
import os, sys, re
24
 
 
25
 
def command_line_error():
26
 
    print ("Syntax:  %s [-u|-m|-c] version_number old_version_number"
27
 
           % sys.argv[0])
28
 
    print
29
 
    print "This program uploads the new files to the web page and moves the"
30
 
    print "old files to the OLD directory."
31
 
    sys.exit(1)
32
 
 
33
 
if len(sys.argv) == 4:
34
 
    version = sys.argv[2]
35
 
    old_version = sys.argv[3]
36
 
    command = sys.argv[1][1:]
37
 
elif len(sys.argv) == 3:
38
 
    command = sys.argv[1][1:]
39
 
    if command in ('u', 'm', 'c'): version = old_version = sys.argv[2]
40
 
    else:
41
 
        version = sys.argv[1]
42
 
        old_version = sys.argv[2]
43
 
        command = "all"
44
 
else: command_line_error()
45
 
 
46
 
duplicity_mirror = "/home/ben/misc/html/mirror/duplicity"
47
 
fedora_release = 1
48
 
tarball = "duplicity-%s.tar.gz" % version
49
 
srcrpm = "duplicity-%s-0.fdr.%d.src.rpm" % (version, fedora_release)
50
 
i386rpm = "duplicity-%s-0.fdr.%d.i386.rpm" % (version, fedora_release)
51
 
 
52
 
old_tarball = "duplicity-%s.tar.gz" % old_version
53
 
old_srcrpm = "duplicity-%s-1.src.rpm" % old_version
54
 
old_i386rpm = "duplicity-%s-1.i386.rpm" % old_version
55
 
 
56
 
def run(commandline):
57
 
    print commandline
58
 
    assert not os.system(commandline)
59
 
 
60
 
def upload_new():
61
 
    run("scp %s %s %s bescoto@savannah.nongnu.org:/upload/duplicity"
62
 
        % (tarball, srcrpm, i386rpm))
63
 
    run("cp CHANGELOG bin/duplicity.1 bin/rdiffdir.1 %s" % (duplicity_mirror,))
64
 
    run("rman -f html bin/duplicity.1 > %s/duplicity.1.html" % (duplicity_mirror,))
65
 
    run("rman -f html bin/rdiffdir.1 > %s/rdiffdir.1.html" % (duplicity_mirror,))
66
 
 
67
 
def move_old():
68
 
    """Move old files from upload area to OLD directory
69
 
 
70
 
    Unfortunately, savannah sftp is broken so apparently there is no
71
 
    way to remove the old files.
72
 
 
73
 
    """
74
 
    olddir = os.path.join(duplicity_mirror, "OLD", old_version)
75
 
    try: os.stat(olddir)
76
 
    except OSError:
77
 
        os.mkdir(olddir)
78
 
    run("mv %s %s %s %s" % (old_tarball, old_srcrpm, old_i386rpm, olddir))
79
 
 
80
 
def checkin_webpage():
81
 
    """Check new web page into CVS"""
82
 
    os.chdir(duplicity_mirror)
83
 
    try: run("cvs add OLD/%s" % old_version)
84
 
    except AssertionError: pass
85
 
    run("cvs add -kb OLD/%s/%s OLD/%s/%s OLD/%s/%s" %
86
 
        (old_version, old_tarball, old_version, old_i386rpm,
87
 
         old_version, old_srcrpm))
88
 
    run("cvs ci")
89
 
 
90
 
 
91
 
if __name__ == "__main__":
92
 
    if command == "u": upload_new()
93
 
    elif command == "m": move_old()
94
 
    elif command == "c": checkin_webpage()
95
 
    elif command == "all":
96
 
        upload_new()
97
 
        move_old()
98
 
        checkin_webpage()
99
 
    else: command_line_error()