Merge ~cjwatson/launchpad:diskpool-add-source-version into launchpad:master
- Git
- lp:~cjwatson/launchpad
- diskpool-add-source-version
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | c16ac81d9570472366ba50b3c1d07147166cec81 |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:diskpool-add-source-version |
Merge into: | launchpad:master |
Prerequisite: | ~cjwatson/launchpad:diskpool-add-archive |
Diff against target: |
888 lines (+191/-107) 12 files modified
lib/lp/archivepublisher/artifactory.py (+24/-17) lib/lp/archivepublisher/deathrow.py (+10/-8) lib/lp/archivepublisher/diskpool.py (+27/-22) lib/lp/archivepublisher/model/ftparchive.py (+8/-1) lib/lp/archivepublisher/publishing.py (+4/-3) lib/lp/archivepublisher/tests/deathrow.txt (+1/-0) lib/lp/archivepublisher/tests/test_artifactory.py (+63/-28) lib/lp/archivepublisher/tests/test_deathrow.py (+1/-0) lib/lp/archivepublisher/tests/test_ftparchive.py (+13/-12) lib/lp/archivepublisher/tests/test_pool.py (+29/-13) lib/lp/archivepublisher/tests/test_publisher.py (+6/-0) lib/lp/soyuz/model/publishing.py (+5/-3) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jürgen Gmach | Approve | ||
Review via email: mp+423537@code.launchpad.net |
Commit message
Tell DiskPool about source version when adding/removing files
Description of the change
Some repository formats, such as Python indexes, organize files by version as well as by name. To accommodate this, tell the disk pool about the source package version as well as the source package name when adding or removing files. The Artifactory pool implementation also needs to store this in a property so that it can construct an entry for the file when updating its properties.
To post a comment you must log in.
Revision history for this message
Jürgen Gmach (jugmac00) : | # |
review:
Approve
Revision history for this message
Colin Watson (cjwatson) : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/lib/lp/archivepublisher/artifactory.py b/lib/lp/archivepublisher/artifactory.py | |||
2 | index 2873855..53b43a6 100644 | |||
3 | --- a/lib/lp/archivepublisher/artifactory.py | |||
4 | +++ b/lib/lp/archivepublisher/artifactory.py | |||
5 | @@ -44,9 +44,12 @@ from lp.soyuz.interfaces.publishing import ( | |||
6 | 44 | class ArtifactoryPoolEntry: | 44 | class ArtifactoryPoolEntry: |
7 | 45 | 45 | ||
8 | 46 | def __init__(self, archive: IArchive, rootpath: ArtifactoryPath, | 46 | def __init__(self, archive: IArchive, rootpath: ArtifactoryPath, |
10 | 47 | source: str, filename: str, logger: logging.Logger) -> None: | 47 | source_name: str, source_version: str, filename: str, |
11 | 48 | logger: logging.Logger) -> None: | ||
12 | 49 | self.archive = archive | ||
13 | 48 | self.rootpath = rootpath | 50 | self.rootpath = rootpath |
15 | 49 | self.source = source | 51 | self.source_name = source_name |
16 | 52 | self.source_version = source_version | ||
17 | 50 | self.filename = filename | 53 | self.filename = filename |
18 | 51 | self.logger = logger | 54 | self.logger = logger |
19 | 52 | 55 | ||
20 | @@ -60,7 +63,7 @@ class ArtifactoryPoolEntry: | |||
21 | 60 | # the pool structure, and doing so would introduce significant | 63 | # the pool structure, and doing so would introduce significant |
22 | 61 | # complications in terms of having to keep track of components just | 64 | # complications in terms of having to keep track of components just |
23 | 62 | # in order to update an artifact's properties. | 65 | # in order to update an artifact's properties. |
25 | 63 | return self.rootpath / poolify(self.source) / self.filename | 66 | return self.rootpath / poolify(self.source_name) / self.filename |
26 | 64 | 67 | ||
27 | 65 | def makeReleaseID(self, pub_file: IPackageReleaseFile) -> str: | 68 | def makeReleaseID(self, pub_file: IPackageReleaseFile) -> str: |
28 | 66 | """ | 69 | """ |
29 | @@ -129,7 +132,8 @@ class ArtifactoryPoolEntry: | |||
30 | 129 | """ | 132 | """ |
31 | 130 | properties = {} | 133 | properties = {} |
32 | 131 | properties["launchpad.release-id"] = [release_id] | 134 | properties["launchpad.release-id"] = [release_id] |
34 | 132 | properties["launchpad.source-name"] = [self.source] | 135 | properties["launchpad.source-name"] = [self.source_name] |
35 | 136 | properties["launchpad.source-version"] = [self.source_version] | ||
36 | 133 | if publications: | 137 | if publications: |
37 | 134 | archives = {publication.archive for publication in publications} | 138 | archives = {publication.archive for publication in publications} |
38 | 135 | if len(archives) > 1: | 139 | if len(archives) > 1: |
39 | @@ -259,12 +263,14 @@ class ArtifactoryPool: | |||
40 | 259 | session.auth = XJFrogArtApiAuth(write_creds.split(":", 1)[1]) | 263 | session.auth = XJFrogArtApiAuth(write_creds.split(":", 1)[1]) |
41 | 260 | return session | 264 | return session |
42 | 261 | 265 | ||
44 | 262 | def _getEntry(self, sourcename, file) -> ArtifactoryPoolEntry: | 266 | def _getEntry(self, source_name: str, source_version: str, |
45 | 267 | file: str) -> ArtifactoryPoolEntry: | ||
46 | 263 | """See `DiskPool._getEntry`.""" | 268 | """See `DiskPool._getEntry`.""" |
47 | 264 | return ArtifactoryPoolEntry( | 269 | return ArtifactoryPoolEntry( |
49 | 265 | self.archive, self.rootpath, sourcename, file, self.logger) | 270 | self.archive, self.rootpath, source_name, source_version, file, |
50 | 271 | self.logger) | ||
51 | 266 | 272 | ||
53 | 267 | def pathFor(self, comp: str, source: str, | 273 | def pathFor(self, comp: str, source_name: str, source_version: str, |
54 | 268 | file: Optional[str] = None) -> Path: | 274 | file: Optional[str] = None) -> Path: |
55 | 269 | """Return the path for the given pool folder or file. | 275 | """Return the path for the given pool folder or file. |
56 | 270 | 276 | ||
57 | @@ -279,16 +285,17 @@ class ArtifactoryPool: | |||
58 | 279 | # the pool structure, and doing so would introduce significant | 285 | # the pool structure, and doing so would introduce significant |
59 | 280 | # complications in terms of having to keep track of components just | 286 | # complications in terms of having to keep track of components just |
60 | 281 | # in order to update an artifact's properties. | 287 | # in order to update an artifact's properties. |
62 | 282 | path = self.rootpath / poolify(source) | 288 | path = self.rootpath / poolify(source_name) |
63 | 283 | if file: | 289 | if file: |
64 | 284 | path = path / file | 290 | path = path / file |
65 | 285 | return path | 291 | return path |
66 | 286 | 292 | ||
69 | 287 | def addFile(self, component: str, sourcename: str, filename: str, | 293 | def addFile(self, component: str, source_name: str, source_version: str, |
70 | 288 | pub_file: IPackageReleaseFile): | 294 | filename: str, pub_file: IPackageReleaseFile): |
71 | 289 | """Add a file with the given contents to the pool. | 295 | """Add a file with the given contents to the pool. |
72 | 290 | 296 | ||
74 | 291 | `sourcename` and `filename` are used to calculate the location. | 297 | `source_name`, `source_version`, and `filename` are used to |
75 | 298 | calculate the location. | ||
76 | 292 | 299 | ||
77 | 293 | pub_file is an `IPackageReleaseFile` providing the file's contents | 300 | pub_file is an `IPackageReleaseFile` providing the file's contents |
78 | 294 | and SHA-1 hash. The SHA-1 hash is used to compare the given file | 301 | and SHA-1 hash. The SHA-1 hash is used to compare the given file |
79 | @@ -308,10 +315,10 @@ class ArtifactoryPool: | |||
80 | 308 | This is similar to `DiskPool.addFile`, except that there is no | 315 | This is similar to `DiskPool.addFile`, except that there is no |
81 | 309 | symlink handling and the component is ignored. | 316 | symlink handling and the component is ignored. |
82 | 310 | """ | 317 | """ |
84 | 311 | entry = self._getEntry(sourcename, filename) | 318 | entry = self._getEntry(source_name, source_version, filename) |
85 | 312 | return entry.addFile(pub_file) | 319 | return entry.addFile(pub_file) |
86 | 313 | 320 | ||
88 | 314 | def removeFile(self, component: str, sourcename: str, | 321 | def removeFile(self, component: str, source_name: str, source_version: str, |
89 | 315 | filename: str) -> int: | 322 | filename: str) -> int: |
90 | 316 | """Remove the specified file from the pool. | 323 | """Remove the specified file from the pool. |
91 | 317 | 324 | ||
92 | @@ -324,13 +331,13 @@ class ArtifactoryPool: | |||
93 | 324 | This is similar to `DiskPool.removeFile`, except that there is no | 331 | This is similar to `DiskPool.removeFile`, except that there is no |
94 | 325 | symlink handling and the component is ignored. | 332 | symlink handling and the component is ignored. |
95 | 326 | """ | 333 | """ |
97 | 327 | entry = self._getEntry(sourcename, filename) | 334 | entry = self._getEntry(source_name, source_version, filename) |
98 | 328 | return entry.removeFile() | 335 | return entry.removeFile() |
99 | 329 | 336 | ||
102 | 330 | def updateProperties(self, sourcename, filename, publications, | 337 | def updateProperties(self, source_name: str, source_version: str, |
103 | 331 | old_properties=None): | 338 | filename: str, publications, old_properties=None): |
104 | 332 | """Update a file's properties in Artifactory.""" | 339 | """Update a file's properties in Artifactory.""" |
106 | 333 | entry = self._getEntry(sourcename, filename) | 340 | entry = self._getEntry(source_name, source_version, filename) |
107 | 334 | entry.updateProperties(publications, old_properties=old_properties) | 341 | entry.updateProperties(publications, old_properties=old_properties) |
108 | 335 | 342 | ||
109 | 336 | def getArtifactPatterns(self, repository_format): | 343 | def getArtifactPatterns(self, repository_format): |
110 | diff --git a/lib/lp/archivepublisher/deathrow.py b/lib/lp/archivepublisher/deathrow.py | |||
111 | index 06e430a..9071a53 100644 | |||
112 | --- a/lib/lp/archivepublisher/deathrow.py | |||
113 | +++ b/lib/lp/archivepublisher/deathrow.py | |||
114 | @@ -87,10 +87,10 @@ class DeathRow: | |||
115 | 87 | removed.""" | 87 | removed.""" |
116 | 88 | if dry_run: | 88 | if dry_run: |
117 | 89 | # Don't actually remove the files if we are dry running | 89 | # Don't actually remove the files if we are dry running |
122 | 90 | def _mockRemoveFile(cn, sn, fn): | 90 | def _mockRemoveFile(cn, sn, sv, fn): |
123 | 91 | self.logger.debug("(Not really!) removing %s %s/%s" % | 91 | self.logger.debug("(Not really!) removing %s %s/%s/%s" % |
124 | 92 | (cn, sn, fn)) | 92 | (cn, sn, sv, fn)) |
125 | 93 | fullpath = self.diskpool.pathFor(cn, sn, fn) | 93 | fullpath = self.diskpool.pathFor(cn, sn, sv, fn) |
126 | 94 | if not fullpath.exists(): | 94 | if not fullpath.exists(): |
127 | 95 | raise NotInPool | 95 | raise NotInPool |
128 | 96 | return fullpath.lstat().st_size | 96 | return fullpath.lstat().st_size |
129 | @@ -227,9 +227,10 @@ class DeathRow: | |||
130 | 227 | 227 | ||
131 | 228 | # Calculating the file path in pool. | 228 | # Calculating the file path in pool. |
132 | 229 | pub_file_details = ( | 229 | pub_file_details = ( |
133 | 230 | pub_file.libraryfile.filename, | ||
134 | 231 | pub_record.source_package_name, | ||
135 | 232 | pub_record.component_name, | 230 | pub_record.component_name, |
136 | 231 | pub_record.source_package_name, | ||
137 | 232 | pub_record.source_package_version, | ||
138 | 233 | pub_file.libraryfile.filename, | ||
139 | 233 | ) | 234 | ) |
140 | 234 | file_path = str(self.diskpool.pathFor(*pub_file_details)) | 235 | file_path = str(self.diskpool.pathFor(*pub_file_details)) |
141 | 235 | 236 | ||
142 | @@ -264,10 +265,11 @@ class DeathRow: | |||
143 | 264 | "Removing %s files marked for reaping" % len(condemned_files)) | 265 | "Removing %s files marked for reaping" % len(condemned_files)) |
144 | 265 | 266 | ||
145 | 266 | for condemned_file in sorted(condemned_files, reverse=True): | 267 | for condemned_file in sorted(condemned_files, reverse=True): |
147 | 267 | file_name, source_name, component_name = details[condemned_file] | 268 | component_name, source_name, source_version, file_name = ( |
148 | 269 | details[condemned_file]) | ||
149 | 268 | try: | 270 | try: |
150 | 269 | bytes += self._removeFile( | 271 | bytes += self._removeFile( |
152 | 270 | component_name, source_name, file_name) | 272 | component_name, source_name, source_version, file_name) |
153 | 271 | except NotInPool as info: | 273 | except NotInPool as info: |
154 | 272 | # It's safe for us to let this slide because it means that | 274 | # It's safe for us to let this slide because it means that |
155 | 273 | # the file is already gone. | 275 | # the file is already gone. |
156 | diff --git a/lib/lp/archivepublisher/diskpool.py b/lib/lp/archivepublisher/diskpool.py | |||
157 | index 620c728..01ce763 100644 | |||
158 | --- a/lib/lp/archivepublisher/diskpool.py | |||
159 | +++ b/lib/lp/archivepublisher/diskpool.py | |||
160 | @@ -139,11 +139,13 @@ class DiskPoolEntry: | |||
161 | 139 | require manual removal after further investigation. | 139 | require manual removal after further investigation. |
162 | 140 | """ | 140 | """ |
163 | 141 | def __init__(self, archive: IArchive, rootpath: Path, temppath: Path, | 141 | def __init__(self, archive: IArchive, rootpath: Path, temppath: Path, |
165 | 142 | source: str, filename: str, logger: logging.Logger) -> None: | 142 | source_name: str, source_version: str, filename: str, |
166 | 143 | logger: logging.Logger) -> None: | ||
167 | 143 | self.archive = archive | 144 | self.archive = archive |
168 | 144 | self.rootpath = rootpath | 145 | self.rootpath = rootpath |
169 | 145 | self.temppath = temppath | 146 | self.temppath = temppath |
171 | 146 | self.source = source | 147 | self.source_name = source_name |
172 | 148 | self.source_version = source_version | ||
173 | 147 | self.filename = filename | 149 | self.filename = filename |
174 | 148 | self.logger = logger | 150 | self.logger = logger |
175 | 149 | 151 | ||
176 | @@ -165,7 +167,9 @@ class DiskPoolEntry: | |||
177 | 165 | 167 | ||
178 | 166 | def pathFor(self, component: str) -> Path: | 168 | def pathFor(self, component: str) -> Path: |
179 | 167 | """Return the path for this file in the given component.""" | 169 | """Return the path for this file in the given component.""" |
181 | 168 | return self.rootpath / poolify(self.source, component) / self.filename | 170 | return ( |
182 | 171 | self.rootpath / poolify(self.source_name, component) / | ||
183 | 172 | self.filename) | ||
184 | 169 | 173 | ||
185 | 170 | def preferredComponent(self, add: Optional[str] = None, | 174 | def preferredComponent(self, add: Optional[str] = None, |
186 | 171 | remove: Optional[str] = None) -> Optional[str]: | 175 | remove: Optional[str] = None) -> Optional[str]: |
187 | @@ -230,7 +234,7 @@ class DiskPoolEntry: | |||
188 | 230 | assert not targetpath.exists() | 234 | assert not targetpath.exists() |
189 | 231 | 235 | ||
190 | 232 | self.debug("Making new file in %s for %s/%s" % | 236 | self.debug("Making new file in %s for %s/%s" % |
192 | 233 | (component, self.source, self.filename)) | 237 | (component, self.source_name, self.filename)) |
193 | 234 | 238 | ||
194 | 235 | file_to_write = _diskpool_atomicfile( | 239 | file_to_write = _diskpool_atomicfile( |
195 | 236 | targetpath, "wb", rootpath=self.temppath) | 240 | targetpath, "wb", rootpath=self.temppath) |
196 | @@ -253,13 +257,13 @@ class DiskPoolEntry: | |||
197 | 253 | if not self.file_component: | 257 | if not self.file_component: |
198 | 254 | raise NotInPool( | 258 | raise NotInPool( |
199 | 255 | "File for removing %s %s/%s is not in pool, skipping." % | 259 | "File for removing %s %s/%s is not in pool, skipping." % |
201 | 256 | (component, self.source, self.filename)) | 260 | (component, self.source_name, self.filename)) |
202 | 257 | 261 | ||
203 | 258 | # Okay, it's there, if it's a symlink then we need to remove | 262 | # Okay, it's there, if it's a symlink then we need to remove |
204 | 259 | # it simply. | 263 | # it simply. |
205 | 260 | if component in self.symlink_components: | 264 | if component in self.symlink_components: |
206 | 261 | self.debug("Removing %s %s/%s as it is a symlink" | 265 | self.debug("Removing %s %s/%s as it is a symlink" |
208 | 262 | % (component, self.source, self.filename)) | 266 | % (component, self.source_name, self.filename)) |
209 | 263 | # ensure we are removing a symbolic link and | 267 | # ensure we are removing a symbolic link and |
210 | 264 | # it is published in one or more components | 268 | # it is published in one or more components |
211 | 265 | link_path = self.pathFor(component) | 269 | link_path = self.pathFor(component) |
212 | @@ -269,13 +273,13 @@ class DiskPoolEntry: | |||
213 | 269 | if component != self.file_component: | 273 | if component != self.file_component: |
214 | 270 | raise MissingSymlinkInPool( | 274 | raise MissingSymlinkInPool( |
215 | 271 | "Symlink for %s/%s in %s is missing, skipping." % | 275 | "Symlink for %s/%s in %s is missing, skipping." % |
217 | 272 | (self.source, self.filename, component)) | 276 | (self.source_name, self.filename, component)) |
218 | 273 | 277 | ||
219 | 274 | # It's not a symlink, this means we need to check whether we | 278 | # It's not a symlink, this means we need to check whether we |
220 | 275 | # have symlinks or not. | 279 | # have symlinks or not. |
221 | 276 | if len(self.symlink_components) == 0: | 280 | if len(self.symlink_components) == 0: |
222 | 277 | self.debug("Removing %s/%s from %s" % | 281 | self.debug("Removing %s/%s from %s" % |
224 | 278 | (self.source, self.filename, component)) | 282 | (self.source_name, self.filename, component)) |
225 | 279 | else: | 283 | else: |
226 | 280 | # The target for removal is the real file, and there are symlinks | 284 | # The target for removal is the real file, and there are symlinks |
227 | 281 | # pointing to it. In order to avoid breakage, we need to first | 285 | # pointing to it. In order to avoid breakage, we need to first |
228 | @@ -398,33 +402,34 @@ class DiskPool: | |||
229 | 398 | self.entries = {} | 402 | self.entries = {} |
230 | 399 | self.logger = logger | 403 | self.logger = logger |
231 | 400 | 404 | ||
234 | 401 | def _getEntry(self, sourcename: str, file: str) -> DiskPoolEntry: | 405 | def _getEntry(self, source_name: str, source_version: str, |
235 | 402 | """Return a new DiskPoolEntry for the given sourcename and file.""" | 406 | file: str) -> DiskPoolEntry: |
236 | 407 | """Return a new DiskPoolEntry for the given source and file.""" | ||
237 | 403 | return DiskPoolEntry( | 408 | return DiskPoolEntry( |
240 | 404 | self.archive, self.rootpath, self.temppath, sourcename, | 409 | self.archive, self.rootpath, self.temppath, source_name, |
241 | 405 | file, self.logger) | 410 | source_version, file, self.logger) |
242 | 406 | 411 | ||
244 | 407 | def pathFor(self, comp: str, source: str, | 412 | def pathFor(self, comp: str, source_name: str, source_version: str, |
245 | 408 | file: Optional[str] = None) -> Path: | 413 | file: Optional[str] = None) -> Path: |
246 | 409 | """Return the path for the given pool folder or file. | 414 | """Return the path for the given pool folder or file. |
247 | 410 | 415 | ||
248 | 411 | If file is none, the path to the folder containing all packages | 416 | If file is none, the path to the folder containing all packages |
250 | 412 | for the given component and source package name will be returned. | 417 | for the given component and source package will be returned. |
251 | 413 | 418 | ||
252 | 414 | If file is specified, the path to the specific package file will | 419 | If file is specified, the path to the specific package file will |
253 | 415 | be returned. | 420 | be returned. |
254 | 416 | """ | 421 | """ |
256 | 417 | path = self.rootpath / poolify(source, comp) | 422 | path = self.rootpath / poolify(source_name, comp) |
257 | 418 | if file: | 423 | if file: |
258 | 419 | path = path / file | 424 | path = path / file |
259 | 420 | return path | 425 | return path |
260 | 421 | 426 | ||
263 | 422 | def addFile(self, component: str, sourcename: str, filename: str, | 427 | def addFile(self, component: str, source_name: str, source_version: str, |
264 | 423 | pub_file: IPackageReleaseFile): | 428 | filename: str, pub_file: IPackageReleaseFile): |
265 | 424 | """Add a file with the given contents to the pool. | 429 | """Add a file with the given contents to the pool. |
266 | 425 | 430 | ||
269 | 426 | Component, sourcename and filename are used to calculate the | 431 | `component`, `source_name`, `source_version`, and `filename` are |
270 | 427 | on-disk location. | 432 | used to calculate the on-disk location. |
271 | 428 | 433 | ||
272 | 429 | pub_file is an `IPackageReleaseFile` providing the file's contents | 434 | pub_file is an `IPackageReleaseFile` providing the file's contents |
273 | 430 | and SHA-1 hash. The SHA-1 hash is used to compare the given file | 435 | and SHA-1 hash. The SHA-1 hash is used to compare the given file |
274 | @@ -450,10 +455,10 @@ class DiskPool: | |||
275 | 450 | either as a file or a symlink, and the hash check passes, | 455 | either as a file or a symlink, and the hash check passes, |
276 | 451 | results.NONE will be returned and nothing will be done. | 456 | results.NONE will be returned and nothing will be done. |
277 | 452 | """ | 457 | """ |
279 | 453 | entry = self._getEntry(sourcename, filename) | 458 | entry = self._getEntry(source_name, source_version, filename) |
280 | 454 | return entry.addFile(component, pub_file) | 459 | return entry.addFile(component, pub_file) |
281 | 455 | 460 | ||
283 | 456 | def removeFile(self, component: str, sourcename: str, | 461 | def removeFile(self, component: str, source_name: str, source_version: str, |
284 | 457 | filename: str) -> int: | 462 | filename: str) -> int: |
285 | 458 | """Remove the specified file from the pool. | 463 | """Remove the specified file from the pool. |
286 | 459 | 464 | ||
287 | @@ -469,5 +474,5 @@ class DiskPool: | |||
288 | 469 | will be deleted, and the file will be moved to replace it. The | 474 | will be deleted, and the file will be moved to replace it. The |
289 | 470 | size of the deleted symlink will be returned. | 475 | size of the deleted symlink will be returned. |
290 | 471 | """ | 476 | """ |
292 | 472 | entry = self._getEntry(sourcename, filename) | 477 | entry = self._getEntry(source_name, source_version, filename) |
293 | 473 | return entry.removeFile(component) | 478 | return entry.removeFile(component) |
294 | diff --git a/lib/lp/archivepublisher/model/ftparchive.py b/lib/lp/archivepublisher/model/ftparchive.py | |||
295 | index 469b1cb..7e94441 100644 | |||
296 | --- a/lib/lp/archivepublisher/model/ftparchive.py | |||
297 | +++ b/lib/lp/archivepublisher/model/ftparchive.py | |||
298 | @@ -693,8 +693,15 @@ class FTPArchiveHandler: | |||
299 | 693 | 693 | ||
300 | 694 | def updateFileList(sourcepackagename, filename, component, | 694 | def updateFileList(sourcepackagename, filename, component, |
301 | 695 | architecturetag=None): | 695 | architecturetag=None): |
302 | 696 | # DiskPool.pathFor takes a source package version parameter. We | ||
303 | 697 | # could fetch that in getSourceFiles/getBinaryFiles and pass it | ||
304 | 698 | # down here. However, it adds another column to a query with an | ||
305 | 699 | # already large number of rows, and it's only needed for | ||
306 | 700 | # non-Debian-format archives, which by definition aren't | ||
307 | 701 | # involved here; so we just pass None as the version. | ||
308 | 696 | ondiskname = str( | 702 | ondiskname = str( |
310 | 697 | self._diskpool.pathFor(component, sourcepackagename, filename)) | 703 | self._diskpool.pathFor( |
311 | 704 | component, sourcepackagename, None, filename)) | ||
312 | 698 | if architecturetag is None: | 705 | if architecturetag is None: |
313 | 699 | architecturetag = "source" | 706 | architecturetag = "source" |
314 | 700 | filelist[component][architecturetag].append(ondiskname) | 707 | filelist[component][architecturetag].append(ondiskname) |
315 | diff --git a/lib/lp/archivepublisher/publishing.py b/lib/lp/archivepublisher/publishing.py | |||
316 | index 69fb7e3..b0ddd32 100644 | |||
317 | --- a/lib/lp/archivepublisher/publishing.py | |||
318 | +++ b/lib/lp/archivepublisher/publishing.py | |||
319 | @@ -752,12 +752,13 @@ class Publisher: | |||
320 | 752 | for path, properties in sorted(artifacts.items()): | 752 | for path, properties in sorted(artifacts.items()): |
321 | 753 | release_id = properties.get("launchpad.release-id") | 753 | release_id = properties.get("launchpad.release-id") |
322 | 754 | source_name = properties.get("launchpad.source-name") | 754 | source_name = properties.get("launchpad.source-name") |
324 | 755 | if not release_id or not source_name: | 755 | source_version = properties.get("launchpad.source-version") |
325 | 756 | if not release_id or not source_name or not source_version: | ||
326 | 756 | # Skip any files that Launchpad didn't put in Artifactory. | 757 | # Skip any files that Launchpad didn't put in Artifactory. |
327 | 757 | continue | 758 | continue |
328 | 758 | self._diskpool.updateProperties( | 759 | self._diskpool.updateProperties( |
331 | 759 | source_name[0], path.name, pubs_by_id.get(release_id[0]), | 760 | source_name[0], source_version[0], path.name, |
332 | 760 | old_properties=properties) | 761 | pubs_by_id.get(release_id[0]), old_properties=properties) |
333 | 761 | 762 | ||
334 | 762 | def D_writeReleaseFiles(self, is_careful): | 763 | def D_writeReleaseFiles(self, is_careful): |
335 | 763 | """Write out the Release files for the provided distribution. | 764 | """Write out the Release files for the provided distribution. |
336 | diff --git a/lib/lp/archivepublisher/tests/deathrow.txt b/lib/lp/archivepublisher/tests/deathrow.txt | |||
337 | index 92b0752..5f8ac79 100644 | |||
338 | --- a/lib/lp/archivepublisher/tests/deathrow.txt | |||
339 | +++ b/lib/lp/archivepublisher/tests/deathrow.txt | |||
340 | @@ -208,6 +208,7 @@ Publish files on disk and build a list of all created file paths | |||
341 | 208 | ... file_path = quiet_disk_pool.pathFor( | 208 | ... file_path = quiet_disk_pool.pathFor( |
342 | 209 | ... pub.component.name, | 209 | ... pub.component.name, |
343 | 210 | ... pub.source_package_name, | 210 | ... pub.source_package_name, |
344 | 211 | ... pub.source_package_version, | ||
345 | 211 | ... pub_file.libraryfile.filename | 212 | ... pub_file.libraryfile.filename |
346 | 212 | ... ) | 213 | ... ) |
347 | 213 | ... unique_file_paths.add(file_path) | 214 | ... unique_file_paths.add(file_path) |
348 | diff --git a/lib/lp/archivepublisher/tests/test_artifactory.py b/lib/lp/archivepublisher/tests/test_artifactory.py | |||
349 | index 49f7ace..241f277 100644 | |||
350 | --- a/lib/lp/archivepublisher/tests/test_artifactory.py | |||
351 | +++ b/lib/lp/archivepublisher/tests/test_artifactory.py | |||
352 | @@ -62,7 +62,8 @@ class ArtifactoryPoolTestingFile(PoolTestingFile): | |||
353 | 62 | return super().checkIsFile(None) | 62 | return super().checkIsFile(None) |
354 | 63 | 63 | ||
355 | 64 | def getProperties(self): | 64 | def getProperties(self): |
357 | 65 | path = self.pool.pathFor(None, self.sourcename, self.filename) | 65 | path = self.pool.pathFor( |
358 | 66 | None, self.source_name, self.source_version, self.filename) | ||
359 | 66 | return path.properties | 67 | return path.properties |
360 | 67 | 68 | ||
361 | 68 | 69 | ||
362 | @@ -81,8 +82,9 @@ class TestArtifactoryPool(TestCase): | |||
363 | 81 | 82 | ||
364 | 82 | def test_addFile(self): | 83 | def test_addFile(self): |
365 | 83 | foo = ArtifactoryPoolTestingFile( | 84 | foo = ArtifactoryPoolTestingFile( |
368 | 84 | self.pool, "foo", "foo-1.0.deb", | 85 | pool=self.pool, source_name="foo", source_version="1.0", |
369 | 85 | release_type=FakeReleaseType.BINARY, release_id=1) | 86 | filename="foo-1.0.deb", release_type=FakeReleaseType.BINARY, |
370 | 87 | release_id=1) | ||
371 | 86 | self.assertFalse(foo.checkIsFile()) | 88 | self.assertFalse(foo.checkIsFile()) |
372 | 87 | result = foo.addToPool() | 89 | result = foo.addToPool() |
373 | 88 | self.assertEqual(self.pool.results.FILE_ADDED, result) | 90 | self.assertEqual(self.pool.results.FILE_ADDED, result) |
374 | @@ -91,13 +93,15 @@ class TestArtifactoryPool(TestCase): | |||
375 | 91 | { | 93 | { |
376 | 92 | "launchpad.release-id": ["binary:1"], | 94 | "launchpad.release-id": ["binary:1"], |
377 | 93 | "launchpad.source-name": ["foo"], | 95 | "launchpad.source-name": ["foo"], |
378 | 96 | "launchpad.source-version": ["1.0"], | ||
379 | 94 | }, | 97 | }, |
380 | 95 | foo.getProperties()) | 98 | foo.getProperties()) |
381 | 96 | 99 | ||
382 | 97 | def test_addFile_exists_identical(self): | 100 | def test_addFile_exists_identical(self): |
383 | 98 | foo = ArtifactoryPoolTestingFile( | 101 | foo = ArtifactoryPoolTestingFile( |
386 | 99 | self.pool, "foo", "foo-1.0.deb", | 102 | pool=self.pool, source_name="foo", source_version="1.0", |
387 | 100 | release_type=FakeReleaseType.BINARY, release_id=1) | 103 | filename="foo-1.0.deb", release_type=FakeReleaseType.BINARY, |
388 | 104 | release_id=1) | ||
389 | 101 | foo.addToPool() | 105 | foo.addToPool() |
390 | 102 | self.assertTrue(foo.checkIsFile()) | 106 | self.assertTrue(foo.checkIsFile()) |
391 | 103 | result = foo.addToPool() | 107 | result = foo.addToPool() |
392 | @@ -106,15 +110,18 @@ class TestArtifactoryPool(TestCase): | |||
393 | 106 | 110 | ||
394 | 107 | def test_addFile_exists_overwrite(self): | 111 | def test_addFile_exists_overwrite(self): |
395 | 108 | foo = ArtifactoryPoolTestingFile( | 112 | foo = ArtifactoryPoolTestingFile( |
398 | 109 | self.pool, "foo", "foo-1.0.deb", | 113 | pool=self.pool, source_name="foo", source_version="1.0", |
399 | 110 | release_type=FakeReleaseType.BINARY, release_id=1) | 114 | filename="foo-1.0.deb", release_type=FakeReleaseType.BINARY, |
400 | 115 | release_id=1) | ||
401 | 111 | foo.addToPool() | 116 | foo.addToPool() |
402 | 112 | self.assertTrue(foo.checkIsFile()) | 117 | self.assertTrue(foo.checkIsFile()) |
403 | 113 | foo.contents = b"different" | 118 | foo.contents = b"different" |
404 | 114 | self.assertRaises(PoolFileOverwriteError, foo.addToPool) | 119 | self.assertRaises(PoolFileOverwriteError, foo.addToPool) |
405 | 115 | 120 | ||
406 | 116 | def test_removeFile(self): | 121 | def test_removeFile(self): |
408 | 117 | foo = ArtifactoryPoolTestingFile(self.pool, "foo", "foo-1.0.deb") | 122 | foo = ArtifactoryPoolTestingFile( |
409 | 123 | pool=self.pool, source_name="foo", source_version="1.0", | ||
410 | 124 | filename="foo-1.0.deb") | ||
411 | 118 | foo.addToPool() | 125 | foo.addToPool() |
412 | 119 | self.assertTrue(foo.checkIsFile()) | 126 | self.assertTrue(foo.checkIsFile()) |
413 | 120 | size = foo.removeFromPool() | 127 | size = foo.removeFromPool() |
414 | @@ -145,23 +152,28 @@ class TestArtifactoryPool(TestCase): | |||
415 | 145 | # with it. This test mainly ensures that we transform the response | 152 | # with it. This test mainly ensures that we transform the response |
416 | 146 | # correctly. | 153 | # correctly. |
417 | 147 | ArtifactoryPoolTestingFile( | 154 | ArtifactoryPoolTestingFile( |
420 | 148 | self.pool, "foo", "foo-1.0.deb", | 155 | pool=self.pool, source_name="foo", source_version="1.0", |
421 | 149 | release_type=FakeReleaseType.BINARY, release_id=1).addToPool() | 156 | filename="foo-1.0.deb", release_type=FakeReleaseType.BINARY, |
422 | 157 | release_id=1).addToPool() | ||
423 | 150 | ArtifactoryPoolTestingFile( | 158 | ArtifactoryPoolTestingFile( |
426 | 151 | self.pool, "foo", "foo-1.1.deb", | 159 | pool=self.pool, source_name="foo", source_version="1.1", |
427 | 152 | release_type=FakeReleaseType.BINARY, release_id=2).addToPool() | 160 | filename="foo-1.1.deb", release_type=FakeReleaseType.BINARY, |
428 | 161 | release_id=2).addToPool() | ||
429 | 153 | ArtifactoryPoolTestingFile( | 162 | ArtifactoryPoolTestingFile( |
432 | 154 | self.pool, "bar", "bar-1.0.whl", | 163 | pool=self.pool, source_name="bar", source_version="1.0", |
433 | 155 | release_type=FakeReleaseType.BINARY, release_id=3).addToPool() | 164 | filename="bar-1.0.whl", release_type=FakeReleaseType.BINARY, |
434 | 165 | release_id=3).addToPool() | ||
435 | 156 | self.assertEqual( | 166 | self.assertEqual( |
436 | 157 | { | 167 | { |
437 | 158 | PurePath("pool/f/foo/foo-1.0.deb"): { | 168 | PurePath("pool/f/foo/foo-1.0.deb"): { |
438 | 159 | "launchpad.release-id": ["binary:1"], | 169 | "launchpad.release-id": ["binary:1"], |
439 | 160 | "launchpad.source-name": ["foo"], | 170 | "launchpad.source-name": ["foo"], |
440 | 171 | "launchpad.source-version": ["1.0"], | ||
441 | 161 | }, | 172 | }, |
442 | 162 | PurePath("pool/f/foo/foo-1.1.deb"): { | 173 | PurePath("pool/f/foo/foo-1.1.deb"): { |
443 | 163 | "launchpad.release-id": ["binary:2"], | 174 | "launchpad.release-id": ["binary:2"], |
444 | 164 | "launchpad.source-name": ["foo"], | 175 | "launchpad.source-name": ["foo"], |
445 | 176 | "launchpad.source-version": ["1.1"], | ||
446 | 165 | }, | 177 | }, |
447 | 166 | }, | 178 | }, |
448 | 167 | self.pool.getAllArtifacts( | 179 | self.pool.getAllArtifacts( |
449 | @@ -171,6 +183,7 @@ class TestArtifactoryPool(TestCase): | |||
450 | 171 | PurePath("pool/b/bar/bar-1.0.whl"): { | 183 | PurePath("pool/b/bar/bar-1.0.whl"): { |
451 | 172 | "launchpad.release-id": ["binary:3"], | 184 | "launchpad.release-id": ["binary:3"], |
452 | 173 | "launchpad.source-name": ["bar"], | 185 | "launchpad.source-name": ["bar"], |
453 | 186 | "launchpad.source-version": ["1.0"], | ||
454 | 174 | }, | 187 | }, |
455 | 175 | }, | 188 | }, |
456 | 176 | self.pool.getAllArtifacts( | 189 | self.pool.getAllArtifacts( |
457 | @@ -199,7 +212,7 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
458 | 199 | spph = self.factory.makeSourcePackagePublishingHistory( | 212 | spph = self.factory.makeSourcePackagePublishingHistory( |
459 | 200 | archive=self.archive, distroseries=dses[0], | 213 | archive=self.archive, distroseries=dses[0], |
460 | 201 | pocket=PackagePublishingPocket.RELEASE, component="main", | 214 | pocket=PackagePublishingPocket.RELEASE, component="main", |
462 | 202 | sourcepackagename="foo") | 215 | sourcepackagename="foo", version="1.0") |
463 | 203 | spr = spph.sourcepackagerelease | 216 | spr = spph.sourcepackagerelease |
464 | 204 | sprf = self.factory.makeSourcePackageReleaseFile( | 217 | sprf = self.factory.makeSourcePackageReleaseFile( |
465 | 205 | sourcepackagerelease=spr, | 218 | sourcepackagerelease=spr, |
466 | @@ -210,7 +223,8 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
467 | 210 | spphs.append(spph.copyTo( | 223 | spphs.append(spph.copyTo( |
468 | 211 | dses[1], PackagePublishingPocket.RELEASE, self.archive)) | 224 | dses[1], PackagePublishingPocket.RELEASE, self.archive)) |
469 | 212 | transaction.commit() | 225 | transaction.commit() |
471 | 213 | self.pool.addFile(None, spr.name, sprf.libraryfile.filename, sprf) | 226 | self.pool.addFile( |
472 | 227 | None, spr.name, spr.version, sprf.libraryfile.filename, sprf) | ||
473 | 214 | path = self.pool.rootpath / "f" / "foo" / "foo_1.0.dsc" | 228 | path = self.pool.rootpath / "f" / "foo" / "foo_1.0.dsc" |
474 | 215 | self.assertTrue(path.exists()) | 229 | self.assertTrue(path.exists()) |
475 | 216 | self.assertFalse(path.is_symlink()) | 230 | self.assertFalse(path.is_symlink()) |
476 | @@ -218,13 +232,16 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
477 | 218 | { | 232 | { |
478 | 219 | "launchpad.release-id": ["source:%d" % spr.id], | 233 | "launchpad.release-id": ["source:%d" % spr.id], |
479 | 220 | "launchpad.source-name": ["foo"], | 234 | "launchpad.source-name": ["foo"], |
480 | 235 | "launchpad.source-version": ["1.0"], | ||
481 | 221 | }, | 236 | }, |
482 | 222 | path.properties) | 237 | path.properties) |
484 | 223 | self.pool.updateProperties(spr.name, sprf.libraryfile.filename, spphs) | 238 | self.pool.updateProperties( |
485 | 239 | spr.name, spr.version, sprf.libraryfile.filename, spphs) | ||
486 | 224 | self.assertEqual( | 240 | self.assertEqual( |
487 | 225 | { | 241 | { |
488 | 226 | "launchpad.release-id": ["source:%d" % spr.id], | 242 | "launchpad.release-id": ["source:%d" % spr.id], |
489 | 227 | "launchpad.source-name": ["foo"], | 243 | "launchpad.source-name": ["foo"], |
490 | 244 | "launchpad.source-version": ["1.0"], | ||
491 | 228 | "deb.distribution": list(sorted(ds.name for ds in dses)), | 245 | "deb.distribution": list(sorted(ds.name for ds in dses)), |
492 | 229 | "deb.component": ["main"], | 246 | "deb.component": ["main"], |
493 | 230 | }, | 247 | }, |
494 | @@ -240,10 +257,12 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
495 | 240 | self.factory.makeDistroArchSeries( | 257 | self.factory.makeDistroArchSeries( |
496 | 241 | distroseries=ds, architecturetag=processor.name) | 258 | distroseries=ds, architecturetag=processor.name) |
497 | 242 | for ds in dses] | 259 | for ds in dses] |
498 | 260 | spr = self.factory.makeSourcePackageRelease( | ||
499 | 261 | archive=self.archive, sourcepackagename="foo", version="1.0") | ||
500 | 243 | bpph = self.factory.makeBinaryPackagePublishingHistory( | 262 | bpph = self.factory.makeBinaryPackagePublishingHistory( |
501 | 244 | archive=self.archive, distroarchseries=dases[0], | 263 | archive=self.archive, distroarchseries=dases[0], |
502 | 245 | pocket=PackagePublishingPocket.RELEASE, component="main", | 264 | pocket=PackagePublishingPocket.RELEASE, component="main", |
504 | 246 | sourcepackagename="foo", binarypackagename="foo", | 265 | source_package_release=spr, binarypackagename="foo", |
505 | 247 | architecturespecific=True) | 266 | architecturespecific=True) |
506 | 248 | bpr = bpph.binarypackagerelease | 267 | bpr = bpph.binarypackagerelease |
507 | 249 | bpf = self.factory.makeBinaryPackageFile( | 268 | bpf = self.factory.makeBinaryPackageFile( |
508 | @@ -256,7 +275,8 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
509 | 256 | dses[1], PackagePublishingPocket.RELEASE, self.archive)[0]) | 275 | dses[1], PackagePublishingPocket.RELEASE, self.archive)[0]) |
510 | 257 | transaction.commit() | 276 | transaction.commit() |
511 | 258 | self.pool.addFile( | 277 | self.pool.addFile( |
513 | 259 | None, bpr.sourcepackagename, bpf.libraryfile.filename, bpf) | 278 | None, bpr.sourcepackagename, bpr.sourcepackageversion, |
514 | 279 | bpf.libraryfile.filename, bpf) | ||
515 | 260 | path = ( | 280 | path = ( |
516 | 261 | self.pool.rootpath / "f" / "foo" / | 281 | self.pool.rootpath / "f" / "foo" / |
517 | 262 | ("foo_1.0_%s.deb" % processor.name)) | 282 | ("foo_1.0_%s.deb" % processor.name)) |
518 | @@ -266,14 +286,17 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
519 | 266 | { | 286 | { |
520 | 267 | "launchpad.release-id": ["binary:%d" % bpr.id], | 287 | "launchpad.release-id": ["binary:%d" % bpr.id], |
521 | 268 | "launchpad.source-name": ["foo"], | 288 | "launchpad.source-name": ["foo"], |
522 | 289 | "launchpad.source-version": ["1.0"], | ||
523 | 269 | }, | 290 | }, |
524 | 270 | path.properties) | 291 | path.properties) |
525 | 271 | self.pool.updateProperties( | 292 | self.pool.updateProperties( |
527 | 272 | bpr.sourcepackagename, bpf.libraryfile.filename, bpphs) | 293 | bpr.sourcepackagename, bpr.sourcepackageversion, |
528 | 294 | bpf.libraryfile.filename, bpphs) | ||
529 | 273 | self.assertEqual( | 295 | self.assertEqual( |
530 | 274 | { | 296 | { |
531 | 275 | "launchpad.release-id": ["binary:%d" % bpr.id], | 297 | "launchpad.release-id": ["binary:%d" % bpr.id], |
532 | 276 | "launchpad.source-name": ["foo"], | 298 | "launchpad.source-name": ["foo"], |
533 | 299 | "launchpad.source-version": ["1.0"], | ||
534 | 277 | "deb.distribution": list(sorted(ds.name for ds in dses)), | 300 | "deb.distribution": list(sorted(ds.name for ds in dses)), |
535 | 278 | "deb.component": ["main"], | 301 | "deb.component": ["main"], |
536 | 279 | "deb.architecture": [processor.name], | 302 | "deb.architecture": [processor.name], |
537 | @@ -286,9 +309,11 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
538 | 286 | dases = [ | 309 | dases = [ |
539 | 287 | self.factory.makeDistroArchSeries(distroseries=ds) | 310 | self.factory.makeDistroArchSeries(distroseries=ds) |
540 | 288 | for _ in range(2)] | 311 | for _ in range(2)] |
541 | 312 | spr = self.factory.makeSourcePackageRelease( | ||
542 | 313 | archive=self.archive, sourcepackagename="foo", version="1.0") | ||
543 | 289 | bpb = self.factory.makeBinaryPackageBuild( | 314 | bpb = self.factory.makeBinaryPackageBuild( |
546 | 290 | archive=self.archive, distroarchseries=dases[0], | 315 | archive=self.archive, source_package_release=spr, |
547 | 291 | pocket=PackagePublishingPocket.RELEASE, sourcepackagename="foo") | 316 | distroarchseries=dases[0], pocket=PackagePublishingPocket.RELEASE) |
548 | 292 | bpr = self.factory.makeBinaryPackageRelease( | 317 | bpr = self.factory.makeBinaryPackageRelease( |
549 | 293 | binarypackagename="foo", build=bpb, component="main", | 318 | binarypackagename="foo", build=bpb, component="main", |
550 | 294 | architecturespecific=False) | 319 | architecturespecific=False) |
551 | @@ -302,7 +327,8 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
552 | 302 | {bpr: (bpr.component, bpr.section, bpr.priority, None)}) | 327 | {bpr: (bpr.component, bpr.section, bpr.priority, None)}) |
553 | 303 | transaction.commit() | 328 | transaction.commit() |
554 | 304 | self.pool.addFile( | 329 | self.pool.addFile( |
556 | 305 | None, bpr.sourcepackagename, bpf.libraryfile.filename, bpf) | 330 | None, bpr.sourcepackagename, bpr.sourcepackageversion, |
557 | 331 | bpf.libraryfile.filename, bpf) | ||
558 | 306 | path = self.pool.rootpath / "f" / "foo" / "foo_1.0_all.deb" | 332 | path = self.pool.rootpath / "f" / "foo" / "foo_1.0_all.deb" |
559 | 307 | self.assertTrue(path.exists()) | 333 | self.assertTrue(path.exists()) |
560 | 308 | self.assertFalse(path.is_symlink()) | 334 | self.assertFalse(path.is_symlink()) |
561 | @@ -310,14 +336,17 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
562 | 310 | { | 336 | { |
563 | 311 | "launchpad.release-id": ["binary:%d" % bpr.id], | 337 | "launchpad.release-id": ["binary:%d" % bpr.id], |
564 | 312 | "launchpad.source-name": ["foo"], | 338 | "launchpad.source-name": ["foo"], |
565 | 339 | "launchpad.source-version": ["1.0"], | ||
566 | 313 | }, | 340 | }, |
567 | 314 | path.properties) | 341 | path.properties) |
568 | 315 | self.pool.updateProperties( | 342 | self.pool.updateProperties( |
570 | 316 | bpr.sourcepackagename, bpf.libraryfile.filename, bpphs) | 343 | bpr.sourcepackagename, bpr.sourcepackageversion, |
571 | 344 | bpf.libraryfile.filename, bpphs) | ||
572 | 317 | self.assertEqual( | 345 | self.assertEqual( |
573 | 318 | { | 346 | { |
574 | 319 | "launchpad.release-id": ["binary:%d" % bpr.id], | 347 | "launchpad.release-id": ["binary:%d" % bpr.id], |
575 | 320 | "launchpad.source-name": ["foo"], | 348 | "launchpad.source-name": ["foo"], |
576 | 349 | "launchpad.source-version": ["1.0"], | ||
577 | 321 | "deb.distribution": [ds.name], | 350 | "deb.distribution": [ds.name], |
578 | 322 | "deb.component": ["main"], | 351 | "deb.component": ["main"], |
579 | 323 | "deb.architecture": list(sorted( | 352 | "deb.architecture": list(sorted( |
580 | @@ -331,9 +360,11 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
581 | 331 | ds = self.factory.makeDistroSeries( | 360 | ds = self.factory.makeDistroSeries( |
582 | 332 | distribution=self.archive.distribution) | 361 | distribution=self.archive.distribution) |
583 | 333 | das = self.factory.makeDistroArchSeries(distroseries=ds) | 362 | das = self.factory.makeDistroArchSeries(distroseries=ds) |
584 | 363 | spr = self.factory.makeSourcePackageRelease( | ||
585 | 364 | archive=self.archive, sourcepackagename="foo", version="1.0") | ||
586 | 334 | bpb = self.factory.makeBinaryPackageBuild( | 365 | bpb = self.factory.makeBinaryPackageBuild( |
589 | 335 | archive=self.archive, distroarchseries=das, | 366 | archive=self.archive, source_package_release=spr, |
590 | 336 | pocket=PackagePublishingPocket.RELEASE, sourcepackagename="foo") | 367 | distroarchseries=das, pocket=PackagePublishingPocket.RELEASE) |
591 | 337 | bpr = self.factory.makeBinaryPackageRelease( | 368 | bpr = self.factory.makeBinaryPackageRelease( |
592 | 338 | binarypackagename="foo", build=bpb, component="main", | 369 | binarypackagename="foo", build=bpb, component="main", |
593 | 339 | architecturespecific=False) | 370 | architecturespecific=False) |
594 | @@ -347,22 +378,26 @@ class TestArtifactoryPoolFromLibrarian(TestCaseWithFactory): | |||
595 | 347 | {bpr: (bpr.component, bpr.section, bpr.priority, None)}) | 378 | {bpr: (bpr.component, bpr.section, bpr.priority, None)}) |
596 | 348 | transaction.commit() | 379 | transaction.commit() |
597 | 349 | self.pool.addFile( | 380 | self.pool.addFile( |
599 | 350 | None, bpr.sourcepackagename, bpf.libraryfile.filename, bpf) | 381 | None, bpr.sourcepackagename, bpr.sourcepackageversion, |
600 | 382 | bpf.libraryfile.filename, bpf) | ||
601 | 351 | path = self.pool.rootpath / "f" / "foo" / "foo_1.0_all.deb" | 383 | path = self.pool.rootpath / "f" / "foo" / "foo_1.0_all.deb" |
602 | 352 | path.set_properties({"deb.version": ["1.0"]}, recursive=False) | 384 | path.set_properties({"deb.version": ["1.0"]}, recursive=False) |
603 | 353 | self.assertEqual( | 385 | self.assertEqual( |
604 | 354 | { | 386 | { |
605 | 355 | "launchpad.release-id": ["binary:%d" % bpr.id], | 387 | "launchpad.release-id": ["binary:%d" % bpr.id], |
606 | 356 | "launchpad.source-name": ["foo"], | 388 | "launchpad.source-name": ["foo"], |
607 | 389 | "launchpad.source-version": ["1.0"], | ||
608 | 357 | "deb.version": ["1.0"], | 390 | "deb.version": ["1.0"], |
609 | 358 | }, | 391 | }, |
610 | 359 | path.properties) | 392 | path.properties) |
611 | 360 | self.pool.updateProperties( | 393 | self.pool.updateProperties( |
613 | 361 | bpr.sourcepackagename, bpf.libraryfile.filename, bpphs) | 394 | bpr.sourcepackagename, bpr.sourcepackageversion, |
614 | 395 | bpf.libraryfile.filename, bpphs) | ||
615 | 362 | self.assertEqual( | 396 | self.assertEqual( |
616 | 363 | { | 397 | { |
617 | 364 | "launchpad.release-id": ["binary:%d" % bpr.id], | 398 | "launchpad.release-id": ["binary:%d" % bpr.id], |
618 | 365 | "launchpad.source-name": ["foo"], | 399 | "launchpad.source-name": ["foo"], |
619 | 400 | "launchpad.source-version": ["1.0"], | ||
620 | 366 | "deb.distribution": [ds.name], | 401 | "deb.distribution": [ds.name], |
621 | 367 | "deb.component": ["main"], | 402 | "deb.component": ["main"], |
622 | 368 | "deb.architecture": [das.architecturetag], | 403 | "deb.architecture": [das.architecturetag], |
623 | diff --git a/lib/lp/archivepublisher/tests/test_deathrow.py b/lib/lp/archivepublisher/tests/test_deathrow.py | |||
624 | index 10efb6f..9fd62e5 100644 | |||
625 | --- a/lib/lp/archivepublisher/tests/test_deathrow.py | |||
626 | +++ b/lib/lp/archivepublisher/tests/test_deathrow.py | |||
627 | @@ -53,6 +53,7 @@ class TestDeathRow(TestCase): | |||
628 | 53 | return diskpool.pathFor( | 53 | return diskpool.pathFor( |
629 | 54 | pub.component.name, | 54 | pub.component.name, |
630 | 55 | pub.source_package_name, | 55 | pub.source_package_name, |
631 | 56 | pub.source_package_version, | ||
632 | 56 | pub_file.libraryfile.filename) | 57 | pub_file.libraryfile.filename) |
633 | 57 | 58 | ||
634 | 58 | def assertIsFile(self, path: Path) -> None: | 59 | def assertIsFile(self, path: Path) -> None: |
635 | diff --git a/lib/lp/archivepublisher/tests/test_ftparchive.py b/lib/lp/archivepublisher/tests/test_ftparchive.py | |||
636 | index 9ea5778..9b407a7 100755 | |||
637 | --- a/lib/lp/archivepublisher/tests/test_ftparchive.py | |||
638 | +++ b/lib/lp/archivepublisher/tests/test_ftparchive.py | |||
639 | @@ -147,10 +147,11 @@ class TestFTPArchive(TestCaseWithFactory): | |||
640 | 147 | with open_func(path) as result_file: | 147 | with open_func(path) as result_file: |
641 | 148 | self.assertEqual(b"", result_file.read()) | 148 | self.assertEqual(b"", result_file.read()) |
642 | 149 | 149 | ||
645 | 150 | def _addRepositoryFile(self, component, sourcename, leafname, | 150 | def _addRepositoryFile(self, component, source_name, source_version, |
646 | 151 | samplename=None): | 151 | leafname, samplename=None): |
647 | 152 | """Create a repository file.""" | 152 | """Create a repository file.""" |
649 | 153 | fullpath = self._dp.pathFor(component, sourcename, leafname) | 153 | fullpath = self._dp.pathFor( |
650 | 154 | component, source_name, source_version, leafname) | ||
651 | 154 | fullpath.parent.mkdir(parents=True, exist_ok=True) | 155 | fullpath.parent.mkdir(parents=True, exist_ok=True) |
652 | 155 | if samplename is None: | 156 | if samplename is None: |
653 | 156 | samplename = leafname | 157 | samplename = leafname |
654 | @@ -515,9 +516,9 @@ class TestFTPArchive(TestCaseWithFactory): | |||
655 | 515 | self._publishDefaultFileLists(fa, 'main') | 516 | self._publishDefaultFileLists(fa, 'main') |
656 | 516 | 517 | ||
657 | 517 | # Add mentioned files in the repository pool/. | 518 | # Add mentioned files in the repository pool/. |
661 | 518 | self._addRepositoryFile('main', 'tiny', 'tiny_0.1.dsc') | 519 | self._addRepositoryFile('main', 'tiny', '0.1', 'tiny_0.1.dsc') |
662 | 519 | self._addRepositoryFile('main', 'tiny', 'tiny_0.1.tar.gz') | 520 | self._addRepositoryFile('main', 'tiny', '0.1', 'tiny_0.1.tar.gz') |
663 | 520 | self._addRepositoryFile('main', 'tiny', 'tiny_0.1_i386.deb') | 521 | self._addRepositoryFile('main', 'tiny', '0.1', 'tiny_0.1_i386.deb') |
664 | 521 | 522 | ||
665 | 522 | # When include_long_descriptions is set, apt.conf has | 523 | # When include_long_descriptions is set, apt.conf has |
666 | 523 | # LongDescription "true" for that series. | 524 | # LongDescription "true" for that series. |
667 | @@ -649,9 +650,9 @@ class TestFTPArchive(TestCaseWithFactory): | |||
668 | 649 | fa.createEmptyPocketRequests(fullpublish=True) | 650 | fa.createEmptyPocketRequests(fullpublish=True) |
669 | 650 | self._publishDefaultOverrides(fa, "main") | 651 | self._publishDefaultOverrides(fa, "main") |
670 | 651 | self._publishDefaultFileLists(fa, "main") | 652 | self._publishDefaultFileLists(fa, "main") |
674 | 652 | self._addRepositoryFile("main", "tiny", "tiny_0.1.dsc") | 653 | self._addRepositoryFile("main", "tiny", "0.1", "tiny_0.1.dsc") |
675 | 653 | self._addRepositoryFile("main", "tiny", "tiny_0.1.tar.gz") | 654 | self._addRepositoryFile("main", "tiny", "0.1", "tiny_0.1.tar.gz") |
676 | 654 | self._addRepositoryFile("main", "tiny", "tiny_0.1_i386.deb") | 655 | self._addRepositoryFile("main", "tiny", "0.1", "tiny_0.1_i386.deb") |
677 | 655 | comp_dir = os.path.join(self._distsdir, "hoary-test", "main") | 656 | comp_dir = os.path.join(self._distsdir, "hoary-test", "main") |
678 | 656 | os.makedirs(os.path.join(comp_dir, "signed")) | 657 | os.makedirs(os.path.join(comp_dir, "signed")) |
679 | 657 | with open(os.path.join(comp_dir, "signed", "stuff"), "w"): | 658 | with open(os.path.join(comp_dir, "signed", "stuff"), "w"): |
680 | @@ -778,10 +779,10 @@ class TestFTPArchive(TestCaseWithFactory): | |||
681 | 778 | fa.publishFileLists( | 779 | fa.publishFileLists( |
682 | 779 | self._distribution["hoary-test"], PackagePublishingPocket.RELEASE, | 780 | self._distribution["hoary-test"], PackagePublishingPocket.RELEASE, |
683 | 780 | source_files, binary_files) | 781 | source_files, binary_files) |
685 | 781 | self._addRepositoryFile("main", "tiny", "tiny_0.1.dsc") | 782 | self._addRepositoryFile("main", "tiny", "0.1", "tiny_0.1.dsc") |
686 | 782 | for i in range(50): | 783 | for i in range(50): |
687 | 783 | self._addRepositoryFile( | 784 | self._addRepositoryFile( |
689 | 784 | "main", "bin%d" % i, "bin%d_1_i386.deb" % i, | 785 | "main", "bin%d" % i, "1", "bin%d_1_i386.deb" % i, |
690 | 785 | samplename="tiny_0.1_i386.deb") | 786 | samplename="tiny_0.1_i386.deb") |
691 | 786 | apt_conf = fa.generateConfig(fullpublish=True) | 787 | apt_conf = fa.generateConfig(fullpublish=True) |
692 | 787 | fa.runApt(apt_conf) | 788 | fa.runApt(apt_conf) |
693 | @@ -790,7 +791,7 @@ class TestFTPArchive(TestCaseWithFactory): | |||
694 | 790 | # something to do. | 791 | # something to do. |
695 | 791 | for i in range(49): | 792 | for i in range(49): |
696 | 792 | self._dp.pathFor( | 793 | self._dp.pathFor( |
698 | 793 | "main", "bin%d" % i, "bin%d_1_i386.deb" % i).unlink() | 794 | "main", "bin%d" % i, "1", "bin%d_1_i386.deb" % i).unlink() |
699 | 794 | 795 | ||
700 | 795 | cache_path = os.path.join(self._config.cacheroot, "packages-i386.db") | 796 | cache_path = os.path.join(self._config.cacheroot, "packages-i386.db") |
701 | 796 | old_cache_size = os.stat(cache_path).st_size | 797 | old_cache_size = os.stat(cache_path).st_size |
702 | diff --git a/lib/lp/archivepublisher/tests/test_pool.py b/lib/lp/archivepublisher/tests/test_pool.py | |||
703 | index 4beeea5..97669ff 100644 | |||
704 | --- a/lib/lp/archivepublisher/tests/test_pool.py | |||
705 | +++ b/lib/lp/archivepublisher/tests/test_pool.py | |||
706 | @@ -83,30 +83,34 @@ class FakePackageReleaseFile: | |||
707 | 83 | 83 | ||
708 | 84 | class PoolTestingFile: | 84 | class PoolTestingFile: |
709 | 85 | 85 | ||
711 | 86 | def __init__(self, pool, sourcename, filename, | 86 | def __init__(self, pool, source_name, source_version, filename, |
712 | 87 | release_type=FakeReleaseType.BINARY, release_id=1): | 87 | release_type=FakeReleaseType.BINARY, release_id=1): |
713 | 88 | self.pool = pool | 88 | self.pool = pool |
715 | 89 | self.sourcename = sourcename | 89 | self.source_name = source_name |
716 | 90 | self.source_version = source_version | ||
717 | 90 | self.filename = filename | 91 | self.filename = filename |
719 | 91 | self.contents = sourcename.encode("UTF-8") | 92 | self.contents = source_name.encode("UTF-8") |
720 | 92 | self.release_type = release_type | 93 | self.release_type = release_type |
721 | 93 | self.release_id = release_id | 94 | self.release_id = release_id |
722 | 94 | 95 | ||
723 | 95 | def addToPool(self, component: str): | 96 | def addToPool(self, component: str): |
724 | 96 | return self.pool.addFile( | 97 | return self.pool.addFile( |
726 | 97 | component, self.sourcename, self.filename, | 98 | component, self.source_name, self.source_version, self.filename, |
727 | 98 | FakePackageReleaseFile( | 99 | FakePackageReleaseFile( |
728 | 99 | self.contents, self.release_type, self.release_id)) | 100 | self.contents, self.release_type, self.release_id)) |
729 | 100 | 101 | ||
730 | 101 | def removeFromPool(self, component: str) -> int: | 102 | def removeFromPool(self, component: str) -> int: |
732 | 102 | return self.pool.removeFile(component, self.sourcename, self.filename) | 103 | return self.pool.removeFile( |
733 | 104 | component, self.source_name, self.source_version, self.filename) | ||
734 | 103 | 105 | ||
735 | 104 | def checkExists(self, component: str) -> bool: | 106 | def checkExists(self, component: str) -> bool: |
737 | 105 | path = self.pool.pathFor(component, self.sourcename, self.filename) | 107 | path = self.pool.pathFor( |
738 | 108 | component, self.source_name, self.source_version, self.filename) | ||
739 | 106 | return path.exists() | 109 | return path.exists() |
740 | 107 | 110 | ||
741 | 108 | def checkIsLink(self, component: str) -> bool: | 111 | def checkIsLink(self, component: str) -> bool: |
743 | 109 | path = self.pool.pathFor(component, self.sourcename, self.filename) | 112 | path = self.pool.pathFor( |
744 | 113 | component, self.source_name, self.source_version, self.filename) | ||
745 | 110 | return path.is_symlink() | 114 | return path.is_symlink() |
746 | 111 | 115 | ||
747 | 112 | def checkIsFile(self, component: str) -> bool: | 116 | def checkIsFile(self, component: str) -> bool: |
748 | @@ -140,14 +144,18 @@ class TestPool(unittest.TestCase): | |||
749 | 140 | 144 | ||
750 | 141 | def testSimpleAdd(self): | 145 | def testSimpleAdd(self): |
751 | 142 | """Adding a new file should work.""" | 146 | """Adding a new file should work.""" |
753 | 143 | foo = PoolTestingFile(self.pool, "foo", "foo-1.0.deb") | 147 | foo = PoolTestingFile( |
754 | 148 | pool=self.pool, source_name="foo", source_version="1.0", | ||
755 | 149 | filename="foo-1.0.deb") | ||
756 | 144 | result = foo.addToPool("main") | 150 | result = foo.addToPool("main") |
757 | 145 | self.assertEqual(self.pool.results.FILE_ADDED, result) | 151 | self.assertEqual(self.pool.results.FILE_ADDED, result) |
758 | 146 | self.assertTrue(foo.checkIsFile("main")) | 152 | self.assertTrue(foo.checkIsFile("main")) |
759 | 147 | 153 | ||
760 | 148 | def testSimpleSymlink(self): | 154 | def testSimpleSymlink(self): |
761 | 149 | """Adding a file twice should result in a symlink.""" | 155 | """Adding a file twice should result in a symlink.""" |
763 | 150 | foo = PoolTestingFile(self.pool, "foo", "foo-1.0.deb") | 156 | foo = PoolTestingFile( |
764 | 157 | pool=self.pool, source_name="foo", source_version="1.0", | ||
765 | 158 | filename="foo-1.0.deb") | ||
766 | 151 | foo.addToPool("main") | 159 | foo.addToPool("main") |
767 | 152 | result = foo.addToPool("universe") | 160 | result = foo.addToPool("universe") |
768 | 153 | self.assertEqual(self.pool.results.SYMLINK_ADDED, result) | 161 | self.assertEqual(self.pool.results.SYMLINK_ADDED, result) |
769 | @@ -156,7 +164,9 @@ class TestPool(unittest.TestCase): | |||
770 | 156 | 164 | ||
771 | 157 | def testSymlinkShuffleOnAdd(self): | 165 | def testSymlinkShuffleOnAdd(self): |
772 | 158 | """If the second add is a more preferred component, links shuffle.""" | 166 | """If the second add is a more preferred component, links shuffle.""" |
774 | 159 | foo = PoolTestingFile(self.pool, "foo", "foo-1.0.deb") | 167 | foo = PoolTestingFile( |
775 | 168 | pool=self.pool, source_name="foo", source_version="1.0", | ||
776 | 169 | filename="foo-1.0.deb") | ||
777 | 160 | foo.addToPool("universe") | 170 | foo.addToPool("universe") |
778 | 161 | result = foo.addToPool("main") | 171 | result = foo.addToPool("main") |
779 | 162 | self.assertEqual(self.pool.results.SYMLINK_ADDED, result) | 172 | self.assertEqual(self.pool.results.SYMLINK_ADDED, result) |
780 | @@ -165,7 +175,9 @@ class TestPool(unittest.TestCase): | |||
781 | 165 | 175 | ||
782 | 166 | def testRemoveSymlink(self): | 176 | def testRemoveSymlink(self): |
783 | 167 | """Remove file should just remove a symlink""" | 177 | """Remove file should just remove a symlink""" |
785 | 168 | foo = PoolTestingFile(self.pool, "foo", "foo-1.0.deb") | 178 | foo = PoolTestingFile( |
786 | 179 | pool=self.pool, source_name="foo", source_version="1.0", | ||
787 | 180 | filename="foo-1.0.deb") | ||
788 | 169 | foo.addToPool("main") | 181 | foo.addToPool("main") |
789 | 170 | foo.addToPool("universe") | 182 | foo.addToPool("universe") |
790 | 171 | 183 | ||
791 | @@ -175,7 +187,9 @@ class TestPool(unittest.TestCase): | |||
792 | 175 | 187 | ||
793 | 176 | def testRemoveLoneFile(self): | 188 | def testRemoveLoneFile(self): |
794 | 177 | """Removing a file with no symlinks removes it.""" | 189 | """Removing a file with no symlinks removes it.""" |
796 | 178 | foo = PoolTestingFile(self.pool, "foo", "foo-1.0.deb") | 190 | foo = PoolTestingFile( |
797 | 191 | pool=self.pool, source_name="foo", source_version="1.0", | ||
798 | 192 | filename="foo-1.0.deb") | ||
799 | 179 | foo.addToPool("main") | 193 | foo.addToPool("main") |
800 | 180 | 194 | ||
801 | 181 | size = foo.removeFromPool("main") | 195 | size = foo.removeFromPool("main") |
802 | @@ -184,7 +198,9 @@ class TestPool(unittest.TestCase): | |||
803 | 184 | 198 | ||
804 | 185 | def testSymlinkShuffleOnRemove(self): | 199 | def testSymlinkShuffleOnRemove(self): |
805 | 186 | """Removing a file with a symlink shuffles links.""" | 200 | """Removing a file with a symlink shuffles links.""" |
807 | 187 | foo = PoolTestingFile(self.pool, "foo", "foo-1.0.deb") | 201 | foo = PoolTestingFile( |
808 | 202 | pool=self.pool, source_name="foo", source_version="1.0", | ||
809 | 203 | filename="foo-1.0.deb") | ||
810 | 188 | foo.addToPool("universe") | 204 | foo.addToPool("universe") |
811 | 189 | foo.addToPool("main") | 205 | foo.addToPool("main") |
812 | 190 | 206 | ||
813 | diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py | |||
814 | index f247242..a2cbb54 100644 | |||
815 | --- a/lib/lp/archivepublisher/tests/test_publisher.py | |||
816 | +++ b/lib/lp/archivepublisher/tests/test_publisher.py | |||
817 | @@ -3607,6 +3607,7 @@ class TestArtifactoryPublishing(TestPublisherBase): | |||
818 | 3607 | "launchpad.release-id": | 3607 | "launchpad.release-id": |
819 | 3608 | ["source:%d" % source.sourcepackagereleaseID], | 3608 | ["source:%d" % source.sourcepackagereleaseID], |
820 | 3609 | "launchpad.source-name": ["hello"], | 3609 | "launchpad.source-name": ["hello"], |
821 | 3610 | "launchpad.source-version": ["1.0"], | ||
822 | 3610 | }, | 3611 | }, |
823 | 3611 | source_path.properties) | 3612 | source_path.properties) |
824 | 3612 | binary_path = ( | 3613 | binary_path = ( |
825 | @@ -3620,6 +3621,7 @@ class TestArtifactoryPublishing(TestPublisherBase): | |||
826 | 3620 | "launchpad.release-id": | 3621 | "launchpad.release-id": |
827 | 3621 | ["binary:%d" % binary.binarypackagereleaseID], | 3622 | ["binary:%d" % binary.binarypackagereleaseID], |
828 | 3622 | "launchpad.source-name": ["hello"], | 3623 | "launchpad.source-name": ["hello"], |
829 | 3624 | "launchpad.source-version": ["1.0"], | ||
830 | 3623 | }, | 3625 | }, |
831 | 3624 | binary_path.properties) | 3626 | binary_path.properties) |
832 | 3625 | 3627 | ||
833 | @@ -3669,6 +3671,7 @@ class TestArtifactoryPublishing(TestPublisherBase): | |||
834 | 3669 | "launchpad.release-id": | 3671 | "launchpad.release-id": |
835 | 3670 | ["source:%d" % source.sourcepackagereleaseID], | 3672 | ["source:%d" % source.sourcepackagereleaseID], |
836 | 3671 | "launchpad.source-name": ["hello"], | 3673 | "launchpad.source-name": ["hello"], |
837 | 3674 | "launchpad.source-version": ["1.0"], | ||
838 | 3672 | }, | 3675 | }, |
839 | 3673 | source_path.properties) | 3676 | source_path.properties) |
840 | 3674 | self.assertEqual( | 3677 | self.assertEqual( |
841 | @@ -3679,6 +3682,7 @@ class TestArtifactoryPublishing(TestPublisherBase): | |||
842 | 3679 | "launchpad.release-id": | 3682 | "launchpad.release-id": |
843 | 3680 | ["binary:%d" % binary.binarypackagereleaseID], | 3683 | ["binary:%d" % binary.binarypackagereleaseID], |
844 | 3681 | "launchpad.source-name": ["hello"], | 3684 | "launchpad.source-name": ["hello"], |
845 | 3685 | "launchpad.source-version": ["1.0"], | ||
846 | 3682 | }, | 3686 | }, |
847 | 3683 | binary_path.properties) | 3687 | binary_path.properties) |
848 | 3684 | 3688 | ||
849 | @@ -3722,6 +3726,7 @@ class TestArtifactoryPublishing(TestPublisherBase): | |||
850 | 3722 | "launchpad.release-id": | 3726 | "launchpad.release-id": |
851 | 3723 | ["source:%d" % source.sourcepackagereleaseID], | 3727 | ["source:%d" % source.sourcepackagereleaseID], |
852 | 3724 | "launchpad.source-name": ["hello"], | 3728 | "launchpad.source-name": ["hello"], |
853 | 3729 | "launchpad.source-version": ["1.0"], | ||
854 | 3725 | }, | 3730 | }, |
855 | 3726 | source_path.properties) | 3731 | source_path.properties) |
856 | 3727 | self.assertEqual( | 3732 | self.assertEqual( |
857 | @@ -3729,6 +3734,7 @@ class TestArtifactoryPublishing(TestPublisherBase): | |||
858 | 3729 | "launchpad.release-id": | 3734 | "launchpad.release-id": |
859 | 3730 | ["binary:%d" % binary.binarypackagereleaseID], | 3735 | ["binary:%d" % binary.binarypackagereleaseID], |
860 | 3731 | "launchpad.source-name": ["hello"], | 3736 | "launchpad.source-name": ["hello"], |
861 | 3737 | "launchpad.source-version": ["1.0"], | ||
862 | 3732 | }, | 3738 | }, |
863 | 3733 | binary_path.properties) | 3739 | binary_path.properties) |
864 | 3734 | 3740 | ||
865 | diff --git a/lib/lp/soyuz/model/publishing.py b/lib/lp/soyuz/model/publishing.py | |||
866 | index b229c47..b17194e 100644 | |||
867 | --- a/lib/lp/soyuz/model/publishing.py | |||
868 | +++ b/lib/lp/soyuz/model/publishing.py | |||
869 | @@ -178,14 +178,16 @@ class ArchivePublisherBase: | |||
870 | 178 | """See `IPublishing`""" | 178 | """See `IPublishing`""" |
871 | 179 | try: | 179 | try: |
872 | 180 | for pub_file in self.files: | 180 | for pub_file in self.files: |
874 | 181 | source = self.source_package_name | 181 | source_name = self.source_package_name |
875 | 182 | source_version = self.source_package_version | ||
876 | 182 | component = ( | 183 | component = ( |
877 | 183 | None if self.component is None else self.component.name) | 184 | None if self.component is None else self.component.name) |
878 | 184 | filename = pub_file.libraryfile.filename | 185 | filename = pub_file.libraryfile.filename |
880 | 185 | path = diskpool.pathFor(component, source, filename) | 186 | path = diskpool.pathFor( |
881 | 187 | component, source_name, source_version, filename) | ||
882 | 186 | 188 | ||
883 | 187 | action = diskpool.addFile( | 189 | action = diskpool.addFile( |
885 | 188 | component, source, filename, pub_file) | 190 | component, source_name, source_version, filename, pub_file) |
886 | 189 | if action == diskpool.results.FILE_ADDED: | 191 | if action == diskpool.results.FILE_ADDED: |
887 | 190 | log.debug("Added %s from library" % path) | 192 | log.debug("Added %s from library" % path) |
888 | 191 | elif action == diskpool.results.SYMLINK_ADDED: | 193 | elif action == diskpool.results.SYMLINK_ADDED: |