Rename rpm package

Problem:

I’ve added rpm to repository with incorrect name some time ago. It contains directory name in front of it. Sth like this:
location_href": “mydirectory/myrpm.x86_64.rpm”

Since them some new rpms were added to that repo (so also new repo versions were created as a result)

Now I’d like to rename that rpm (get rid of that directory name in front) so it looks like this:
location_href": “myrpm.x86_64.rpm”

Is there a way to do it?

Expected outcome:

Pulpcore version:
“3.20.0”
Pulp plugins installed and their versions:
{
“component”: “rpm”,
“version”: “3.17.12”,
“package”: “pulp-rpm”
},
{
“component”: “file”,
“version”: “1.11.1”,
“package”: “pulp-file”
}
Operating system - distribution and version:
Red Hat Enterprise Linux Server release 7.9 (Maipo)
Other relevant data:

After some reading it seems there’s no way to simply rename it. I guess I have to remove all repo versions that have that rpm. Is it required to remove all publications that are using that repo versions first? Is anything else required?

What issues does this lead to? Is it not possible to create a new RPM with a different name, add it to the repo, and remove the old one?

Hi dralley,
this is exactly what I’ve done. But it’s still sort of workaround, cause that artifact and rpm content is still present in pulp. It’s just not not present in the current repo version. If I’d like to clean things up what are the right steps?

This is a feature of Pulp, in so far as, previous repository versions are immutable (out side of deletion).

If you want that package remove entirely, you’ll have to remove all previous versions of a repository (which, is liable to be fine), and then purge orphaned content.

Currently, that isn’t provided in a simple CLI utility, and you’d need to work through the logic your self.

There have been discussions relating to removing poisoned files, that say have a security vulnerability, however, at least when I last looked at that discussion the repository versions were liable to be “unmodified” and just the content under the hood would be archived, with effectively a 404 being presented when the content is requested.

3 Likes

Keep in mind that if the artifact is the same as other packages, it will only be stored once. So if the only difference is the name having a path in it, you wouldn’t be loosing anything really.

But as wibbit said, if you delete the older repository versions containing the content you want to get rid of then it will become “orphaned” and then orphan cleanup can deal with it.

1 Like

Thanks wibbit, dralley. One more thing is not quite clear is the "base_version" parameter of repo version. In the below example if I get rid of version 237 would I loose also version 238 (currently the latest one) because it is the base version of it. What does that base_version mean?

 {
    "pulp_href": "/pulp/api/v3/repositories/rpm/rpm/3366909f-1ab4-4e12-881c-88f8f85ca1e2/versions/238/",
    "pulp_created": "2022-11-08T11:32:16.292710Z",
    "number": 238,
    "repository": "/pulp/api/v3/repositories/rpm/rpm/3366909f-1ab4-4e12-881c-88f8f85ca1e2/",
    "base_version": "/pulp/api/v3/repositories/rpm/rpm/3366909f-1ab4-4e12-881c-88f8f85ca1e2/versions/237/",
    "content_summary": {
      "added": {},
      "removed": {
        "rpm.package": {
          "count": 1,
          "href": "/pulp/api/v3/content/rpm/packages/?repository_version_removed=/pulp/api/v3/repositories/rpm/rpm/3366909f-1ab4-4e12-881c-88f8f85ca1e2/versions/238/"
        }
      },
      "present": {
        "rpm.package": {
          "count": 182,
          "href": "/pulp/api/v3/content/rpm/packages/?repository_version=/pulp/api/v3/repositories/rpm/rpm/3366909f-1ab4-4e12-881c-88f8f85ca1e2/versions/238/"
        }
      }
    }
  },

It’s only used at creation time. Essentially if you pick an old base_version and add or remove some content to it, it will create a repository version as if that older version was the newest one. If you then delete the base version it shouldn’t do anything because the repository version has already been created.

1 Like