Merge lp:~townsend/libertine/update-package-cache into lp:libertine
- update-package-cache
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Larry Price |
Approved revision: | 305 |
Merged at revision: | 303 |
Proposed branch: | lp:~townsend/libertine/update-package-cache |
Merge into: | lp:libertine |
Diff against target: |
122 lines (+21/-12) 3 files modified
python/libertine/ChrootContainer.py (+4/-4) python/libertine/Libertine.py (+16/-7) python/libertine/LxcContainer.py (+1/-1) |
To merge this branch: | bzr merge lp:~townsend/libertine/update-package-cache |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Libertine CI Bot | continuous-integration | Approve | |
Larry Price | Approve | ||
Review via email: mp+306220@code.launchpad.net |
Commit message
Add a new update_apt_cache method and call that when needed, especially when installing new packages.
Description of the change
Libertine CI Bot (libertine-ci-bot) wrote : | # |
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:304
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 305. By Christopher Townsend
-
Remove --force-yes for the update operation as it's not needed.
Libertine CI Bot (libertine-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:305
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
1 | === modified file 'python/libertine/ChrootContainer.py' | |||
2 | --- python/libertine/ChrootContainer.py 2016-09-06 12:36:47 +0000 | |||
3 | +++ python/libertine/ChrootContainer.py 2016-09-20 14:35:18 +0000 | |||
4 | @@ -122,7 +122,7 @@ | |||
5 | 122 | self.update_packages(verbosity) | 122 | self.update_packages(verbosity) |
6 | 123 | 123 | ||
7 | 124 | for package in self.default_packages: | 124 | for package in self.default_packages: |
9 | 125 | if not self.install_package(package, verbosity): | 125 | if not self.install_package(package, verbosity, update_cache=False): |
10 | 126 | print("Failure installing %s during container creation" % package) | 126 | print("Failure installing %s during container creation" % package) |
11 | 127 | self.destroy_libertine_container() | 127 | self.destroy_libertine_container() |
12 | 128 | return False | 128 | return False |
13 | @@ -130,7 +130,7 @@ | |||
14 | 130 | if self.installed_release == "vivid": | 130 | if self.installed_release == "vivid": |
15 | 131 | if verbosity == 1: | 131 | if verbosity == 1: |
16 | 132 | print("Installing the Vivid Stable Overlay PPA...") | 132 | print("Installing the Vivid Stable Overlay PPA...") |
18 | 133 | if not self.install_package("software-properties-common", verbosity): | 133 | if not self.install_package("software-properties-common", verbosity, update_cache=False): |
19 | 134 | print("Failure installing software-properties-common during container creation") | 134 | print("Failure installing software-properties-common during container creation") |
20 | 135 | self.destroy_libertine_container() | 135 | self.destroy_libertine_container() |
21 | 136 | return False | 136 | return False |
22 | @@ -148,8 +148,8 @@ | |||
23 | 148 | self._run_ldconfig(verbosity) | 148 | self._run_ldconfig(verbosity) |
24 | 149 | return retcode | 149 | return retcode |
25 | 150 | 150 | ||
28 | 151 | def install_package(self, package_name, verbosity=1, readline=False): | 151 | def install_package(self, package_name, verbosity=1, readline=False, update_cache=True): |
29 | 152 | returncode = super().install_package(package_name, verbosity, readline) | 152 | returncode = super().install_package(package_name, verbosity, readline, update_cache) |
30 | 153 | 153 | ||
31 | 154 | if returncode: | 154 | if returncode: |
32 | 155 | self._run_ldconfig(verbosity) | 155 | self._run_ldconfig(verbosity) |
33 | 156 | 156 | ||
34 | === modified file 'python/libertine/Libertine.py' | |||
35 | --- python/libertine/Libertine.py 2016-09-06 12:36:47 +0000 | |||
36 | +++ python/libertine/Libertine.py 2016-09-20 14:35:18 +0000 | |||
37 | @@ -133,16 +133,24 @@ | |||
38 | 133 | """ | 133 | """ |
39 | 134 | pass | 134 | pass |
40 | 135 | 135 | ||
41 | 136 | def update_apt_cache(self, verbosity=1): | ||
42 | 137 | """ | ||
43 | 138 | Updates the apt cache in the container. | ||
44 | 139 | |||
45 | 140 | :param verbosity: the chattiness of the output on a range from 0 to 2 | ||
46 | 141 | """ | ||
47 | 142 | return self.run_in_container(apt_command_prefix(verbosity) + 'update') | ||
48 | 143 | |||
49 | 136 | def update_packages(self, verbosity=1): | 144 | def update_packages(self, verbosity=1): |
50 | 137 | """ | 145 | """ |
51 | 138 | Updates all packages installed in the container. | 146 | Updates all packages installed in the container. |
52 | 139 | 147 | ||
53 | 140 | :param verbosity: the chattiness of the output on a range from 0 to 2 | 148 | :param verbosity: the chattiness of the output on a range from 0 to 2 |
54 | 141 | """ | 149 | """ |
56 | 142 | self.run_in_container(apt_command_prefix(verbosity) + '--force-yes update') | 150 | self.update_apt_cache(verbosity) |
57 | 143 | return self.run_in_container(apt_command_prefix(verbosity) + '--force-yes dist-upgrade') | 151 | return self.run_in_container(apt_command_prefix(verbosity) + '--force-yes dist-upgrade') |
58 | 144 | 152 | ||
60 | 145 | def install_package(self, package_name, verbosity=1, readline=False): | 153 | def install_package(self, package_name, verbosity=1, readline=False, update_cache=True): |
61 | 146 | """ | 154 | """ |
62 | 147 | Installs a named package in the container. | 155 | Installs a named package in the container. |
63 | 148 | 156 | ||
64 | @@ -150,6 +158,9 @@ | |||
65 | 150 | a full path to a Debian package on the host. | 158 | a full path to a Debian package on the host. |
66 | 151 | :param verbosity: the chattiness of the output on a range from 0 to 2 | 159 | :param verbosity: the chattiness of the output on a range from 0 to 2 |
67 | 152 | """ | 160 | """ |
68 | 161 | if update_cache: | ||
69 | 162 | self.update_apt_cache(verbosity) | ||
70 | 163 | |||
71 | 153 | if package_name.endswith('.deb'): | 164 | if package_name.endswith('.deb'): |
72 | 154 | delete_package = self.copy_package_to_container(package_name) | 165 | delete_package = self.copy_package_to_container(package_name) |
73 | 155 | 166 | ||
74 | @@ -178,7 +189,7 @@ | |||
75 | 178 | if should_enable: | 189 | if should_enable: |
76 | 179 | ret = self.run_in_container("dpkg --add-architecture i386") | 190 | ret = self.run_in_container("dpkg --add-architecture i386") |
77 | 180 | if ret or ret == 0: | 191 | if ret or ret == 0: |
79 | 181 | self.run_in_container(apt_command_prefix(verbosity) + '--force-yes update') | 192 | self.update_apt_cache(verbosity) |
80 | 182 | return ret | 193 | return ret |
81 | 183 | else: | 194 | else: |
82 | 184 | self.run_in_container(apt_command_prefix(verbosity) + "purge \".*:i386\"") | 195 | self.run_in_container(apt_command_prefix(verbosity) + "purge \".*:i386\"") |
83 | @@ -193,10 +204,8 @@ | |||
84 | 193 | :param verbosity: the chattiness of the output on a range from 0 to 2 | 204 | :param verbosity: the chattiness of the output on a range from 0 to 2 |
85 | 194 | """ | 205 | """ |
86 | 195 | if not os.path.exists(os.path.join(self.root_path, 'usr', 'bin', 'add-apt-repository')): | 206 | if not os.path.exists(os.path.join(self.root_path, 'usr', 'bin', 'add-apt-repository')): |
87 | 196 | self.update_packages(verbosity) | ||
88 | 197 | self.install_package("software-properties-common", verbosity) | 207 | self.install_package("software-properties-common", verbosity) |
89 | 198 | if 'https://' in archive and not os.path.exists(os.path.join(self.root_path, 'usr', 'lib', 'apt', 'methods', 'https')): | 208 | if 'https://' in archive and not os.path.exists(os.path.join(self.root_path, 'usr', 'lib', 'apt', 'methods', 'https')): |
90 | 199 | self.update_packages(verbosity) | ||
91 | 200 | self.install_package("apt-transport-https", verbosity) | 209 | self.install_package("apt-transport-https", verbosity) |
92 | 201 | 210 | ||
93 | 202 | retcode = self.run_in_container("add-apt-repository -y " + archive) | 211 | retcode = self.run_in_container("add-apt-repository -y " + archive) |
94 | @@ -332,13 +341,13 @@ | |||
95 | 332 | except RuntimeError as e: | 341 | except RuntimeError as e: |
96 | 333 | return handle_runtime_error(e) | 342 | return handle_runtime_error(e) |
97 | 334 | 343 | ||
99 | 335 | def install_package(self, package_name, verbosity=1, readline=False): | 344 | def install_package(self, package_name, verbosity=1, readline=False, update_cache=True): |
100 | 336 | """ | 345 | """ |
101 | 337 | Installs a package in the container. | 346 | Installs a package in the container. |
102 | 338 | """ | 347 | """ |
103 | 339 | try: | 348 | try: |
104 | 340 | with ContainerRunning(self.container): | 349 | with ContainerRunning(self.container): |
106 | 341 | return self.container.install_package(package_name, verbosity, readline) | 350 | return self.container.install_package(package_name, verbosity, readline, update_cache) |
107 | 342 | except RuntimeError as e: | 351 | except RuntimeError as e: |
108 | 343 | return handle_runtime_error(e) | 352 | return handle_runtime_error(e) |
109 | 344 | 353 | ||
110 | 345 | 354 | ||
111 | === modified file 'python/libertine/LxcContainer.py' | |||
112 | --- python/libertine/LxcContainer.py 2016-09-07 19:08:12 +0000 | |||
113 | +++ python/libertine/LxcContainer.py 2016-09-20 14:35:18 +0000 | |||
114 | @@ -240,7 +240,7 @@ | |||
115 | 240 | self.update_packages(verbosity) | 240 | self.update_packages(verbosity) |
116 | 241 | 241 | ||
117 | 242 | for package in self.default_packages: | 242 | for package in self.default_packages: |
119 | 243 | if not self.install_package(package, verbosity): | 243 | if not self.install_package(package, verbosity, update_cache=False): |
120 | 244 | print("Failure installing %s during container creation" % package) | 244 | print("Failure installing %s during container creation" % package) |
121 | 245 | self.destroy_libertine_container() | 245 | self.destroy_libertine_container() |
122 | 246 | return False | 246 | return False |
PASSED: Continuous integration, rev:303 /jenkins. canonical. com/libertine/ job/lp- libertine- ci/128/ /jenkins. canonical. com/libertine/ job/build/ 348 /jenkins. canonical. com/libertine/ job/test- 0-autopkgtest/ label=amd64, release= vivid+overlay, testname= default/ 281 /jenkins. canonical. com/libertine/ job/test- 0-autopkgtest/ label=amd64, release= xenial+ overlay, testname= default/ 281 /jenkins. canonical. com/libertine/ job/test- 0-autopkgtest/ label=amd64, release= yakkety, testname= default/ 281 /jenkins. canonical. com/libertine/ job/test- 0-autopkgtest/ label=i386, release= vivid+overlay, testname= default/ 281 /jenkins. canonical. com/libertine/ job/test- 0-autopkgtest/ label=i386, release= xenial+ overlay, testname= default/ 281 /jenkins. canonical. com/libertine/ job/test- 0-autopkgtest/ label=i386, release= yakkety, testname= default/ 281 /jenkins. canonical. com/libertine/ job/lp- generic- update- mp/263/ console /jenkins. canonical. com/libertine/ job/build- 0-fetch/ 350 /jenkins. canonical. com/libertine/ job/build- 1-sourcepkg/ release= vivid+overlay/ 333 /jenkins. canonical. com/libertine/ job/build- 1-sourcepkg/ release= xenial+ overlay/ 333 /jenkins. canonical. com/libertine/ job/build- 1-sourcepkg/ release= yakkety/ 333 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=amd64, release= vivid+overlay/ 332 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=amd64, release= vivid+overlay/ 332/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=amd64, release= xenial+ overlay/ 332 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=amd64, release= xenial+ overlay/ 332/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=amd64, release= yakkety/ 332 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=amd64, release= yakkety/ 332/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=i386, release= vivid+overlay/ 332 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=i386, release= vivid+overlay/ 332/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=i386, release= xenial+ overlay/ 332 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=i386, release= xenial+ overlay/ 332/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=i386, release= yakkety/ 332 /jenkins. canonical. com/libertine/ job/build- 2-binpkg/ arch=i386, release= yakkety/ 332/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/libertine/ job/lp- libertine- ci/128/ rebuild
https:/