jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.16k stars 1.07k forks source link

python package to rpm naming problems (underscore converted to hyphen) #1016

Open seiferteric opened 9 years ago

seiferteric commented 9 years ago

I am creating an rpm from a python package. It has python dependencies for which I am also building rpms for. Some of the dependencies I am having problems with are ndg_httpsclient and service-identity.

With ndg_httpsclient I get: python-ndg_httpsclient-0.4.0-1.noarch.rpm, but my rpm depends on python-ndg-httpsclient, not python-ndg_httpsclient.

Same issue with service-identity, I get python-service_identity-14.0.0-1.x86_64.rpm, but I depend on python-service-identity.

Stelminator commented 9 years ago

You can override the name and dependencies with flags. Probably also have to disable auto dependencies. Not fun, but addresses the problem.

Glandos commented 5 years ago

See pypa/setuptools#1597

Glandos commented 5 years ago

One workaround is to use unsafe_name instead of project_name in get_metadata.py WARNING! This works for me. You should double check this. I guess that FPM is also doing some sanity checks to names, but… I don't know every case.

Jayfrown commented 2 years ago

So is there any fix or workaround for this 6-year-old problem?

We have a setup where we build packages with normal hyphens (-) in the canonical name. For example, we build a package called importlib-metadata which refers to https://pypi.org/project/importlib-metadata/, however the output RPM is called importlib_metadata, while other RPMs that depend on this package, refer to importlib-metadata.

All I need is for the output RPMs to use the package name as I enter it, instead of converting - to _. How do I proceed, without hacking FPM core files?

$ fpm -s python --python-package-name-prefix python36 --python-bin python3.6 --python-install-lib /usr/lib/python3.6/site-packages --python-install-bin /usr/bin --python-scripts-executable /usr/bin/python3.6 --python-install-data /usr/lib/python3.6/site-packages -t rpm --rpm-os linux importlib-metadata==3.4.0
Created package {:path=>"python36-importlib_metadata-3.4.0-1.noarch.rpm"}
HMKnapp commented 7 months ago

My workaround for this is passing the module names from the dependency json in fpm --verbose output as --name for the dependency packages.

Note that prefix is ignored, so you’d provide the full package name. e.g. fpm ... --name python3-importlib-metadata importlib-metadata