/ tests / frontend / conflicts-multirepo.sh
conflicts-multirepo.sh
  1  #! /usr/bin/env atf-sh
  2  . $(atf_get_srcdir)/test_environment.sh
  3  
  4  tests_init \
  5  	conflicts_multirepo \
  6  	conflicts_multirepo_cycle
  7  
  8  conflicts_multirepo_head() {
  9  	atf_set "timeout" "40"
 10  }
 11  
 12  conflicts_multirepo_body() {
 13  	touch a b c
 14  	cat << EOF >> manifest
 15  name: test
 16  origin: test
 17  version: 1
 18  maintainer: test
 19  categories: [test]
 20  comment: a test
 21  www: http://test
 22  prefix: /
 23  abi = "*";
 24  desc: <<EOD
 25  Yet another test
 26  EOD
 27  files: {
 28  	${TMPDIR}/a: "",
 29  }
 30  EOF
 31  
 32  	cat << EOF >> manifest2
 33  name: test2
 34  origin: test
 35  version: 1
 36  maintainer: test
 37  categories: [test]
 38  comment: a test
 39  www: http://test
 40  prefix: /
 41  abi = "*";
 42  desc: <<EOD
 43  Yet another test
 44  EOD
 45  files: {
 46  	${TMPDIR}/b: "",
 47  	${TMPDIR}/c: "",
 48  }
 49  EOF
 50  
 51  	cat << EOF >> manifest3
 52  name: test
 53  origin: test
 54  version: "1.1"
 55  maintainer: test
 56  categories: [test]
 57  comment: a test
 58  www: http://test
 59  prefix: /
 60  abi = "*";
 61  desc: <<EOD
 62  Yet another test
 63  EOD
 64  files: {
 65  	${TMPDIR}/a: "",
 66  	${TMPDIR}/b: "",
 67  }
 68  EOF
 69  
 70  	cat << EOF >> manifest4
 71  name: test2
 72  origin: test
 73  version: "1.1"
 74  maintainer: test
 75  categories: [test]
 76  comment: a test
 77  www: http://test
 78  prefix: /
 79  abi = "*";
 80  desc: <<EOD
 81  Yet another test
 82  EOD
 83  files: {
 84  	${TMPDIR}/c: "",
 85  }
 86  EOF
 87  	atf_check \
 88  		-o match:".*Installing.*\.\.\.$" \
 89  		-e empty \
 90  		-s exit:0 \
 91  		pkg register -M manifest
 92  
 93  	atf_check \
 94  		-o match:".*Installing.*\.\.\.$" \
 95  		-e empty \
 96  		-s exit:0 \
 97  		pkg register -M manifest2
 98  
 99  	mkdir repo1
100  	atf_check \
101  		-o empty \
102  		-e empty \
103  		-s exit:0 \
104  		pkg create -M manifest -o repo1/
105  
106  	atf_check \
107  		-o empty \
108  		-e empty \
109  		-s exit:0 \
110  		pkg create -M manifest2 -o repo1/
111  
112  	mkdir repo2
113  	atf_check \
114  		-o empty \
115  		-e empty \
116  		-s exit:0 \
117  		pkg create -M manifest3 -o repo2/
118  
119  	atf_check \
120  		-o empty \
121  		-e empty \
122  		-s exit:0 \
123  		pkg create -M manifest4 -o repo2/
124  
125  	atf_check \
126  		-o inline:"Creating repository in repo1:  done\nPacking files for repository:  done\n" \
127  		-e empty \
128  		-s exit:0 \
129  		pkg repo repo1
130  
131  	atf_check \
132  		-o inline:"Creating repository in repo2:  done\nPacking files for repository:  done\n" \
133  		-e empty \
134  		-s exit:0 \
135  		pkg repo repo2
136  
137  	cat << EOF >> repo.conf
138  local1: {
139  	url: file:///${TMPDIR}/repo1,
140  	enabled: true
141  }
142  local2: {
143  	url: file:///${TMPDIR}/repo2,
144  	enabled:true
145  }
146  EOF
147  
148  OUTPUT="Updating local1 repository catalogue...
149  ${JAILED}Fetching meta.conf:  done
150  ${JAILED}Fetching data:  done
151  Processing entries:  done
152  local1 repository update completed. 2 packages processed.
153  Updating local2 repository catalogue...
154  ${JAILED}Fetching meta.conf:  done
155  ${JAILED}Fetching data:  done
156  Processing entries:  done
157  local2 repository update completed. 2 packages processed.
158  All repositories are up to date.
159  Updating database digests format:  done
160  Checking for upgrades (2 candidates):  done
161  Processing candidates (2 candidates):  done
162  Checking integrity... done (2 conflicting)
163    - test-1.1 [local2] conflicts with test2-1 [installed] on ${TMPDIR}/b
164    - test-1.1 [local2] conflicts with test2-1 [local1] on ${TMPDIR}/b
165  Checking integrity... done (0 conflicting)
166  The following 2 package(s) will be affected (of 0 checked):
167  
168  Installed packages to be UPGRADED:
169  	test: 1 -> 1.1 [local2]
170  	test2: 1 -> 1.1 [local2]
171  
172  Number of packages to be upgraded: 2
173  ${JAILED}[1/2] Upgrading test2 from 1 to 1.1...
174  ${JAILED}[1/2] Extracting test2-1.1:  done
175  ${JAILED}[2/2] Upgrading test from 1 to 1.1...
176  ${JAILED}[2/2] Extracting test-1.1:  done
177  "
178  	atf_check \
179  		-o inline:"${OUTPUT}" \
180  		-s exit:0 \
181  		pkg -o CONSERVATIVE_UPGRADE=no -o REPOS_DIR="${TMPDIR}" -o PKG_CACHEDIR="${TMPDIR}" upgrade -y
182  }
183  
184  conflicts_multirepo_cycle_head() {
185  	atf_set "timeout" "40"
186  }
187  
188  # This case is the same as conflicts_multirepo but with test2 depending on test.
189  # This added dependency creates a cycle in the job scheduling graph which requires
190  # the upgrade job for test2 to be split.
191  conflicts_multirepo_cycle_body() {
192  	touch a b c
193  	cat << EOF >> manifest
194  name: test
195  origin: test
196  version: 1
197  maintainer: test
198  categories: [test]
199  comment: a test
200  www: http://test
201  prefix: /
202  abi = "*";
203  desc: <<EOD
204  Yet another test
205  EOD
206  files: {
207  	${TMPDIR}/a: "",
208  }
209  EOF
210  
211  	cat << EOF >> manifest2
212  name: test2
213  origin: test
214  version: 1
215  maintainer: test
216  categories: [test]
217  comment: a test
218  www: http://test
219  prefix: /
220  abi = "*";
221  desc: <<EOD
222  Yet another test
223  EOD
224  deps: {
225  	test: {
226  		origin: "test",
227  		version: "1"
228  	}
229  }
230  files: {
231  	${TMPDIR}/b: "",
232  	${TMPDIR}/c: "",
233  }
234  EOF
235  
236  	cat << EOF >> manifest3
237  name: test
238  origin: test
239  version: "1.1"
240  maintainer: test
241  categories: [test]
242  comment: a test
243  www: http://test
244  prefix: /
245  abi = "*";
246  desc: <<EOD
247  Yet another test
248  EOD
249  files: {
250  	${TMPDIR}/a: "",
251  	${TMPDIR}/b: "",
252  }
253  EOF
254  
255  	cat << EOF >> manifest4
256  name: test2
257  origin: test
258  version: "1.1"
259  maintainer: test
260  categories: [test]
261  comment: a test
262  www: http://test
263  prefix: /
264  abi = "*";
265  desc: <<EOD
266  Yet another test
267  EOD
268  deps: {
269  	test: {
270  		origin: "test",
271  		version: "1.1"
272  	}
273  }
274  files: {
275  	${TMPDIR}/c: "",
276  }
277  EOF
278  	atf_check \
279  		-o match:".*Installing.*\.\.\.$" \
280  		-e empty \
281  		-s exit:0 \
282  		pkg register -M manifest
283  
284  	atf_check \
285  		-o match:".*Installing.*\.\.\.$" \
286  		-e empty \
287  		-s exit:0 \
288  		pkg register -M manifest2
289  
290  	mkdir repo1
291  	atf_check \
292  		-o empty \
293  		-e empty \
294  		-s exit:0 \
295  		pkg create -M manifest -o repo1/
296  
297  	atf_check \
298  		-o empty \
299  		-e empty \
300  		-s exit:0 \
301  		pkg create -M manifest2 -o repo1/
302  
303  	mkdir repo2
304  	atf_check \
305  		-o empty \
306  		-e empty \
307  		-s exit:0 \
308  		pkg create -M manifest3 -o repo2/
309  
310  	atf_check \
311  		-o empty \
312  		-e empty \
313  		-s exit:0 \
314  		pkg create -M manifest4 -o repo2/
315  
316  	atf_check \
317  		-o inline:"Creating repository in repo1:  done\nPacking files for repository:  done\n" \
318  		-e empty \
319  		-s exit:0 \
320  		pkg repo repo1
321  
322  	atf_check \
323  		-o inline:"Creating repository in repo2:  done\nPacking files for repository:  done\n" \
324  		-e empty \
325  		-s exit:0 \
326  		pkg repo repo2
327  
328  	cat << EOF >> repo.conf
329  local1: {
330  	url: file:///${TMPDIR}/repo1,
331  	enabled: true
332  }
333  local2: {
334  	url: file:///${TMPDIR}/repo2,
335  	enabled:true
336  }
337  EOF
338  
339  OUTPUT="Updating local1 repository catalogue...
340  ${JAILED}Fetching meta.conf:  done
341  ${JAILED}Fetching data:  done
342  Processing entries:  done
343  local1 repository update completed. 2 packages processed.
344  Updating local2 repository catalogue...
345  ${JAILED}Fetching meta.conf:  done
346  ${JAILED}Fetching data:  done
347  Processing entries:  done
348  local2 repository update completed. 2 packages processed.
349  All repositories are up to date.
350  Updating database digests format:  done
351  Checking for upgrades (2 candidates):  done
352  Processing candidates (2 candidates):  done
353  Checking integrity... done (2 conflicting)
354    - test-1.1 [local2] conflicts with test2-1 [installed] on ${TMPDIR}/b
355    - test-1.1 [local2] conflicts with test2-1 [local1] on ${TMPDIR}/b
356  Checking integrity... done (0 conflicting)
357  The following 2 package(s) will be affected (of 0 checked):
358  
359  Installed packages to be UPGRADED:
360  	test: 1 -> 1.1 [local2]
361  	test2: 1 -> 1.1 [local2]
362  
363  Number of packages to be upgraded: 2
364  ${JAILED}[1/3] Deinstalling test2-1...
365  ${JAILED}[1/3] Deleting files for test2-1:  done
366  ${JAILED}[2/3] Upgrading test from 1 to 1.1...
367  ${JAILED}[2/3] Extracting test-1.1:  done
368  ${JAILED}[3/3] Installing test2-1.1...
369  ${JAILED}[3/3] Extracting test2-1.1:  done
370  "
371  	atf_check \
372  		-o inline:"${OUTPUT}" \
373  		-s exit:0 \
374  		pkg -o CONSERVATIVE_UPGRADE=no -o REPOS_DIR="${TMPDIR}" -o PKG_CACHEDIR="${TMPDIR}" upgrade -y
375  }