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)
Patch for installation | |
---|---|
1 | From 41538ed97a8c59f110aead71c185e0140a9b605a 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 | 61 +++++++++++++++++++++++++++++++++++++++++-- |
9 | 1 file changed, 59 insertions(+), 2 deletions(-) |
10 | |
11 | diff --git a/reviewboard/cmdline/rbsite.py b/reviewboard/cmdline/rbsite.py |
12 | index b3b4af61731abba99273b8eae566e1de7efd193f..190e2a53f00b7a44ccb7210388eeee95a56e51ec 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,43 @@ class Site(object): |
25 | fp.close() |
26 | |
27 | |
28 | +class SiteList(object): |
29 | + """Maintains the list of sites installed on the system.""" |
30 | + def __init__(self, path): |
31 | + self.path = path |
32 | + |
33 | + # Read the list in as a unique set. |
34 | + # This way, we can easily eliminate duplicates. |
35 | + self.sites = set() |
36 | + |
37 | + if os.path.exists(self.path): |
38 | + f = open(self.path, 'r') |
39 | + |
40 | + for line in f: |
41 | + site = line.strip() |
42 | + |
43 | + # Verify that this path exists on the system |
44 | + # And add it to the dictionary. |
45 | + if os.path.exists(site): |
46 | + self.sites.add(site) |
47 | + |
48 | + f.close() |
49 | + |
50 | + def add_site(self, site_path): |
51 | + self.sites.add(site_path) |
52 | + |
53 | + # Write all of the sites back to the file. |
54 | + # Sort keys to ensure consistent order. |
55 | + ordered_sites = list(self.sites) |
56 | + ordered_sites.sort() |
57 | + |
58 | + f = open(self.path, "w") |
59 | + for site in ordered_sites: |
60 | + f.write("%s\n" % site) |
61 | + |
62 | + f.close() |
63 | + |
64 | + |
65 | class UIToolkit(object): |
66 | """ |
67 | An abstract class that forms the basis for all UI interaction. |
68 | @@ -1321,12 +1360,13 @@ class InstallCommand(Command): |
69 | needs_ui = True |
70 | |
71 | def add_options(self, parser): |
72 | - isWin = (platform.system() == "Windows") |
73 | + is_windows = platform.system() == "Windows" |
74 | |
75 | group = OptionGroup(parser, "'install' command", |
76 | self.__doc__.strip()) |
77 | group.add_option("--copy-media", action="store_true", |
78 | - dest="copy_media", default=isWin, |
79 | + dest="copy_media", |
80 | + default=is_windows, |
81 | help="copy media files instead of symlinking") |
82 | |
83 | group.add_option("--noinput", action="store_true", default=False, |
84 | @@ -1372,6 +1412,13 @@ class InstallCommand(Command): |
85 | group.add_option("--admin-email", |
86 | help="the site administrator's e-mail address") |
87 | |
88 | + # UNIX-specific arguments |
89 | + if not is_windows: |
90 | + group.add_option("--sitelist", |
91 | + default=SITELIST_FILE_UNIX, |
92 | + help="the path to a file storing a list of " |
93 | + "installed sites") |
94 | + |
95 | parser.add_option_group(group) |
96 | |
97 | def run(self): |
98 | @@ -1401,6 +1448,7 @@ class InstallCommand(Command): |
99 | self.ask_web_server_type() |
100 | self.ask_python_loader() |
101 | self.ask_admin_user() |
102 | + # Do not ask for sitelist file, it should not be common. |
103 | |
104 | self.show_install_status() |
105 | self.show_finished() |
106 | @@ -1742,6 +1790,15 @@ class InstallCommand(Command): |
107 | siteconfig.set("site_admin_email", site.admin_email) |
108 | siteconfig.save() |
109 | |
110 | + if platform.system() != 'Windows': |
111 | + abs_sitelist = os.path.abspath(site.sitelist) |
112 | + |
113 | + # Add the site to the sitelist file. |
114 | + print("Saving site %s to the sitelist %s\n" % ( |
115 | + site.install_dir, abs_sitelist)) |
116 | + sitelist = SiteList(abs_sitelist) |
117 | + sitelist.add_site(site.install_dir) |
118 | + |
119 | |
120 | class UpgradeCommand(Command): |
121 | """ |
122 | -- |
123 | 1.8.3.1 |