/[smecontribs]/rpms/plague/contribs8/plague-0.4.4.1-mock-0.8.patch
ViewVC logotype

Annotation of /rpms/plague/contribs8/plague-0.4.4.1-mock-0.8.patch

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


Revision 1.1 - (hide annotations) (download)
Thu Mar 27 16:07:38 2008 UTC (16 years, 3 months ago) by slords
Branch: MAIN
CVS Tags: plague-0_4_4_1-10_el5_sme
Import on branch contribs8 of package plague-0.4.4.1-10.el5.sme.src.rpm

1 slords 1.1 diff -Nur plague-0.4.4.1-fe/builder/builder.py plague-0.4.4.1/builder/builder.py
2     --- plague-0.4.4.1-fe/builder/builder.py 2007-11-14 18:41:33.000000000 +0100
3     +++ plague-0.4.4.1/builder/builder.py 2007-11-14 18:46:29.000000000 +0100
4     @@ -108,9 +108,7 @@
5     if not os.path.exists(self._result_dir):
6     os.makedirs(self._result_dir)
7    
8     - self._state_dir = os.path.join(self._work_dir, self._uniqid, "mock-state")
9     - if not os.path.exists(self._state_dir):
10     - os.makedirs(self._state_dir)
11     + self._state_file = os.path.join(self._result_dir,"state.log")
12    
13     logfile = os.path.join(self._result_dir, "job.log")
14     self._log_fd = open(logfile, "w+")
15     @@ -218,12 +216,12 @@
16     args.append(arg)
17     cmd = os.path.abspath(arg_list[0])
18     args.append(builder_cmd)
19     + args.append("rebuild")
20     args.append("-r")
21     args.append(self.buildroot)
22     args.append("--arch")
23     args.append(self.buildarch)
24     args.append("--resultdir=%s" % self._result_dir)
25     - args.append("--statedir=%s" % self._state_dir)
26     args.append("--uniqueext=%s" % self._uniqid)
27     args.append(self._srpm_path)
28     self._log(" %s\n" % string.join(args))
29     @@ -257,33 +255,14 @@
30     def _mock_is_prepping(self):
31     mock_status = self._get_mock_status()
32     if mock_status:
33     - if mock_status == 'prep':
34     - return True
35     - elif mock_status == 'setu':
36     - return True
37     - return False
38     -
39     - def _mock_using_repo(self):
40     - mock_status = self._get_mock_status()
41     - if mock_status:
42     - if mock_status == 'init':
43     - return True
44     - elif mock_status == 'clea':
45     - return True
46     - elif mock_status == 'prep':
47     - return True
48     - elif mock_status == 'setu':
49     - return True
50     - return False
51     -
52     - def _mock_is_closed(self):
53     - mock_status = self._get_mock_status()
54     - if mock_status and mock_status == "done":
55     - return True
56     + prepstates = ['enabl','creating cache','unpacking cache','setup']
57     + for s in prepstates:
58     + if mock_status.startswith(s):
59     + return True
60     return False
61    
62     def _get_mock_status(self):
63     - mockstatusfile = os.path.join(self._state_dir, 'status')
64     + mockstatusfile = self._state_file
65     if not os.path.exists(mockstatusfile):
66     return None
67    
68     @@ -292,8 +271,7 @@
69    
70     while True:
71     try:
72     - f.seek(0, 0)
73     - string = f.read(4)
74     + lines = f.readlines()
75     except OSError, e:
76     if e.errno == errno.EAGAIN:
77     try:
78     @@ -302,12 +280,19 @@
79     pass
80     continue
81     else:
82     - if len(string) < 4:
83     + if not len(lines):
84     continue
85     break
86     f.close()
87     - string = string.lower()
88     - return string
89     + mockstat = None
90     + lastline = lines[len(lines)-1].lower()
91     + statedelim = "state changed:"
92     + stateidx = lastline.rfind(statedelim)
93     + if stateidx>0:
94     + mockstat = lastline[stateidx+len(statedelim):].lstrip()
95     + return mockstat
96     + else:
97     + return None
98    
99     def _read_mock_config(self):
100     mockconfigfile = os.path.join(self._result_dir, 'mockconfig.log')
101     @@ -373,8 +358,7 @@
102     # Refresh mock status to see whether it changed during sleep.
103     # Avoid mock/plague race condition.
104     if not self._mock_is_prepping():
105     - if not self._mock_using_repo(): # status changed during sleep
106     - self._status = 'building'
107     + self._status = 'building'
108     return
109     # Mock shouldn't exit at all during the prepping stage, if it does
110     # something is wrong
111     @@ -384,8 +368,7 @@
112    
113     # We need to make sure that mock has dumped the status file withing a certain
114     # amount of time, otherwise we can't tell what it's doing
115     - mockstatusfile = os.path.join(self._state_dir, 'status')
116     - if not os.path.exists(mockstatusfile):
117     + if not os.path.exists(self._state_file):
118     # something is wrong if mock takes more than 15s to write the status file
119     if time.time() > self._mockstarttime + 15:
120     self._mockstarttime = 0
121     @@ -410,9 +393,6 @@
122     if mock_root_dir.endswith(self._uniqid):
123     shutil.rmtree(mock_root_dir, ignore_errors=True)
124    
125     - if self._mock_config.has_key('statedir'):
126     - shutil.rmtree(self._mock_config['statedir'], ignore_errors=True)
127     -
128     source_dir = os.path.abspath(os.path.join(self._mock_config['rootdir'], "../source"))
129     # Ensure we're actually deleteing the job's sourcedir
130     if source_dir.endswith(os.path.join(self._uniqid, "source")):

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