Issue #7153
closedpackage import for same package and different version stores under different paths,
Description
steps to reproduce:
-
reqs export URL=$your_pulp_fqdn export REPO_NAME=buster-releases wget http://ftp.de.debian.org/debian/pool/main/j/jq/jq_1.5+dfsg-2+b1_amd64.deb wget http://ftp.de.debian.org/debian/pool/main/j/jq/jq_1.6-1_amd64.deb
-
create repo export REPO=$(http ${URL}/pulp/api/v3/repositories/deb/apt/ name=${REPO_NAME} | jq -r '.pulp_href')
-
create content from file http --form POST ${URL}/pulp/api/v3/content/deb/packages/ file@jq_1.5+dfsg-2+b1_amd64.deb repository=${REPO}
-
create publication http POST ${URL}/pulp/api/v3/publications/deb/apt/ repository=${REPO} simple=true export PUB=$pulp_href_from_task_above
-
host publication (create distribution) http POST ${URL}/pulp/api/v3/distributions/deb/apt/ name=${REPO_NAME} base_path=${REPO_NAME} publication=${PUB} export DISTR=$pulp_href_from_task_above
-
add same package different version http --form POST ${URL}/pulp/api/v3/content/deb/packages/ file@jq_1.6-1_amd64.deb repository=${REPO}
-
add publication from latest $REPO http POST ${URL}/pulp/api/v3/publications/deb/apt/ repository=${REPO} simple=true export PUB=$pulp_href_from_task_above
http PUT ${URL}${DISTR} name=${REPO_NAME} base_path=${REPO_NAME} publication=${PUB}
Expected result: both .debs are stored under single directory in ${URL}/pulp/content/buster-releases/pool/all/j/jq, similar to what official debian repos do, i.e: http://ftp.de.debian.org/debian/pool/main/j/jq/
Actual Result: package with same name stored in different paths. i.e: jq (1.5+dfsg-2)/ jq/
Additionally, when trying to download .deb for "jq (1.5+dfsg-2)", pulp throws 500 with following exception:
Jul 16 06:27:21 FQDN gunicorn[10752]: [2020-07-16 06:27:21 +0000] [10759] [ERROR] Error handling request
Jul 16 06:27:21 FQDN gunicorn[10752]: Traceback (most recent call last):
Jul 16 06:27:21 FQDN gunicorn[10752]: File "/usr/local/lib/pulp/lib/python3.7/site-packages/pulpcore/content/handler.py", line 365, in _match_and_stream
Jul 16 06:27:21 FQDN gunicorn[10752]: publication.published_artifact.get(relative_path=index_path)
Jul 16 06:27:21 FQDN gunicorn[10752]: File "/usr/local/lib/pulp/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager_method
Jul 16 06:27:21 FQDN gunicorn[10752]: return getattr(self.get_queryset(), name)(*args, **kwargs)
Jul 16 06:27:21 FQDN gunicorn[10752]: File "/usr/local/lib/pulp/lib/python3.7/site-packages/django/db/models/query.py", line 408, in get
Jul 16 06:27:21 FQDN gunicorn[10752]: self.model._meta.object_name
Jul 16 06:27:21 FQDN gunicorn[10752]: pulpcore.app.models.publication.PublishedArtifact.DoesNotExist: PublishedArtifact matching query does not exist.
Jul 16 06:27:21 FQDN gunicorn[10752]: During handling of the above exception, another exception occurred:
Jul 16 06:27:21 FQDN gunicorn[10752]: Traceback (most recent call last):
Jul 16 06:27:21 FQDN gunicorn[10752]: File "/usr/local/lib/pulp/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
Jul 16 06:27:21 FQDN gunicorn[10752]: resp = await task
Jul 16 06:27:21 FQDN gunicorn[10752]: File "/usr/local/lib/pulp/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
Jul 16 06:27:21 FQDN gunicorn[10752]: resp = await handler(request)
Jul 16 06:27:21 FQDN gunicorn[10752]: File "/usr/local/lib/pulp/lib/python3.7/site-packages/pulpcore/content/handler.py", line 137, in stream_content
Jul 16 06:27:21 FQDN gunicorn[10752]: return await self._match_and_stream(path, request)
Jul 16 06:27:21 FQDN gunicorn[10752]: File "/usr/local/lib/pulp/lib/python3.7/site-packages/pulpcore/content/handler.py", line 369, in _match_and_stream
Jul 16 06:27:21 FQDN gunicorn[10752]: dir_list = await self.list_directory(None, publication, rel_path)
Jul 16 06:27:21 FQDN gunicorn[10752]: File "/usr/local/lib/pulp/lib/python3.7/site-packages/pulpcore/content/handler.py", line 291, in list_directory
Jul 16 06:27:21 FQDN gunicorn[10752]: directory_list.add(file_or_directory_name(path, pa.relative_path))
Jul 16 06:27:21 FQDN gunicorn[10752]: File "/usr/local/lib/pulp/lib/python3.7/site-packages/pulpcore/content/handler.py", line 284, in file_or_directory_name
Jul 16 06:27:21 FQDN gunicorn[10752]: return "{}{}".format(result.groups()[1], result.groups()[2])
Jul 16 06:27:21 FQDN gunicorn[10752]: AttributeError: 'NoneType' object has no attribute 'groups'
Running: "component": "pulpcore", "version": "3.5.0" "component": "pulp_deb", "version": "2.5.0b1.dev0"
Fix relative path of packages
fixes #7153 https://pulp.plan.io/issues/7153