From 86298ee27bac6458abdd4a9c2fd5027136bdb2ee Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Tue, 4 Jun 2013 14:47:38 -0400
Subject: [PATCH 1/2] Store installation paths to sitelist file during 'rb-site
install'
---
reviewboard/cmdline/rbsite.py | 76 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 74 insertions(+), 2 deletions(-)
diff --git a/reviewboard/cmdline/rbsite.py b/reviewboard/cmdline/rbsite.py
index 6b72c83bf7a4aec16d9bada270571ab4af822467..1b0b67febd4b7ba94c179bb3b2fee84560956bf7 100755
--- a/reviewboard/cmdline/rbsite.py
+++ b/reviewboard/cmdline/rbsite.py
@@ -18,6 +18,8 @@ from reviewboard import get_version_string
DOCS_BASE = "http://www.reviewboard.org/docs/manual/dev/"
+SITELIST_FILE_UNIX = "/etc/reviewboard/sites"
+
# See if GTK is a possibility.
try:
@@ -639,6 +641,58 @@ class Site(object):
fp.close()
+class SiteList(object):
+ """Maintains the list of sites installed on the system."""
+ def __
Patch for installation
This change has been marked as completed.
Pushed to release-1.7.x (cbd5e59)
0001: rbsite install changes | |
---|---|
1 | From fbed7ca4b675bec0ff23aafa49f08ffa1ed07d9d Mon Sep 17 00:00:00 2001 |
2 | From: Stephen Gallagher <sgallagh@redhat.com> |
3 | Date: Tue, 4 Jun 2013 14:47:38 -0400 |
4 | Subject: [PATCH 1/2] Store installation paths to sitelist file during 'rb-site |
5 | install' |
6 | |
7 | --- |
8 | reviewboard/cmdline/rbsite.py | 66 +++++++++++++++++++++++++++++++++++++++++-- |
9 | 1 file changed, 63 insertions(+), 3 deletions(-) |
10 | |
11 | diff --git a/reviewboard/cmdline/rbsite.py b/reviewboard/cmdline/rbsite.py |
12 | index b3b4af61731abba99273b8eae566e1de7efd193f..0a7746a166f13a39577b97592d298c5bb509e979 100755 |
13 | --- a/reviewboard/cmdline/rbsite.py |
14 | +++ b/reviewboard/cmdline/rbsite.py |
15 | @@ -18,6 +18,8 @@ from reviewboard import get_version_string |
16 | |
17 | DOCS_BASE = "http://www.reviewboard.org/docs/manual/dev/" |
18 | |
19 | +SITELIST_FILE_UNIX = "/etc/reviewboard/sites" |
20 | + |
21 | |
22 | # See if GTK is a possibility. |
23 | try: |
24 | @@ -630,6 +632,48 @@ class Site(object): |
25 | fp.close() |
26 | |
27 | |
28 | +class SiteList(object): |
29 | + """ |
30 | + Maintains the list of sites installed on the system. |
31 | + """ |
32 | + def __init__(self, path): |
33 | + self.path = path |
34 | + |
35 | + # Read the list in as a unique set. |
36 | + # This way, we can easily eliminate duplicates. |
37 | + self.sites = set() |
38 | + |
39 | + if os.path.exists(self.path): |
40 | + f = open(self.path, 'r') |
41 | + |
42 | + for line in f: |
43 | + site = line.strip() |
44 | + |
45 | + # Verify that this path exists on the system |
46 | + # And add it to the dictionary. |
47 | + if os.path.exists(site): |
48 | + self.sites.add(site) |
49 | + |
50 | + f.close() |
51 | + |
52 | + def add_site(self, site_path): |
53 | + self.sites.add(site_path) |
54 | + |
55 | + # Write all of the sites back to the file. |
56 | + # Sort keys to ensure consistent order. |
57 | + osites = list(self.sites) |
58 | + osites.sort() |
59 | + |
60 | + f = open(self.path, "w+") |
61 | + for site in osites: |
62 | + f.write("%s\n" % site) |
63 | + |
64 | + f.close() |
65 | + |
66 | + def get_sites(self): |
67 | + return self.sites |
68 | + |
69 | + |
70 | class UIToolkit(object): |
71 | """ |
72 | An abstract class that forms the basis for all UI interaction. |
73 | @@ -1321,12 +1365,11 @@ class InstallCommand(Command): |
74 | needs_ui = True |
75 | |
76 | def add_options(self, parser): |
77 | - isWin = (platform.system() == "Windows") |
78 | - |
79 | group = OptionGroup(parser, "'install' command", |
80 | self.__doc__.strip()) |
81 | group.add_option("--copy-media", action="store_true", |
82 | - dest="copy_media", default=isWin, |
83 | + dest="copy_media", |
84 | + default=platform.system() == 'Windows', |
85 | help="copy media files instead of symlinking") |
86 | |
87 | group.add_option("--noinput", action="store_true", default=False, |
88 | @@ -1372,6 +1415,13 @@ class InstallCommand(Command): |
89 | group.add_option("--admin-email", |
90 | help="the site administrator's e-mail address") |
91 | |
92 | + # UNIX-specific arguments |
93 | + if not platform.system() == 'Windows': |
94 | + group.add_option("--sitelist", |
95 | + default=SITELIST_FILE_UNIX, |
96 | + help="the path to a file storing a list of " |
97 | + "installed sites") |
98 | + |
99 | parser.add_option_group(group) |
100 | |
101 | def run(self): |
102 | @@ -1401,6 +1451,7 @@ class InstallCommand(Command): |
103 | self.ask_web_server_type() |
104 | self.ask_python_loader() |
105 | self.ask_admin_user() |
106 | + # Do not ask for sitelist file, it should not be common. |
107 | |
108 | self.show_install_status() |
109 | self.show_finished() |
110 | @@ -1742,6 +1793,15 @@ class InstallCommand(Command): |
111 | siteconfig.set("site_admin_email", site.admin_email) |
112 | siteconfig.save() |
113 | |
114 | + if not platform.system() == 'Windows': |
115 | + abs_sitelist = os.path.abspath(site.sitelist) |
116 | + |
117 | + # Add the site to the sitelist file. |
118 | + print("Saving site %s to the sitelist %s\n" % ( |
119 | + site.install_dir, abs_sitelist)) |
120 | + sitelist = SiteList(abs_sitelist) |
121 | + sitelist.add_site(site.install_dir) |
122 | + |
123 | |
124 | class UpgradeCommand(Command): |
125 | """ |
126 | -- |
127 | 1.8.2.1 |