author | thejaswini.k@oracle.com |
Fri, 18 Apr 2014 10:14:06 +0530 | |
branch | s11-update |
changeset 3063 | bbaaf1579de3 |
parent 3048 | 2aecfba95fe8 |
child 3282 | 250a6433eb2f |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1431
diff
changeset
|
1 |
#!/usr/bin/python |
581 | 2 |
# |
3 |
# CDDL HEADER START |
|
4 |
# |
|
5 |
# The contents of this file are subject to the terms of the |
|
6 |
# Common Development and Distribution License (the "License"). |
|
7 |
# You may not use this file except in compliance with the License. |
|
8 |
# |
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
10 |
# or http://www.opensolaris.org/os/licensing. |
|
11 |
# See the License for the specific language governing permissions |
|
12 |
# and limitations under the License. |
|
13 |
# |
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
|
19 |
# |
|
20 |
# CDDL HEADER END |
|
21 |
# |
|
22 |
||
23 |
# |
|
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
24 |
# Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. |
581 | 25 |
# |
26 |
||
27 |
import testutils |
|
28 |
if __name__ == "__main__": |
|
29 |
testutils.setup_environment("../../../proto") |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
30 |
import pkg5unittest |
581 | 31 |
|
32 |
import os |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
33 |
import pkg.catalog as catalog |
1968
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
34 |
import pkg.config as cfg |
2705
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
35 |
import pkg.client.pkgdefs as pkgdefs |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
36 |
import pkg.fmri as fmri |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
37 |
import pkg.manifest as manifest |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
38 |
import pkg.misc as misc |
2219
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
39 |
import pkg.p5p as p5p |
2705
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
40 |
import pkg.portable as portable |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
41 |
import pkg.server.repository as repo |
581 | 42 |
import shutil |
2898
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
43 |
import subprocess |
581 | 44 |
import tempfile |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
45 |
import time |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
46 |
import urllib |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
47 |
import urlparse |
581 | 48 |
import unittest |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
49 |
import zlib |
581 | 50 |
|
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
51 |
from pkg.digest import DEFAULT_HASH_FUNC |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
52 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
53 |
class TestPkgrecvMulti(pkg5unittest.ManyDepotTestCase): |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
54 |
# Cleanup after every test. |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
55 |
persistent_setup = False |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
56 |
|
1132
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
57 |
scheme10 = """ |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
58 |
open pkg:/[email protected],5.11-0 |
2808
05c6015a8c62
7195369 corrupt manifests can end up on disk when -g is used
Dan Price <daniel.price@oracle.com>
parents:
2705
diff
changeset
|
59 |
close |
1132
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
60 |
""" |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
61 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
62 |
tree10 = """ |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
63 |
open [email protected],5.11-0 |
2324
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
64 |
add depend type=require-any [email protected] [email protected] |
2808
05c6015a8c62
7195369 corrupt manifests can end up on disk when -g is used
Dan Price <daniel.price@oracle.com>
parents:
2705
diff
changeset
|
65 |
close |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
66 |
""" |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
67 |
|
2324
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
68 |
leaf10 = """ |
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
69 |
open [email protected],5.11-0 |
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
70 |
close |
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
71 |
""" |
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
72 |
|
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
73 |
branch10 = """ |
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
74 |
open [email protected],5.11-0 |
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
75 |
close |
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
76 |
""" |
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
77 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
78 |
amber10 = """ |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
79 |
open [email protected],5.11-0 |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
80 |
add depend fmri=pkg:/[email protected] type=require |
2808
05c6015a8c62
7195369 corrupt manifests can end up on disk when -g is used
Dan Price <daniel.price@oracle.com>
parents:
2705
diff
changeset
|
81 |
close |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
82 |
""" |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
83 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
84 |
amber20 = """ |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
85 |
open [email protected],5.11-0 |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
86 |
add depend fmri=pkg:/[email protected] type=require |
2808
05c6015a8c62
7195369 corrupt manifests can end up on disk when -g is used
Dan Price <daniel.price@oracle.com>
parents:
2705
diff
changeset
|
87 |
close |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
88 |
""" |
581 | 89 |
|
2898
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
90 |
amber30 = """ |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
91 |
open [email protected],5.11-0 |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
92 |
add depend fmri=pkg:/[email protected] type=require |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
93 |
close |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
94 |
""" |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
95 |
|
581 | 96 |
bronze10 = """ |
97 |
open [email protected],5.11-0 |
|
98 |
add dir mode=0755 owner=root group=bin path=/usr |
|
99 |
add dir mode=0755 owner=root group=bin path=/usr/bin |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
100 |
add file tmp/sh mode=0555 owner=root group=bin path=/usr/bin/sh |
581 | 101 |
add link path=/usr/bin/jsh target=./sh |
102 |
add hardlink path=/lib/libc.bronze target=/lib/libc.so.1 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
103 |
add file tmp/bronze1 mode=0444 owner=root group=bin path=/etc/bronze1 |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
104 |
add file tmp/bronze2 mode=0444 owner=root group=bin path=/etc/bronze2 |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
105 |
add file tmp/bronzeA1 mode=0444 owner=root group=bin path=/A/B/C/D/E/F/bronzeA1 |
581 | 106 |
add depend fmri=pkg:/[email protected] type=require |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
107 |
add license tmp/copyright2 license=copyright |
581 | 108 |
close |
109 |
""" |
|
110 |
||
111 |
bronze20 = """ |
|
112 |
open [email protected],5.11-0 |
|
113 |
add dir mode=0755 owner=root group=bin path=/etc |
|
114 |
add dir mode=0755 owner=root group=bin path=/lib |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
115 |
add file tmp/sh mode=0555 owner=root group=bin path=/usr/bin/sh |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
116 |
add file tmp/libc.so.1 mode=0555 owner=root group=bin path=/lib/libc.bronze |
581 | 117 |
add link path=/usr/bin/jsh target=./sh |
118 |
add hardlink path=/lib/libc.bronze2.0.hardlink target=/lib/libc.so.1 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
119 |
add file tmp/bronze1 mode=0444 owner=root group=bin path=/etc/bronze1 |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
120 |
add file tmp/bronze2 mode=0444 owner=root group=bin path=/etc/amber2 |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
121 |
add license tmp/copyright3 license=copyright |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
122 |
add file tmp/bronzeA2 mode=0444 owner=root group=bin path=/A1/B2/C3/D4/E5/F6/bronzeA2 |
581 | 123 |
add depend fmri=pkg:/[email protected] type=require |
2808
05c6015a8c62
7195369 corrupt manifests can end up on disk when -g is used
Dan Price <daniel.price@oracle.com>
parents:
2705
diff
changeset
|
124 |
close |
581 | 125 |
""" |
126 |
||
1895
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1736
diff
changeset
|
127 |
misc_files = [ "tmp/bronzeA1", "tmp/bronzeA2", "tmp/bronze1", |
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1736
diff
changeset
|
128 |
"tmp/bronze2", "tmp/copyright2", "tmp/copyright3", "tmp/libc.so.1", |
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1736
diff
changeset
|
129 |
"tmp/sh"] |
581 | 130 |
|
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
131 |
def setUp(self): |
581 | 132 |
""" Start two depots. |
133 |
depot 1 gets foo and moo, depot 2 gets foo and bar |
|
926
6ee411c9026a
5871 publisher apis desired
Shawn Walker <Shawn.Walker@Sun.COM>
parents:
581
diff
changeset
|
134 |
depot1 is mapped to publisher test1 (preferred) |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
135 |
depot2 is mapped to publisher test1 (alternate) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
136 |
depot3 and depot4 are scratch depots""" |
581 | 137 |
|
1895
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1736
diff
changeset
|
138 |
# This test suite needs actual depots. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
139 |
pkg5unittest.ManyDepotTestCase.setUp(self, ["test1", "test1", |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
140 |
"test2", "test2"], start_depots=True) |
581 | 141 |
|
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
142 |
self.make_misc_files(self.misc_files) |
581 | 143 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
144 |
self.dpath1 = self.dcs[1].get_repodir() |
581 | 145 |
self.durl1 = self.dcs[1].get_depot_url() |
1895
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1736
diff
changeset
|
146 |
self.published = self.pkgsend_bulk(self.durl1, (self.amber10, |
0a260cc2a689
15762 client support for filesystem-based repository access
Shawn Walker <shawn.walker@oracle.com>
parents:
1736
diff
changeset
|
147 |
self.amber20, self.bronze10, self.bronze20)) |
581 | 148 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
149 |
# Purposefully republish bronze20 a second later so a version |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
150 |
# exists that only differs in timestamp. Also publish tree |
1132
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
151 |
# and scheme after that. |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
152 |
time.sleep(1) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
153 |
self.published.extend(self.pkgsend_bulk(self.durl1, |
2705
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
154 |
(self.bronze20, self.tree10, self.branch10, self.leaf10, |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
155 |
self.scheme10))) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
156 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
157 |
self.dpath2 = self.dcs[2].get_repodir() |
581 | 158 |
self.durl2 = self.dcs[2].get_depot_url() |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
159 |
self.tempdir = tempfile.mkdtemp(dir=self.test_root) |
581 | 160 |
|
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
161 |
self.durl3 = self.dcs[3].get_depot_url() |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
162 |
self.durl4 = self.dcs[4].get_depot_url() |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
163 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
164 |
@staticmethod |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
165 |
def get_repo(uri): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
166 |
parts = urlparse.urlparse(uri, "file", allow_fragments=0) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
167 |
path = urllib.url2pathname(parts[2]) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
168 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
169 |
try: |
2028
b2c674e6ee28
16744 repository multi-publisher on-disk format should be formalized and implemented
Shawn Walker <shawn.walker@oracle.com>
parents:
1968
diff
changeset
|
170 |
return repo.Repository(root=path) |
1968
c0540b1e4f7e
8722 advanced repository metadata store needed
Shawn Walker <shawn.walker@oracle.com>
parents:
1895
diff
changeset
|
171 |
except cfg.ConfigError, e: |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
172 |
raise repo.RepositoryError(_("The specified " |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
173 |
"repository's configuration data is not " |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
174 |
"valid:\n%s") % e) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
175 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
176 |
def test_0_opts(self): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
177 |
"""Verify that various basic options work as expected and that |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
178 |
invalid options or option values return expected exit code.""" |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
179 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
180 |
# Test that bad options return expected exit code. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
181 |
self.pkgrecv(command="--newest", exit=2) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
182 |
self.pkgrecv(self.durl1, "-!", exit=2) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
183 |
self.pkgrecv(self.durl1, "-p foo", exit=2) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
184 |
self.pkgrecv(self.durl1, "-d %s [email protected]" % self.tempdir, |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
185 |
exit=1) |
2268
1f313c3e7cdf
17728 publication tools should require a repository to be specified
Shawn Walker <shawn.walker@oracle.com>
parents:
2224
diff
changeset
|
186 |
self.pkgrecv(self.durl1, "-d %s [email protected]" % |
1f313c3e7cdf
17728 publication tools should require a repository to be specified
Shawn Walker <shawn.walker@oracle.com>
parents:
2224
diff
changeset
|
187 |
self.tempdir, exit=1) |
581 | 188 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
189 |
# Test help. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
190 |
self.pkgrecv(command="-h", exit=0) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
191 |
|
2268
1f313c3e7cdf
17728 publication tools should require a repository to be specified
Shawn Walker <shawn.walker@oracle.com>
parents:
2224
diff
changeset
|
192 |
# Verify that pkgrecv requires a destination repository. |
1f313c3e7cdf
17728 publication tools should require a repository to be specified
Shawn Walker <shawn.walker@oracle.com>
parents:
2224
diff
changeset
|
193 |
self.pkgrecv(self.durl1, "'*'", exit=2) |
1f313c3e7cdf
17728 publication tools should require a repository to be specified
Shawn Walker <shawn.walker@oracle.com>
parents:
2224
diff
changeset
|
194 |
|
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
195 |
# Verify that a non-existent repository results in failure. |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
196 |
npath = os.path.join(self.test_root, "nochance") |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
197 |
self.pkgrecv(self.durl1, "-d file://%s foo" % npath, exit=1) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
198 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
199 |
# Test list newest. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
200 |
self.pkgrecv(self.durl1, "--newest") |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
201 |
output = self.reduceSpaces(self.output) |
581 | 202 |
|
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
203 |
# The latest version of amber and bronze should be listed |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
204 |
# (sans publisher prefix currently). |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
205 |
amber = self.published[1] |
2324
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
206 |
scheme = self.published[8] |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
207 |
bronze = self.published[4] |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
208 |
tree = self.published[5] |
2324
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
209 |
branch = self.published[6] |
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
210 |
leaf = self.published[7] |
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
211 |
|
75c4c6c9265b
18231 pkgrecv traceback for packages with require-any dependency when using -r
Bart Smaalders <Bart.Smaalders@Oracle.COM>
parents:
2316
diff
changeset
|
212 |
expected = "\n".join((amber, branch, bronze, leaf, scheme, tree)) + "\n" |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
213 |
self.assertEqualDiff(expected, output) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
214 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
215 |
def test_1_recv_pkgsend(self): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
216 |
"""Verify that a received package can be used by pkgsend.""" |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
217 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
218 |
f = fmri.PkgFmri(self.published[3], None) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
219 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
220 |
# First, retrieve the package. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
221 |
self.pkgrecv(self.durl1, "--raw -d %s %s" % (self.tempdir, f)) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
222 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
223 |
# Next, load the manifest. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
224 |
basedir = os.path.join(self.tempdir, f.get_dir_path()) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
225 |
mpath = os.path.join(basedir, "manifest") |
581 | 226 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
227 |
m = manifest.Manifest() |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
228 |
raw = open(mpath, "rb").read() |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
229 |
m.set_content(raw) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
230 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
231 |
# Verify that the files aren't compressed since -k wasn't used. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
232 |
# This is also the format pkgsend will expect for correct |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
233 |
# republishing. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
234 |
ofile = file(os.devnull, "rb") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
235 |
for atype in ("file", "license"): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
236 |
for a in m.gen_actions_by_type(atype): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
237 |
if not hasattr(a, "hash"): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
238 |
continue |
581 | 239 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
240 |
ifile = file(os.path.join(basedir, a.hash), |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
241 |
"rb") |
581 | 242 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
243 |
# Since the file shouldn't be compressed, this |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
244 |
# should return a zlib.error. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
245 |
self.assertRaises(zlib.error, |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
246 |
misc.gunzip_from_stream, ifile, ofile, |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
247 |
ignore_hash=True) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
248 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
249 |
# Next, send it to another depot |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
250 |
self.pkgsend(self.durl2, "open [email protected]") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
251 |
self.pkgsend(self.durl2, |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
252 |
"include -d %s %s" % (basedir, mpath)) |
581 | 253 |
self.pkgsend(self.durl2, "close") |
254 |
||
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
255 |
def test_2_recv_compare(self): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
256 |
"""Verify that a received package is identical to the |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
257 |
original source.""" |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
258 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
259 |
f = fmri.PkgFmri(self.published[4], None) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
260 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
261 |
# First, pkgrecv the pkg to a directory. The files are |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
262 |
# kept compressed so they can be compared directly to the |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
263 |
# repository's internal copy. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
264 |
self.pkgrecv(self.durl1, "--raw -k -d %s %s" % (self.tempdir, |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
265 |
f)) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
266 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
267 |
# Next, compare the manifests. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
268 |
orepo = self.get_repo(self.dpath1) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
269 |
old = orepo.manifest(f) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
270 |
new = os.path.join(self.tempdir, f.get_dir_path(), "manifest") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
271 |
|
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
272 |
self.assertEqual( |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
273 |
misc.get_data_digest(old, hash_func=DEFAULT_HASH_FUNC), |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
274 |
misc.get_data_digest(new, hash_func=DEFAULT_HASH_FUNC)) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
275 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
276 |
# Next, load the manifest. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
277 |
m = manifest.Manifest() |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
278 |
raw = open(new, "rb").read() |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
279 |
m.set_content(raw) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
280 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
281 |
# Next, compare the package actions that have data. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
282 |
for atype in ("file", "license"): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
283 |
for a in m.gen_actions_by_type(atype): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
284 |
if not hasattr(a, "hash"): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
285 |
continue |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
286 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
287 |
old = orepo.file(a.hash) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
288 |
new = os.path.join(self.tempdir, |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
289 |
f.get_dir_path(), a.hash) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
290 |
self.assertNotEqual(old, new) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
291 |
self.assertEqual(misc.get_data_digest(old, |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
292 |
hash_func=DEFAULT_HASH_FUNC), |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
293 |
misc.get_data_digest(new, |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
294 |
hash_func=DEFAULT_HASH_FUNC)) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
295 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
296 |
# Second, pkgrecv to the pkg to a file repository. |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
297 |
npath = tempfile.mkdtemp(dir=self.test_root) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
298 |
self.pkgsend("file://%s" % npath, |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
299 |
"create-repository --set-property publisher.prefix=test1") |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
300 |
self.pkgrecv(self.durl1, "-d file://%s %s" % (npath, f)) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
301 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
302 |
# Next, compare the manifests (this will also only succeed if |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
303 |
# the fmris are exactly the same including timestamp). |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
304 |
nrepo = self.get_repo(npath) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
305 |
old = orepo.manifest(f) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
306 |
new = nrepo.manifest(f) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
307 |
|
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
308 |
self.debug(old) |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
309 |
self.debug(new) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
310 |
self.assertEqual( |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
311 |
misc.get_data_digest(old, hash_func=DEFAULT_HASH_FUNC), |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
312 |
misc.get_data_digest(new, hash_func=DEFAULT_HASH_FUNC)) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
313 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
314 |
# Next, load the manifest. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
315 |
m = manifest.Manifest() |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
316 |
raw = open(new, "rb").read() |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
317 |
m.set_content(raw) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
318 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
319 |
# Next, compare the package actions that have data. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
320 |
for atype in ("file", "license"): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
321 |
for a in m.gen_actions_by_type(atype): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
322 |
if not hasattr(a, "hash"): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
323 |
continue |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
324 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
325 |
old = orepo.file(a.hash) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
326 |
new = nrepo.file(a.hash) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
327 |
self.assertNotEqual(old, new) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
328 |
self.assertEqual(misc.get_data_digest(old, |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
329 |
hash_func=DEFAULT_HASH_FUNC), |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
330 |
misc.get_data_digest(new, |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
331 |
hash_func=DEFAULT_HASH_FUNC)) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
332 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
333 |
# Third, pkgrecv to the pkg to a http repository from the |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
334 |
# file repository from the last test. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
335 |
self.pkgrecv("file://%s" % npath, "-d %s %s" % (self.durl2, f)) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
336 |
orepo = nrepo |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
337 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
338 |
# Next, compare the manifests (this will also only succeed if |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
339 |
# the fmris are exactly the same including timestamp). |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
340 |
nrepo = self.get_repo(self.dpath2) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
341 |
old = orepo.manifest(f) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
342 |
new = nrepo.manifest(f) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
343 |
|
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
344 |
self.assertEqual( |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
345 |
misc.get_data_digest(old, hash_func=DEFAULT_HASH_FUNC), |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
346 |
misc.get_data_digest(new, hash_func=DEFAULT_HASH_FUNC)) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
347 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
348 |
# Next, load the manifest. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
349 |
m = manifest.Manifest() |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
350 |
raw = open(new, "rb").read() |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
351 |
m.set_content(raw) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
352 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
353 |
# Next, compare the package actions that have data. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
354 |
for atype in ("file", "license"): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
355 |
for a in m.gen_actions_by_type(atype): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
356 |
if not hasattr(a, "hash"): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
357 |
continue |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
358 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
359 |
old = orepo.file(a.hash) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
360 |
new = nrepo.file(a.hash) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
361 |
self.assertNotEqual(old, new) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
362 |
self.assertEqual( |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
363 |
misc.get_data_digest(old, |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
364 |
hash_func=DEFAULT_HASH_FUNC), |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
365 |
misc.get_data_digest(new, |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
366 |
hash_func=DEFAULT_HASH_FUNC)) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
367 |
|
1132
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
368 |
# Fourth, create an image and verify that the sent package is |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
369 |
# seen by the client. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
370 |
self.wait_repo(self.dpath2) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
371 |
self.image_create(self.durl2, prefix="test1") |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
372 |
self.pkg("info -r [email protected]") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
373 |
|
1132
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
374 |
# Fifth, pkgrecv the pkg to a file repository and compare the |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
375 |
# manifest of a package published with the scheme (pkg:/) given. |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
376 |
f = fmri.PkgFmri(self.published[6], None) |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1522
diff
changeset
|
377 |
npath = tempfile.mkdtemp(dir=self.test_root) |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
378 |
self.pkgsend("file://%s" % npath, |
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1132
diff
changeset
|
379 |
"create-repository --set-property publisher.prefix=test1") |
1132
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
380 |
self.pkgrecv(self.durl1, "-d file://%s %s" % (npath, f)) |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
381 |
|
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
382 |
# Next, compare the manifests (this will also only succeed if |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
383 |
# the fmris are exactly the same including timestamp). |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
384 |
orepo = self.get_repo(self.dpath1) |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
385 |
nrepo = self.get_repo(npath) |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
386 |
old = orepo.manifest(f) |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
387 |
new = nrepo.manifest(f) |
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
388 |
|
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
389 |
self.assertEqual( |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
390 |
misc.get_data_digest(old, hash_func=DEFAULT_HASH_FUNC), |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
391 |
misc.get_data_digest(new, hash_func=DEFAULT_HASH_FUNC)) |
1132
1abf9cf8f69c
9206 pkgrecv'd packages may not have matching comment in manifest
Shawn Walker <srw@sun.com>
parents:
1118
diff
changeset
|
392 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
393 |
def test_3_recursive(self): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
394 |
"""Verify that retrieving a package recursively will retrieve |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
395 |
its dependencies as well.""" |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
396 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
397 |
bronze = fmri.PkgFmri(self.published[4], None) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
398 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
399 |
# Retrieve bronze recursively to a directory, this should |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
400 |
# also retrieve its dependency: amber, and amber's dependency: |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
401 |
# tree. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
402 |
self.pkgrecv(self.durl1, "--raw -r -k -d %s %s" % (self.tempdir, |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
403 |
bronze)) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
404 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
405 |
amber = fmri.PkgFmri(self.published[1], None) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
406 |
tree = fmri.PkgFmri(self.published[5], None) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
407 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
408 |
# Verify that the manifests for each package was retrieved. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
409 |
for f in (amber, bronze, tree): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
410 |
mpath = os.path.join(self.tempdir, f.get_dir_path(), |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
411 |
"manifest") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
412 |
self.assertTrue(os.path.isfile(mpath)) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
413 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
414 |
def test_4_timever(self): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
415 |
"""Verify that receiving with -m options work as expected.""" |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
416 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
417 |
bronze10 = fmri.PkgFmri(self.published[2], None) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
418 |
bronze20_1 = fmri.PkgFmri(self.published[3], None) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
419 |
bronze20_2 = fmri.PkgFmri(self.published[4], None) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
420 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
421 |
# Retrieve bronze using -m all-timestamps and a version pattern. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
422 |
# This should only retrieve bronze20_1 and bronze20_2. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
423 |
self.pkgrecv(self.durl1, "--raw -m all-timestamps -r -k " |
2224
dba01788128c
17824 api install and update should allow specifying "latest" version of packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2219
diff
changeset
|
424 |
"-d %s %s" % (self.tempdir, "/[email protected]")) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
425 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
426 |
# Verify that only expected packages were retrieved. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
427 |
expected = [ |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
428 |
bronze20_1.get_dir_path(), |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
429 |
bronze20_2.get_dir_path(), |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
430 |
] |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
431 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
432 |
for d in os.listdir(os.path.join(self.tempdir, "bronze")): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
433 |
self.assertTrue(os.path.join("bronze", d) in expected) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
434 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
435 |
mpath = os.path.join(self.tempdir, "bronze", d, |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
436 |
"manifest") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
437 |
self.assertTrue(os.path.isfile(mpath)) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
438 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
439 |
# Cleanup for next test. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
440 |
shutil.rmtree(os.path.join(self.tempdir, "bronze")) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
441 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
442 |
# Retrieve bronze using -m all-timestamps and a package stem. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
443 |
# This should retrieve bronze10, bronze20_1, and bronze20_2. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
444 |
self.pkgrecv(self.durl1, "--raw -m all-timestamps -r -k " |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
445 |
"-d %s %s" % (self.tempdir, "bronze")) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
446 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
447 |
# Verify that only expected packages were retrieved. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
448 |
expected = [ |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
449 |
bronze10.get_dir_path(), |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
450 |
bronze20_1.get_dir_path(), |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
451 |
bronze20_2.get_dir_path(), |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
452 |
] |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
453 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
454 |
for d in os.listdir(os.path.join(self.tempdir, "bronze")): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
455 |
self.assertTrue(os.path.join("bronze", d) in expected) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
456 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
457 |
mpath = os.path.join(self.tempdir, "bronze", d, |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
458 |
"manifest") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
459 |
self.assertTrue(os.path.isfile(mpath)) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
460 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
461 |
# Cleanup for next test. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
462 |
shutil.rmtree(os.path.join(self.tempdir, "bronze")) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
463 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
464 |
# Retrieve bronze using -m all-versions, this should only |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
465 |
# retrieve bronze10 and bronze20_2. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
466 |
self.pkgrecv(self.durl1, "--raw -m all-versions -r -k " |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
467 |
"-d %s %s" % (self.tempdir, "bronze")) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
468 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
469 |
# Verify that only expected packages were retrieved. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
470 |
expected = [ |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
471 |
bronze10.get_dir_path(), |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
472 |
bronze20_2.get_dir_path(), |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
473 |
] |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
474 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
475 |
for d in os.listdir(os.path.join(self.tempdir, "bronze")): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
476 |
self.assertTrue(os.path.join("bronze", d) in expected) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
477 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
478 |
mpath = os.path.join(self.tempdir, "bronze", d, |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
479 |
"manifest") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
480 |
self.assertTrue(os.path.isfile(mpath)) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
481 |
|
2871
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
482 |
# Cleanup for next test. |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
483 |
shutil.rmtree(os.path.join(self.tempdir, "bronze")) |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
484 |
|
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
485 |
# Retrieve bronze using -m latest, this should only |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
486 |
# retrieve bronze20_2. |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
487 |
self.pkgrecv(self.durl1, "--raw -m latest -r -k " |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
488 |
"-d %s %s" % (self.tempdir, "bronze")) |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
489 |
|
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
490 |
# Verify that only expected packages were retrieved. |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
491 |
expected = [ |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
492 |
bronze20_2.get_dir_path(), |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
493 |
] |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
494 |
|
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
495 |
for d in os.listdir(os.path.join(self.tempdir, "bronze")): |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
496 |
self.assertTrue(os.path.join("bronze", d) in expected) |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
497 |
|
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
498 |
mpath = os.path.join(self.tempdir, "bronze", d, |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
499 |
"manifest") |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
500 |
self.assertTrue(os.path.isfile(mpath)) |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
501 |
|
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
502 |
# Cleanup for next test. |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
503 |
shutil.rmtree(os.path.join(self.tempdir, "bronze")) |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
504 |
|
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
505 |
# Retrieve bronze using default setting. |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
506 |
# This should retrieve bronze10, bronze20_1, and bronze20_2. |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
507 |
self.pkgrecv(self.durl1, "--raw -r -k " |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
508 |
"-d %s %s" % (self.tempdir, "bronze")) |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
509 |
|
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
510 |
# Verify that all expected packages were retrieved. |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
511 |
expected = [ |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
512 |
bronze10.get_dir_path(), |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
513 |
bronze20_1.get_dir_path(), |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
514 |
bronze20_2.get_dir_path(), |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
515 |
] |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
516 |
|
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
517 |
for d in expected: |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
518 |
paths = os.listdir(os.path.join(self.tempdir, "bronze")) |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
519 |
self.assertTrue(os.path.basename(d) in paths) |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
520 |
|
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
521 |
mpath = os.path.join(self.tempdir, d, "manifest") |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
522 |
self.assertTrue(os.path.isfile(mpath)) |
5132092a4436
14851733 pkgrecv should default to retreving all-timestamps not just latest versions
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2864
diff
changeset
|
523 |
|
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
524 |
def test_5_recv_env(self): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
525 |
"""Verify that pkgrecv environment vars work as expected.""" |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
526 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
527 |
f = fmri.PkgFmri(self.published[3], None) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
528 |
|
1522
4f1662ab3e66
12873 test case TestPkgrecvMulti.test_5_recv_env broken
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
529 |
os.environ["PKG_SRC"] = self.durl1 |
4f1662ab3e66
12873 test case TestPkgrecvMulti.test_5_recv_env broken
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
530 |
os.environ["PKG_DEST"] = self.tempdir |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
531 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
532 |
# First, retrieve the package. |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
533 |
self.pkgrecv(command="--raw %s" % f) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
534 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
535 |
# Next, load the manifest. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
536 |
basedir = os.path.join(self.tempdir, f.get_dir_path()) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
537 |
mpath = os.path.join(basedir, "manifest") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
538 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
539 |
m = manifest.Manifest() |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
540 |
raw = open(mpath, "rb").read() |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
541 |
m.set_content(raw) |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
542 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
543 |
# This is also the format pkgsend will expect for correct |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
544 |
# republishing. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
545 |
ofile = file(os.devnull, "rb") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
546 |
for atype in ("file", "license"): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
547 |
for a in m.gen_actions_by_type(atype): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
548 |
if not hasattr(a, "hash"): |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
549 |
continue |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
550 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
551 |
ifile = file(os.path.join(basedir, a.hash), |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
552 |
"rb") |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
553 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
554 |
# Since the file shouldn't be compressed, this |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
555 |
# should return a zlib.error. |
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
556 |
self.assertRaises(zlib.error, |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
557 |
misc.gunzip_from_stream, ifile, ofile, |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
558 |
ignore_hash=True) |
1118
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
559 |
|
f2dd69165173
6342 pkgrecv should support local disk repository
Shawn Walker <srw@sun.com>
parents:
926
diff
changeset
|
560 |
for var in ("PKG_SRC", "PKG_DEST"): |
1522
4f1662ab3e66
12873 test case TestPkgrecvMulti.test_5_recv_env broken
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
561 |
del os.environ[var] |
581 | 562 |
|
2057
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
563 |
def test_6_recv_republish_preexisting(self): |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
564 |
f = fmri.PkgFmri(self.published[5], None) |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
565 |
f2 = fmri.PkgFmri(self.published[4], None) |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
566 |
|
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
567 |
# First, pkgrecv tree into a file repository |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
568 |
npath = tempfile.mkdtemp(dir=self.test_root) |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
569 |
self.pkgsend("file://%s" % npath, |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
570 |
"create-repository --set-property publisher.prefix=test1") |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
571 |
self.pkgrecv(self.durl1, "-d file://%s %s" % (npath, f)) |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
572 |
|
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
573 |
# Next, recursively pkgrecv bronze2.0 into a file repository |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
574 |
# This would fail before behavior fixed to skip existing pkgs. |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
575 |
self.pkgrecv(self.durl1, "-r -d file://%s %s" % (npath, f2)) |
874a83b3e8d1
10390 make pkgrecv gracefully handle existing packages in destination
johansen <johansen@opensolaris.org>
parents:
2028
diff
changeset
|
576 |
|
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
577 |
def test_7_recv_multipublisher(self): |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
578 |
"""Verify that pkgrecv handles multi-publisher repositories as |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
579 |
expected.""" |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
580 |
|
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
581 |
# Setup a repository with packages from multiple publishers. |
2224
dba01788128c
17824 api install and update should allow specifying "latest" version of packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2219
diff
changeset
|
582 |
amber = self.amber10.replace("open ", "open //test2/") |
2115
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
583 |
self.pkgsend_bulk(self.durl3, amber) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
584 |
self.pkgrecv(self.durl1, "-d %s [email protected] [email protected]" % |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
585 |
self.durl3) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
586 |
|
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
587 |
# Now attempt to receive from a repository with packages from |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
588 |
# multiple publishers and verify entry exists only for test1. |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
589 |
self.pkgrecv(self.durl3, "-d %s bronze" % self.durl4) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
590 |
self.pkgrecv(self.durl3, "--newest") |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
591 |
self.assertNotEqual(self.output.find("test1/bronze"), -1) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
592 |
self.assertEqual(self.output.find("test2/bronze"), -1) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
593 |
|
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
594 |
# Now retrieve amber, and verify entries exist for both pubs. |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
595 |
self.wait_repo(self.dcs[4].get_repodir()) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
596 |
self.wait_repo(self.dcs[3].get_repodir()) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
597 |
self.pkgrecv(self.durl3, "-d %s amber" % self.durl4) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
598 |
self.pkgrecv(self.durl4, "--newest") |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
599 |
self.assertNotEqual(self.output.find("test1/amber"), -1) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
600 |
self.assertNotEqual(self.output.find("test2/amber"), -1) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
601 |
|
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
602 |
# Verify attempting to retrieve a non-existent package fails |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
603 |
# for a multi-publisher repository. |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
604 |
self.pkgrecv(self.durl3, "-d %s nosuchpackage" % self.durl4, |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
605 |
exit=1) |
c6a812ab117a
16818 pkgrecv -d should publish per-package, not in one lump
Shawn Walker <shawn.walker@oracle.com>
parents:
2057
diff
changeset
|
606 |
|
2219
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
607 |
def test_8_archive(self): |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
608 |
"""Verify that pkgrecv handles package archives as expected.""" |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
609 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
610 |
# Setup a repository with packages from multiple publishers. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
611 |
amber = self.amber10.replace("open ", "open pkg://test2/") |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
612 |
t2_amber10 = self.pkgsend_bulk(self.durl3, amber)[0] |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
613 |
self.pkgrecv(self.durl1, "-d %s [email protected] [email protected]" % |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
614 |
self.durl3) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
615 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
616 |
# Now attempt to receive from a repository to a package archive. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
617 |
arc_path = os.path.join(self.test_root, "test.p5p") |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
618 |
self.pkgrecv(self.durl3, "-a -d %s \*" % arc_path) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
619 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
620 |
# |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
621 |
# Verify that the archive can be opened and the expected |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
622 |
# packages are inside. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
623 |
# |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
624 |
amber10 = self.published[0] |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
625 |
bronze10 = self.published[2] |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
626 |
arc = p5p.Archive(arc_path, mode="r") |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
627 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
628 |
# Check for expected publishers. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
629 |
expected = set(["test1", "test2"]) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
630 |
pubs = set(p.prefix for p in arc.get_publishers()) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
631 |
self.assertEqualDiff(expected, pubs) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
632 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
633 |
# Check for expected package FMRIs. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
634 |
expected = set([amber10, t2_amber10, bronze10]) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
635 |
tmpdir = tempfile.mkdtemp(dir=self.test_root) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
636 |
returned = [] |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
637 |
for pfx in pubs: |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
638 |
catdir = os.path.join(tmpdir, pfx) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
639 |
os.mkdir(catdir) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
640 |
for part in ("catalog.attrs", "catalog.base.C"): |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
641 |
arc.extract_catalog1(part, catdir, pfx) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
642 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
643 |
cat = catalog.Catalog(meta_root=catdir, read_only=True) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
644 |
returned.extend(str(f) for f in cat.fmris()) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
645 |
self.assertEqualDiff(expected, set(returned)) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
646 |
arc.close() |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
647 |
shutil.rmtree(tmpdir) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
648 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
649 |
# |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
650 |
# Verify that packages can be received from an archive to an |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
651 |
# archive. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
652 |
# |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
653 |
arc2_path = os.path.join(self.test_root, "test2.p5p") |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
654 |
self.pkgrecv(arc_path, "-a -d %s pkg://test2/amber" % arc2_path) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
655 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
656 |
# Check for expected publishers. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
657 |
arc = p5p.Archive(arc2_path, mode="r") |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
658 |
expected = set(["test2"]) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
659 |
pubs = set(p.prefix for p in arc.get_publishers()) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
660 |
self.assertEqualDiff(expected, pubs) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
661 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
662 |
# Check for expected package FMRIs. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
663 |
expected = set([t2_amber10]) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
664 |
tmpdir = tempfile.mkdtemp(dir=self.test_root) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
665 |
returned = [] |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
666 |
for pfx in pubs: |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
667 |
catdir = os.path.join(tmpdir, pfx) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
668 |
os.mkdir(catdir) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
669 |
for part in ("catalog.attrs", "catalog.base.C"): |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
670 |
arc.extract_catalog1(part, catdir, pfx) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
671 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
672 |
cat = catalog.Catalog(meta_root=catdir, read_only=True) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
673 |
returned.extend(str(f) for f in cat.fmris()) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
674 |
self.assertEqualDiff(expected, set(returned)) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
675 |
arc.close() |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
676 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
677 |
# |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
678 |
# Verify that pkgrecv gracefully fails if archive already |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
679 |
# exists. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
680 |
# |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
681 |
self.pkgrecv(arc_path, "-d %s \*" % arc2_path, exit=1) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
682 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
683 |
# |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
684 |
# Verify that packages can be received from an archive to |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
685 |
# a repository. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
686 |
# |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
687 |
self.pkgrecv(arc_path, "--newest") |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
688 |
self.pkgrecv(arc_path, "-d %s pkg://test2/amber bronze" % |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
689 |
self.durl4) |
2316
9eb53e68d674
17741 pkgrecv should allow wildcards in package versions
Shawn Walker <shawn.walker@oracle.com>
parents:
2268
diff
changeset
|
690 |
self.wait_repo(self.dcs[4].get_repodir()) |
2219
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
691 |
repo = self.dcs[4].get_repo() |
2224
dba01788128c
17824 api install and update should allow specifying "latest" version of packages
Shawn Walker <shawn.walker@oracle.com>
parents:
2219
diff
changeset
|
692 |
self.pkgrecv(repo.root, "--newest") |
2219
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
693 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
694 |
# Check for expected publishers. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
695 |
expected = set(["test1", "test2"]) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
696 |
pubs = repo.publishers |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
697 |
self.assertEqualDiff(expected, pubs) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
698 |
|
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
699 |
# Check for expected package FMRIs. |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
700 |
expected = sorted([t2_amber10, bronze10]) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
701 |
returned = [] |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
702 |
for pfx in repo.publishers: |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
703 |
cat = repo.get_catalog(pub=pfx) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
704 |
returned.extend(str(f) for f in cat.fmris()) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
705 |
self.assertEqualDiff(expected, sorted(returned)) |
60ad60f7592c
2152 standalone package support needed (on-disk format)
Shawn Walker <shawn.walker@oracle.com>
parents:
2115
diff
changeset
|
706 |
|
2634
da6a36c6c9bd
7144038 pkgrecv -a creates archives even when -n is specified
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2324
diff
changeset
|
707 |
# Attempt a dry-run to receive a package archive. |
da6a36c6c9bd
7144038 pkgrecv -a creates archives even when -n is specified
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2324
diff
changeset
|
708 |
# We should not have the archive created in this case. |
da6a36c6c9bd
7144038 pkgrecv -a creates archives even when -n is specified
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2324
diff
changeset
|
709 |
arc_path = os.path.join(self.test_root, "dry-run.p5p") |
da6a36c6c9bd
7144038 pkgrecv -a creates archives even when -n is specified
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2324
diff
changeset
|
710 |
self.pkgrecv(self.durl3, "-n -a -d %s \*" % arc_path) |
da6a36c6c9bd
7144038 pkgrecv -a creates archives even when -n is specified
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2324
diff
changeset
|
711 |
self.assertFalse(os.path.exists(arc_path)) |
da6a36c6c9bd
7144038 pkgrecv -a creates archives even when -n is specified
Saurabh Vyas <saurabh.vyas@oracle.com>
parents:
2324
diff
changeset
|
712 |
|
2671
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
713 |
def test_9_dryruns(self): |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
714 |
"""Test that the dry run option to pkgrecv works as expected.""" |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
715 |
|
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
716 |
f = fmri.PkgFmri(self.published[3], None) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
717 |
|
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
718 |
rpth = tempfile.mkdtemp(dir=self.test_root) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
719 |
self.pkgrepo("create %s" % rpth) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
720 |
expected = ["pkg5.repository"] |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
721 |
self.pkgrecv(self.durl1, "-n -d %s %s" % (rpth, f)) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
722 |
self.assertEqualDiff(expected, os.listdir(rpth)) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
723 |
|
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
724 |
self.pkgrecv(self.durl1, "-r -n -d %s %s" % (rpth, f)) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
725 |
self.assertEqualDiff(expected, os.listdir(rpth)) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
726 |
|
2898
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
727 |
self.pkgrecv(self.durl1, "--clone -n -p '*' -d %s" % (rpth)) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
728 |
self.assertEqualDiff(expected, os.listdir(rpth)) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
729 |
|
2671
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
730 |
arc_path = os.path.join(self.test_root, "test.p5p") |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
731 |
self.pkgrecv(self.durl1, "-a -n -d %s \*" % arc_path) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
732 |
self.assert_(not os.path.exists(arc_path)) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
733 |
|
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
734 |
# --raw actually populates the destination with manifests even |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
735 |
# with -n, so just check that it exits 0. |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
736 |
self.pkgrecv(self.durl1, "--raw -n -d %s %s" % |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
737 |
(self.tempdir, f)) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
738 |
|
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
739 |
# --raw actually populates the destination with manifests even |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
740 |
# with -n, so just check that it exits 0. |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
741 |
self.pkgrecv(self.durl1, "--raw -r -n -d %s %s" % |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
742 |
(self.tempdir, f)) |
20a5c9aa2e6d
7160289 pkgrecv failing to pull build s11u1_13: pkgrecv: 'add_file' failed.
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2634
diff
changeset
|
743 |
|
2705
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
744 |
def test_10_unsupported_actions(self): |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
745 |
"""Test that pkgrecv skips packages with actions it can't |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
746 |
understand, processes those it can, and exits with appropriate |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
747 |
exit codes.""" |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
748 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
749 |
def __count_pulled_packages(pth): |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
750 |
self.pkgrepo("list -F tsv -H -s %s" % pth) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
751 |
return len(self.output.splitlines()) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
752 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
753 |
def __check_errout(pfmri): |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
754 |
s1 = "invalid action in package %s" % pfmri |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
755 |
s2 = "Malformed action in package '%s'" % pfmri |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
756 |
self.assert_(s1 in self.errout or s2 in self.errout, |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
757 |
"%s not in error" % pfmri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
758 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
759 |
def __empty_repo(uri, arg_string): |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
760 |
if uri.startswith("http://"): |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
761 |
rurl = self.dcs[4].get_repo_url() |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
762 |
self.pkgrepo("remove -s %s '*'" % rurl) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
763 |
# Refresh the depot to get it to realize that |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
764 |
# the catalog has changed. |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
765 |
self.dcs[4].refresh() |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
766 |
elif arg_string: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
767 |
portable.remove(uri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
768 |
else: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
769 |
self.pkgrepo("remove -s %s '*'" % uri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
770 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
771 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
772 |
def __test_rec(duri, arg_string, pfmris): |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
773 |
self.debug("\n\nNow pkgrecv'ing to %s" % duri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
774 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
775 |
# It's necessary to use the -D option below because |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
776 |
# otherwise pkgrecv will fail because the manifest |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
777 |
# doesn't validate. |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
778 |
|
2808
05c6015a8c62
7195369 corrupt manifests can end up on disk when -g is used
Dan Price <daniel.price@oracle.com>
parents:
2705
diff
changeset
|
779 |
novalidate = "-D manifest_validate=Never " |
2705
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
780 |
# Check that invalid action attributes don't cause |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
781 |
# tracebacks. |
2808
05c6015a8c62
7195369 corrupt manifests can end up on disk when -g is used
Dan Price <daniel.price@oracle.com>
parents:
2705
diff
changeset
|
782 |
self.pkgrecv(self.durl1, novalidate + |
2705
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
783 |
"-d %s %s %s" % (duri, arg_string, |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
784 |
" ".join(pfmris)), exit=pkgdefs.EXIT_OOPS) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
785 |
for pfmri in pfmris: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
786 |
__check_errout(pfmri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
787 |
self.assertEqual(__count_pulled_packages(duri), 0) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
788 |
if arg_string: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
789 |
portable.remove(duri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
790 |
|
2808
05c6015a8c62
7195369 corrupt manifests can end up on disk when -g is used
Dan Price <daniel.price@oracle.com>
parents:
2705
diff
changeset
|
791 |
self.pkgrecv(self.rurl1, novalidate + |
2705
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
792 |
"-d %s %s %s" % (duri, arg_string, |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
793 |
" ".join(pfmris)), exit=pkgdefs.EXIT_OOPS) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
794 |
for pfmri in pfmris: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
795 |
__check_errout(pfmri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
796 |
self.assertEqual(__count_pulled_packages(duri), 0) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
797 |
if arg_string: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
798 |
portable.remove(duri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
799 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
800 |
# Check that other packages are retrieved and the exit |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
801 |
# code reflects partial success. |
2808
05c6015a8c62
7195369 corrupt manifests can end up on disk when -g is used
Dan Price <daniel.price@oracle.com>
parents:
2705
diff
changeset
|
802 |
self.pkgrecv(self.durl1, novalidate + |
2705
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
803 |
"-d %s %s -m all-timestamps '*'" % |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
804 |
(duri, arg_string), exit=pkgdefs.EXIT_PARTIAL) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
805 |
for pfmri in pfmris: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
806 |
__check_errout(pfmri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
807 |
self.assertEqual(__count_pulled_packages(duri), |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
808 |
len(self.published) - len(pfmris)) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
809 |
__empty_repo(duri, arg_string) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
810 |
|
2808
05c6015a8c62
7195369 corrupt manifests can end up on disk when -g is used
Dan Price <daniel.price@oracle.com>
parents:
2705
diff
changeset
|
811 |
self.pkgrecv(self.rurl1, novalidate + |
2705
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
812 |
"-d %s %s -m all-timestamps '*'" % |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
813 |
(duri, arg_string), exit=pkgdefs.EXIT_PARTIAL) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
814 |
for pfmri in pfmris: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
815 |
__check_errout(pfmri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
816 |
self.assertEqual(__count_pulled_packages(duri), |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
817 |
len(self.published) - len(pfmris)) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
818 |
__empty_repo(duri, arg_string) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
819 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
820 |
self.rurl1 = self.dcs[1].get_repo_url() |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
821 |
repo = self.dcs[1].get_repo() |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
822 |
rd = repo.get_pub_rstore() |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
823 |
pfmri = fmri.PkgFmri(self.published[4]) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
824 |
mp = rd.manifest(pfmri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
825 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
826 |
with open(mp, "rb") as fh: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
827 |
original_txt = fh.read() |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
828 |
txt = original_txt.replace("type=require", "type=foo") |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
829 |
with open(mp, "wb") as fh: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
830 |
fh.write(txt) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
831 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
832 |
rpth = tempfile.mkdtemp(dir=self.test_root) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
833 |
self.pkgrepo("create %s" % rpth) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
834 |
adir = tempfile.mkdtemp(dir=self.test_root) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
835 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
836 |
# The __empty repo function above assumes that the only http uri |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
837 |
# used is the one for depot number 4. |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
838 |
dest_uris = ((rpth, ""), (self.durl4, ""), |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
839 |
(os.path.join(adir, "archive.p5p"), "-a")) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
840 |
for duri, arg_string in dest_uris: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
841 |
__test_rec(duri, arg_string, [self.published[4]]) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
842 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
843 |
# Test that multiple packages failing are handled correctly. |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
844 |
for i in range(5, 7): |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
845 |
pfmri = fmri.PkgFmri(self.published[i]) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
846 |
mp = rd.manifest(pfmri) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
847 |
with open(mp, "rb") as fh: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
848 |
original_txt = fh.read() |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
849 |
txt = "foop\n" + original_txt |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
850 |
with open(mp, "wb") as fh: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
851 |
fh.write(txt) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
852 |
|
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
853 |
for duri, arg_string, in dest_uris: |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
854 |
__test_rec(duri, arg_string, self.published[4:7]) |
346bf63a998c
7140241 pkgrecv should gracefully ignore unsupported packages
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2671
diff
changeset
|
855 |
|
2898
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
856 |
def test_11_clone(self): |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
857 |
"""Verify that pkgrecv handles cloning repos as expected.""" |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
858 |
# Test basic operation of cloning repo which contains one |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
859 |
# publisher to repo which contains same publisher |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
860 |
self.pkgrecv(self.durl1, "--clone -d %s" % self.dpath2) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
861 |
|
2898
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
862 |
ret = subprocess.call(["/usr/bin/gdiff", "-Naur", "-x", |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
863 |
"index", "-x", "trans", self.dpath1, self.dpath2]) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
864 |
self.assertTrue(ret==0) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
865 |
|
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
866 |
# Test that packages in dst which are not in src get removed. |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
867 |
self.pkgsend_bulk(self.durl2, (self.amber30)) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
868 |
self.pkgrecv(self.durl1, "--clone -d %s" % self.dpath2) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
869 |
ret = subprocess.call(["/usr/bin/gdiff", "-Naur", "-x", |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
870 |
"index", "-x", "trans", self.dpath1, self.dpath2]) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
871 |
self.assertTrue(ret==0) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
872 |
|
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
873 |
# Test that clone reports publishers not in the dest repo. |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
874 |
amber = self.amber10.replace("open ", "open pkg://test2/") |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
875 |
self.pkgsend_bulk(self.durl1, amber) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
876 |
self.pkgrecv(self.durl1, "--clone -d %s" % self.dpath2, exit=1) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
877 |
|
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
878 |
# Test that clone adds new publishers if requested. |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
879 |
# Note: adding a publisher will automatically create a pub.p5i |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
880 |
# in the repo store. Since that is repo configuration and not |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
881 |
# part of the cloning it is ignored. |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
882 |
amber = self.amber10.replace("open ", "open pkg://test2/") |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
883 |
self.pkgsend_bulk(self.durl1, amber) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
884 |
self.pkgrecv(self.durl1, "--clone -d %s -p test2" % self.dpath2) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
885 |
ret = subprocess.call(["/usr/bin/gdiff", "-Naur", "-x", |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
886 |
"index", "-x", "trans", "-x", "pub.p5i", self.dpath1, |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
887 |
self.dpath2]) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
888 |
self.assertTrue(ret==0) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
889 |
|
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
890 |
# Test that clone removes all packages if source is empty |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
891 |
self.pkgrecv(self.durl3, "--clone -d %s" % self.dpath2) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
892 |
self.pkgrepo("-s %s list -H -p test2" % self.dpath2) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
893 |
self.assertEqualDiff("", self.output) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
894 |
|
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
895 |
# Test that clone fails if --raw is specified. |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
896 |
self.pkgrecv(self.durl1, "--raw --clone -d %s -p test2" % |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
897 |
self.dpath2, exit=2) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
898 |
|
2898
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
899 |
# Test that clone fails if -c is specified. |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
900 |
self.pkgrecv(self.durl1, "-c /tmp/ --clone -d %s -p test2" % |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
901 |
self.dpath2, exit=2) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
902 |
|
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
903 |
# Test that clone fails if -a is specified. |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
904 |
self.pkgrecv(self.durl1, "-a --clone -d %s -p test2" % |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
905 |
self.dpath2, exit=2) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
906 |
|
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
907 |
# Test that clone fails if --newest is specified. |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
908 |
self.pkgrecv(self.durl1, "--newest --clone -d %s -p test2" % |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
909 |
self.dpath2, exit=2) |
723ece284e97
16595528 pkgrecv should have a clone mode to exactly replicate repositories
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2871
diff
changeset
|
910 |
|
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
911 |
def test_12_multihash(self): |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
912 |
"""Tests that we can recv to and from repositories with |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
913 |
multi-hash support, interoperating with repositories without |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
914 |
multi-hash support.""" |
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
915 |
self.base_12_multihash("sha256") |
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
916 |
self.base_12_multihash("sha512_256") |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
917 |
|
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
918 |
def base_12_multihash(self, hash_alg): |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
919 |
f = fmri.PkgFmri(self.published[3], None) |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
920 |
# We create an image simply so we can use "contents -g" to |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
921 |
# inspect the repository. |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
922 |
self.image_create() |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
923 |
|
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
924 |
# First, recv the package and verify it has no extended hashes |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
925 |
self.pkgrecv(self.durl1, "-d %s %s" % (self.durl3, f)) |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
926 |
self.pkg("contents -g %s -m %s" % (self.durl3, f)) |
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
927 |
self.assert_("pkg.hash.%s" % hash_alg not in self.output) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
928 |
|
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
929 |
# Now stop and start the repository as multi-hash aware, and |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
930 |
# recv it again, making sure that we do not get multiple hashes |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
931 |
# added (because modifying the manifest would break signatures) |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
932 |
self.dcs[3].stop() |
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
933 |
self.dcs[3].set_debug_feature("hash=sha1+%s" % hash_alg) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
934 |
self.dcs[3].start() |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
935 |
self.pkgrecv(self.durl1, "-d %s %s" % (self.durl3, f)) |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
936 |
self.pkg("contents -g %s -m %s" % (self.durl3, f)) |
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
937 |
self.assert_("pkg.hash.%s" % hash_alg not in self.output) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
938 |
|
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
939 |
# Now check the reverse - that a package with multiple hashes |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
940 |
# can be received into a repository that is not multi-hash aware |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
941 |
b = "[email protected],5.11-0" |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
942 |
self.pkgsend_bulk(self.durl3, self.bronze10) |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
943 |
self.pkg("contents -g %s -m %s" % (self.durl3, b)) |
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
944 |
self.assert_("pkg.hash.%s" % hash_alg in self.output) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
945 |
self.pkgrecv(self.durl3, "-d %s %s" % (self.durl4, b)) |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
946 |
self.pkg("contents -g %s -m %s" % (self.durl4, b)) |
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
947 |
self.assert_("pkg.hash.%s" % hash_alg in self.output) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
948 |
|
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
949 |
# Ensure that we can recv multi-hash packages into p5p files |
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
950 |
p5p_path = os.path.join(self.test_root, |
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
951 |
"multi-hash-%s.p5p" % hash_alg) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
952 |
self.pkgrecv(self.durl3, "-ad %s %s" % (p5p_path, b)) |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
953 |
self.pkg("contents -g %s -m %s" % (p5p_path, b)) |
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
954 |
self.assert_("pkg.hash.%s" % hash_alg in self.output) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
955 |
|
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
956 |
# Finally, stop and start our scratch repository to clear the |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
957 |
# debug feature. If this doesn't happen because we've failed |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
958 |
# before now, it's not the end of the world. |
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
959 |
self.dcs[3].stop() |
3063
bbaaf1579de3
15744850 no actuators are run when pkg manipulates a booted NGZ image from the GZ
thejaswini.k@oracle.com
parents:
3048
diff
changeset
|
960 |
self.dcs[3].unset_debug_feature("hash=sha1+%s" % hash_alg) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
961 |
self.dcs[3].start() |
581 | 962 |
|
3048
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
963 |
def test_13_output(self): |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
964 |
"""Verify that pkgrecv handles verbose output as expected.""" |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
965 |
|
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
966 |
# Now attempt to receive from a repository. |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
967 |
self.pkgrepo("create %s" % self.tempdir) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
968 |
self.pkgrecv(self.dpath1, "-d %s -n -v \*" % self.tempdir) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
969 |
expected = """\ |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
970 |
Retrieving packages (dry-run) ... |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
971 |
Packages to add: 9 |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
972 |
Files to retrieve: 17 |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
973 |
Estimated transfer size: 528.00 B |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
974 |
""" |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
975 |
self.assert_(expected in self.output, self.output) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
976 |
for s in self.published: |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
977 |
self.assert_(fmri.PkgFmri(s).get_fmri(anarchy=True, |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
978 |
include_scheme=False) in self.output) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
979 |
|
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
980 |
# Clean up for next test. |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
981 |
shutil.rmtree(self.tempdir) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
982 |
|
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
983 |
# Now attempt to receive from a repository to a package archive. |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
984 |
self.pkgrecv(self.dpath1, "-a -d %s -n -v \*" % self.tempdir) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
985 |
expected = """\ |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
986 |
Archiving packages (dry-run) ... |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
987 |
Packages to add: 9 |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
988 |
Files to retrieve: 17 |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
989 |
Estimated transfer size: 528.00 B |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
990 |
""" |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
991 |
self.assert_(expected in self.output, self.output) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
992 |
for s in self.published: |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
993 |
self.assert_(fmri.PkgFmri(s).get_fmri(anarchy=True, |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
994 |
include_scheme=False) in self.output) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
995 |
|
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
996 |
# Now attempt to clone a repository. |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
997 |
self.pkgrepo("create %s" % self.tempdir) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
998 |
self.pkgrecv(self.dpath1, "--clone -d %s -p \* -n -v \*" \ |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
999 |
% self.tempdir) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1000 |
expected = """\ |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1001 |
Retrieving packages (dry-run) ... |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1002 |
Packages to add: 9 |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1003 |
Files to retrieve: 17 |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1004 |
Estimated transfer size: 528.00 B |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1005 |
""" |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1006 |
self.assert_(expected in self.output, self.output) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1007 |
for s in self.published: |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1008 |
self.assert_(fmri.PkgFmri(s).get_fmri(anarchy=True, |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1009 |
include_scheme=False) in self.output) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1010 |
|
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1011 |
# Test that output is correct if -n is not specified. |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1012 |
self.pkgrecv(self.dpath1, "-d %s -v \*" % self.tempdir) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1013 |
self.assert_("dry-run" not in self.output) |
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1014 |
|
2aecfba95fe8
16986557 prefixes should be omitted from output of facet and variant
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
1015 |
|
2864
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1016 |
class TestPkgrecvHTTPS(pkg5unittest.HTTPSTestClass): |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1017 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1018 |
example_pkg10 = """ |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1019 |
open [email protected],5.11-0 |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1020 |
add file tmp/example_file mode=0555 owner=root group=bin path=/usr/bin/example_path |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1021 |
close""" |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1022 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1023 |
misc_files = ["tmp/example_file", "tmp/empty", "tmp/verboten"] |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1024 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1025 |
def setUp(self): |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1026 |
pubs = ["src", "dst"] |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1027 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1028 |
pkg5unittest.HTTPSTestClass.setUp(self, pubs, |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1029 |
start_depots=True) |
2966
6a97d8a803d3
16297554 pkg history fails when time travelling
thejaswini.k@oracle.com
parents:
2898
diff
changeset
|
1030 |
|
2864
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1031 |
self.srurl = self.dcs[1].get_repo_url() |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1032 |
self.make_misc_files(self.misc_files) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1033 |
self.pkgsend_bulk(self.srurl, self.example_pkg10) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1034 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1035 |
self.surl = self.ac.url + "/%s" % pubs[0] |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1036 |
self.durl = self.ac.url + "/%s" % pubs[1] |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1037 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1038 |
#set permissions of tmp/verboten to make it non-readable |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1039 |
self.verboten = os.path.join(self.test_root, "tmp/verboten") |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1040 |
os.system("chmod 600 %s" % self.verboten) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1041 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1042 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1043 |
def test_01_basics(self): |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1044 |
"""Test that transfering a package from an https repo to |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1045 |
another https repo works""" |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1046 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1047 |
self.ac.start() |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1048 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1049 |
arg_dict = { |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1050 |
"cert": os.path.join(self.cs_dir, self.get_cli_cert("src")), |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1051 |
"key": os.path.join(self.keys_dir, self.get_cli_key("src")), |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1052 |
"dst": self.durl, |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1053 |
"dcert": os.path.join(self.cs_dir, self.get_cli_cert("dst")), |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1054 |
"dkey": os.path.join(self.keys_dir, self.get_cli_key("dst")), |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1055 |
"pkg": "[email protected],5.11-0", |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1056 |
"empty": os.path.join(self.test_root, "tmp/empty"), |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1057 |
"noexist": os.path.join(self.test_root, "octopus"), |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1058 |
"verboten": self.verboten, |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1059 |
} |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1060 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1061 |
# We need an image for seed_ta_dir() to work. |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1062 |
# TODO: there might be a cleaner way of doing this |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1063 |
self.image_create() |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1064 |
# Add the trust anchor needed to verify the server's identity. |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1065 |
self.seed_ta_dir("ta7") |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1066 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1067 |
# We try to receive a pkg from a secured repo and publish it to |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1068 |
# another secured repo where both repos require different |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1069 |
# credentials |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1070 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1071 |
"-d %(dst)s --dkey %(dkey)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1072 |
"%(pkg)s" % arg_dict) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1073 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1074 |
# Now try to use the same credentials for source and dest. |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1075 |
# This should fail. |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1076 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1077 |
"-d %(dst)s --dkey %(key)s --dcert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1078 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1079 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1080 |
# Make sure we don't traceback when credential files are invalid |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1081 |
# Src certificate option missing |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1082 |
self.pkgrecv(self.surl, "--key %(key)s -d %(dst)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1083 |
"--dkey %(dkey)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1084 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1085 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1086 |
# Dst certificate option missing |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1087 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1088 |
"-d %(dst)s --dkey %(dkey)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1089 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1090 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1091 |
# Src key option missing |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1092 |
self.pkgrecv(self.surl, "--cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1093 |
"-d %(dst)s --dkey %(dkey)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1094 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1095 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1096 |
# Dst key option missing |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1097 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1098 |
"-d %(dst)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1099 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1100 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1101 |
# Src certificate not found |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1102 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(noexist)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1103 |
"-d %(dst)s --dkey %(dkey)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1104 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1105 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1106 |
# Dst certificate not found |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1107 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1108 |
"-d %(dst)s --dkey %(dkey)s --dcert %(noexist)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1109 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1110 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1111 |
# Src key not found |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1112 |
self.pkgrecv(self.surl, "--key %(noexist)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1113 |
"-d %(dst)s --dkey %(dkey)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1114 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1115 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1116 |
# Dst key not found |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1117 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1118 |
"-d %(dst)s --dkey %(noexist)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1119 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1120 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1121 |
# Src certificate is empty file |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1122 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(empty)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1123 |
"-d %(dst)s --dkey %(dkey)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1124 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1125 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1126 |
# Dst certificate is empty file |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1127 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1128 |
"-d %(dst)s --dkey %(dkey)s --dcert %(empty)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1129 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1130 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1131 |
# Src key is empty file |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1132 |
self.pkgrecv(self.surl, "--key %(empty)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1133 |
"-d %(dst)s --dkey %(dkey)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1134 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1135 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1136 |
# Dst key is empty file |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1137 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1138 |
"-d %(dst)s --dkey %(empty)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1139 |
"%(pkg)s" % arg_dict, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1140 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1141 |
# No permissions to read src certificate |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1142 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(verboten)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1143 |
"-d %(dst)s --dkey %(dkey)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1144 |
"%(pkg)s" % arg_dict, su_wrap=True, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1145 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1146 |
# No permissions to read dst certificate |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1147 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1148 |
"-d %(dst)s --dkey %(dkey)s --dcert %(verboten)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1149 |
"%(pkg)s" % arg_dict, su_wrap=True, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1150 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1151 |
# No permissions to read src key |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1152 |
self.pkgrecv(self.surl, "--key %(verboten)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1153 |
"-d %(dst)s --dkey %(dkey)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1154 |
"%(pkg)s" % arg_dict, su_wrap=True, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1155 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1156 |
# No permissions to read dst key |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1157 |
self.pkgrecv(self.surl, "--key %(key)s --cert %(cert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1158 |
"-d %(dst)s --dkey %(verboten)s --dcert %(dcert)s " |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1159 |
"%(pkg)s" % arg_dict, su_wrap=True, exit=1) |
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1160 |
|
96d3957712da
16193298 pkgrepo, pkgrecv and pkgsend need SSL support for publishing and info retrieval
Erik Trauschke <Erik.Trauschke@oracle.com>
parents:
2808
diff
changeset
|
1161 |
|
581 | 1162 |
if __name__ == "__main__": |
1163 |
unittest.main() |