/[smeserver]/rpms/plague/sme10/plague-0.4.5.8-scm-updates.patch
ViewVC logotype

Contents of /rpms/plague/sme10/plague-0.4.5.8-scm-updates.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Mon Feb 15 14:25:35 2016 UTC (8 years, 9 months ago) by vip-ire
Branch: MAIN
CVS Tags: plague-0_4_5_8-2_el7_sme, HEAD
Error occurred while calculating annotation data.
Import plague in sme10 branch

1 diff -up plague-0.4.5.8/server/PackageJob.py.scm-updates plague-0.4.5.8/server/PackageJob.py
2 --- plague-0.4.5.8/server/PackageJob.py.scm-updates 2008-09-21 07:38:41.000000000 -0600
3 +++ plague-0.4.5.8/server/PackageJob.py 2011-04-09 09:56:01.290335772 -0600
4 @@ -37,6 +37,7 @@ from plague import ArchUtils
5 from plague import DebugUtils
6
7 CVS_CMD = "/usr/bin/cvs"
8 +GIT_CMD = "/usr/bin/git"
9 MAKE_CMD = "/usr/bin/make"
10
11 DEBUG = False
12 @@ -134,7 +135,7 @@ class PackageJob:
13 self.username = username
14 self.starttime = time.time()
15 self.endtime = 0
16 - self.use_cvs = self._server_cfg.get_bool("CVS", "use_cvs")
17 +
18 self._source = source
19 self.result_dir = None
20 self.srpm_path = None
21 @@ -150,7 +151,7 @@ class PackageJob:
22 "server_work_dir"), "srpm_http_dir")
23
24 first_stage = 'initialize'
25 - if self.use_cvs == False:
26 + if source.endswith(".src.rpm") or source.find("/") != -1:
27 first_stage = 'prep'
28 pjc = PackageJobController(self, first_stage, 'waiting')
29 pjc.start()
30 @@ -289,54 +290,96 @@ class PackageJob:
31 dirname = "%s-%s-%d" % (self.uid, self._source, time.time())
32 tmpdir = self._server_cfg.get_str("Directories", "tmpdir")
33 self.checkout_tmpdir = os.path.join(tmpdir, dirname)
34 - if os.path.exists(self.checkout_tmpdir):
35 - shutil.rmtree(self.checkout_tmpdir, ignore_errors=True)
36 + if not self._source.endswith(".src.rpm") and self._source.find("/") == -1:
37 + if os.path.exists(self.checkout_tmpdir):
38 + shutil.rmtree(self.checkout_tmpdir, ignore_errors=True)
39 os.makedirs(self.checkout_tmpdir)
40
41 - # Set up CVS environment
42 - env_args = "CVSROOT='%s'" % self._target_cfg.get_str("CVS", "cvs_root")
43 - cvs_rsh = self._target_cfg.get_str("CVS", "cvs_rsh")
44 - if len(cvs_rsh) > 0:
45 - env_args = "%s CVS_RSH='%s'" % (env_args, cvs_rsh)
46 -
47 - # Checkout the module
48 - cmd = 'umask 0022; cd %s; %s %s co -r %s %s' % (self.checkout_tmpdir, env_args, CVS_CMD,
49 - self._source, self.package)
50 - debugprint("%d: Running %s" % (self.uid, cmd))
51 - s, o = commands.getstatusoutput(cmd)
52 - if s != 0:
53 - err_msg = "Error: could not check out %s from %s - output was:\n\n" \
54 - "%s" % (self._source, self._target_str, o)
55 - else:
56 - # Just in case the 'common' directory didn't come along for the ride,
57 - # get it from CVS
58 - pkg_path = os.path.join(self.checkout_tmpdir, self.package)
59 - if not os.path.exists(os.path.join(pkg_path, "common")):
60 - cmd = 'cd %s; %s %s co common' % (pkg_path, env_args, CVS_CMD)
61 + if self._target_cfg.has_option("SCM", "cvs_root"):
62 + # Set up CVS environment
63 + env_args = "CVSROOT='%s'" % self._target_cfg.get_str("SCM", "cvs_root")
64 + cvs_rsh = self._target_cfg.get_str("SCM", "cvs_rsh")
65 + if len(cvs_rsh) > 0:
66 + env_args = "%s CVS_RSH='%s'" % (env_args, cvs_rsh)
67 +
68 + # Checkout the module
69 + cmd = 'umask 0022; cd %s; %s %s co -r %s %s' % (self.checkout_tmpdir, env_args, CVS_CMD,
70 + self._source, self.package)
71 + debugprint("%d: Running %s" % (self.uid, cmd))
72 + s, o = commands.getstatusoutput(cmd)
73 + if s != 0:
74 + err_msg = "Error: could not check out %s from %s - output was:\n\n" \
75 + "%s" % (self._source, self._target_str, o)
76 + else:
77 + # Just in case the 'common' directory didn't come along for the ride,
78 + # get it from CVS
79 + pkg_path = os.path.join(self.checkout_tmpdir, self.package)
80 + if not os.path.exists(os.path.join(pkg_path, "common")):
81 + cmd = 'cd %s; %s %s co common' % (pkg_path, env_args, CVS_CMD)
82 + debugprint("%d: Running %s" % (self.uid, cmd))
83 + s, o = commands.getstatusoutput(cmd)
84 + if s != 0:
85 + err_msg = "Error: could not check out common directory - " \
86 + "output was:\n\n%s" % (self._source, self._target_str, o)
87 +
88 + self.bm.notify_checkout_done(self)
89 +
90 + if err_msg:
91 + raise PrepError(err_msg)
92 +
93 + elif self._target_cfg.has_option("SCM", "git_root"):
94 + gitroot = self._target_cfg.get_str("SCM", "git_root")
95 + gitrepo = "%s/%s" % (gitroot, self.package)
96 + commonrepo = os.path.dirname(gitroot) + '/common'
97 + self.checkout_path = os.path.basename(self.package)
98 + if self.package.endswith('.git'):
99 + self.checkout_path = os.path.basename(self.package[:-4])
100 + commonrepo = os.path.dirname(gitroot) + '/common.git'
101 + sourcedir = '%s/%s' % (self.checkout_tmpdir, self.checkout_path)
102 +
103 + # Checkout the module
104 + cmd = 'cd %s; umask 0022; %s clone -n %s %s' % (self.checkout_tmpdir,
105 + GIT_CMD, gitrepo, self.checkout_path)
106 + debugprint("%d: Running %s" % (self.uid, cmd))
107 + s, o = commands.getstatusoutput(cmd)
108 + if s == 0:
109 + cmd = 'cd %s; umask 0022; %s reset --hard %s' % (sourcedir, GIT_CMD, self._source)
110 debugprint("%d: Running %s" % (self.uid, cmd))
111 s, o = commands.getstatusoutput(cmd)
112 - if s != 0:
113 - err_msg = "Error: could not check out common directory - " \
114 - "output was:\n\n%s" % (self._source, self._target_str, o)
115 -
116 - self.bm.notify_checkout_done(self)
117 -
118 - if err_msg:
119 - raise PrepError(err_msg)
120 -
121 +
122 + if s != 0:
123 + err_msg = "Error: could not check out %s from %s - output was:\n\n" \
124 + "%s" % (self._source, self._target_str, o)
125 +
126 + self.bm.notify_checkout_done(self)
127 +
128 + if err_msg:
129 + raise PrepError(err_msg)
130 + else:
131 + self.bm.notify_checkout_done(self)
132 +
133 + raise PrepError( "Error: could not check out %s from %s\n" %
134 + (self._source, self._target_str) )
135 +
136 self._set_cur_stage('make_srpm')
137 return False
138
139 def _stage_make_srpm(self):
140 - # Map our target to the CVS target alias, since CVS may have
141 + # Map our target to the SCM target alias, since SCM may have
142 # different target names than we expose
143 - cvs_target = self._target_dict['target']
144 - cvs_alias = self._target_cfg.get_str("Aliases", "cvs_alias")
145 - if len(cvs_alias) > 0:
146 - cvs_target = cvs_alias
147 + srpm_dir = None
148 + if self._target_cfg.has_option("SCM", "cvs_root"):
149 + cvs_target = self._target_dict['target']
150 + cvs_alias = self._target_cfg.get_str("Aliases", "cvs_alias")
151 + if len(cvs_alias) > 0:
152 + cvs_target = cvs_alias
153 +
154 + self.srpm_path = None
155 + srpm_dir = os.path.join(self.checkout_tmpdir, self.package, cvs_target)
156 +
157 + elif self._target_cfg.has_option("SCM", "git_root"):
158 + srpm_dir = os.path.join(self.checkout_tmpdir, self.checkout_path)
159
160 - self.srpm_path = None
161 - srpm_dir = os.path.join(self.checkout_tmpdir, self.package, cvs_target)
162 if not os.path.exists(srpm_dir):
163 msg = "Error: could not find checkout directory %s for %s. Sources probably don't exist for this target." % (srpm_dir, self._source)
164 raise PrepError(msg)
165 @@ -383,8 +426,8 @@ class PackageJob:
166
167 def _stage_prep(self):
168
169 - # In SRPM-only mode, cvs_tag is path to the SRPM to build
170 - if self.use_cvs == False:
171 + # In SRPM-only mode, _source is path to the SRPM to build
172 + if self._source.endswith(".src.rpm") or self._source.find("/") != -1:
173 self.srpm_path = self._source
174
175 # fail the job if we can't access the SRPM. Can happen during
176 @@ -425,9 +468,10 @@ class PackageJob:
177 shutil.copy(self.srpm_path, self.srpm_http_path)
178 self.srpm_path = None
179
180 - # Remove CVS checkout and make_srpm dirs
181 - if self.use_cvs == True:
182 - shutil.rmtree(self.checkout_tmpdir, ignore_errors=True)
183 + # Remove SCM checkout and make_srpm dirs
184 + if not self._source.endswith(".src.rpm") and self._source.find("/") == -1:
185 + if os.path.exists(self.checkout_tmpdir):
186 + shutil.rmtree(self.checkout_tmpdir, ignore_errors=True)
187
188 self._request_arch_jobs()
189 self._set_cur_stage('waiting')
190 @@ -554,8 +598,9 @@ class PackageJob:
191 self._event.wait()
192 self._event.clear()
193 except PrepError, e:
194 - if self.use_cvs == True:
195 - shutil.rmtree(self.checkout_tmpdir, ignore_errors=True)
196 + if not self._source.endswith(".src.rpm") and self._source.find("/") == -1:
197 + if os.path.exists(self.checkout_tmpdir):
198 + shutil.rmtree(self.checkout_tmpdir, ignore_errors=True)
199 subj = 'Prep Error (Job %s): %s on %s' % (self.uid, self._source, self._target_str)
200 self.email_result(self.username, resultstring=e.msg, subject=subj)
201 self._stage_failed(e.msg)
202 diff -up plague-0.4.5.8/server/UserInterface.py.scm-updates plague-0.4.5.8/server/UserInterface.py
203 --- plague-0.4.5.8/server/UserInterface.py.scm-updates 2011-04-09 09:55:35.647857242 -0600
204 +++ plague-0.4.5.8/server/UserInterface.py 2011-04-09 09:56:01.294335535 -0600
205 @@ -58,7 +58,7 @@ def validate_package_name(name):
206 return False
207 return True
208
209 -def validate_cvs_tag(tag):
210 +def validate_scm_tag(tag):
211 safe_list = ['-', '_', '.', ':', '~', '[', ']', '+']
212 for c in tag:
213 if not (c in safe_list) and not c.isalnum():
214 @@ -117,28 +117,8 @@ class UserInterface:
215 def enqueue(self, email, package, source, target_alias, buildreq=None):
216 """ Accept a job to build and stuff it into the job database """
217
218 - is_cvs_tag = True
219 - if source.endswith(".src.rpm") or source.find("/") != -1:
220 - is_cvs_tag = False
221 -
222 # Do source-type specifc validation
223 - if is_cvs_tag:
224 - if self._cfg.get_bool("CVS", "use_cvs") == False:
225 - self.email_result(email, source, "Error setting up build for %s on "\
226 - "%s: this server builds SRPMs, not CVS checkouts." % (source, target_alias))
227 - return (-1, "This build server is set up for building SRPMS only. ", -1)
228 -
229 - if not validate_cvs_tag(source):
230 - self.email_result(email, source, "Error setting up build for %s on "\
231 - "%s: The CVS tag '%s' contained an illegal character. "\
232 - "Submit a bug report?" % (package, target_alias, cvs_tag))
233 - return (-1, "The CVS tag contained an illegal character.", -1)
234 - else:
235 - if self._cfg.get_bool("CVS", "use_cvs") == True:
236 - self.email_result(email, source, "Error setting up build for %s on "\
237 - "%s: this server builds CVS checkouts, not SRPMs." % (source, target_alias))
238 - return (-1, "This build server is set up for building CVS checkouts only. ", -1)
239 -
240 + if source.endswith(".src.rpm") or source.find("/") != -1:
241 # We limit the database field to 255 chars
242 if len(source) > 255:
243 self.email_result(email, source, "Error setting up build for %s on "\
244 @@ -150,6 +130,12 @@ class UserInterface:
245 self.email_result(email, source, "Error setting up build for %s on "\
246 "%s: The SRPM does not exist, or is not accessible. Remember to use absolute paths." % (source, target_alias))
247 return (-1, "SRPM does not exist or is not accessible, remember to use absolute paths.", -1)
248 + else:
249 + if not validate_scm_tag(source):
250 + self.email_result(email, source, "Error setting up build for %s on "\
251 + "%s: The SCM tag '%s' contained an illegal character. "\
252 + "Submit a bug report?" % (package, target_alias, scm_tag))
253 + return (-1, "The SCM tag contained an illegal character.", -1)
254
255 if not validate_package_name(package):
256 self.email_result(email, source, "Error setting up build for %s on "\

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed