classification
Title: bdist_rpm fails when installing man pages
Type: behavior Stage: patch review
Components: Distutils Versions: Python 3.5, Python 3.4, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: a.badger, akitada, calvin, eric.araujo, jjulian, tarek, thomasvs
Priority: normal Keywords: patch

Created on 2002-11-27 14:30 by calvin, last changed 2014-07-18 21:52 by BreamoreBoy.

Files
File name Uploaded Description Edit
rpm_patch_for_setup_py calvin, 2002-11-27 14:30 patch for setup.py to enable man pages with bdist_rpm
install-rpm.sh calvin, 2004-09-10 12:10
distutils.bdist_rpm.patch thomasvs, 2009-11-23 09:42
Messages (14)
msg13472 - (view) Author: Bastian Kleineidam (calvin) Date: 2002-11-27 14:30
When a man page is in data_files, the rpm installer
compresses it with gzip (done by the brp-compress
script). I attached a little hack for
install_data command to add a ".gz" to such man pages.
Then it works for me.

Of course, the proper fix would be to detect if
brp-compress is run and what files were compressed by
the script. But I am not an rpm guru, so its up to you
how you want to fix it.

I am using a Debian Linux unstable boxen with Python
2.2.2-2, and rpm 4.0.4-11
msg13473 - (view) Author: Bastian Kleineidam (calvin) Date: 2004-09-10 12:10
Logged In: YES 
user_id=9205

Finally I got around to investigate this a little more. What
essentially happens is this:
1) bdist_rpm generates a .spec file with the following
install command:
python setup.py install --root=$RPM_BUILD_ROOT
--record=INSTALLED_FILES
.. and the following files section
%files -f INSTALLED_FILES

2) if the setup.py installed any man pages, then after
%install and before %files rpm runs brp-compress (usually
found in /usr/lib/rpm/brp-compress) which compresses all man
pages with gzip.

3) Now the man pages have a '.gz' suffix, but the
INSTALLED_FILES file lists them still without the suffix.
The %files section of the rpm .spec file will fail.

The solution in my case was to use a custom rpm-install
script configured with setup.cfg:
[bdist_rpm]
install_script = install-rpm.sh
The install-rpm.sh file is attached.

The solution is not very generic - brp-compress compresses a
lot more files than the install-rpm.sh detects. But at least
there should be a documentation somewhere about the
brp-compress pitfall.
msg81561 - (view) Author: Akira Kitada (akitada) Date: 2009-02-10 16:49
Duplicate of issue1169193
msg95616 - (view) Author: Thomas Vander Stichele (thomasvs) Date: 2009-11-23 09:42
Attaching a reworked patch of the patch attached in
http://bugs.python.org/issue1169193

This worked for me on f-11, with python 2.6
msg95619 - (view) Author: Tarek Ziadé (tarek) * (Python committer) Date: 2009-11-23 11:53
I'd rather see sed called from within Distutils. But I am not sure how
to handle it after install has been called.

Do you know if sed is *always* present on a fresh Fedora ?

(I am nosying Toshio as well)
msg95643 - (view) Author: Toshio Kuratomi (a.badger) * Date: 2009-11-23 18:42
sed is one of the programs we assume is always present when we build
packages in Fedora which is probably also what is wanted here.  (A
default install of Fedora will include sed but someone might be able to
create a minimal install that did not include it.) Note that within
Fedora we usually use a wildcard with man pages.  For example::

  %{_mandir}/man1/foo.1*

I'd suggest doing this rather than hardcoding ".gz".  Automatic
compression of manpages could be disabled on other distros, set to
bzip2, compress, or xz instead.  Wildcarding the suffix will catch all
of these cases and be more future-proof.
msg95648 - (view) Author: Thomas Vander Stichele (thomasvs) Date: 2009-11-23 19:25
Hi Toshio,

I'd probably also go for the wildcarding, but you'd still need to
'change' the INSTALLED_FILES file to do so, so you'd still use the same
mechanism.
msg95654 - (view) Author: Toshio Kuratomi (a.badger) * Date: 2009-11-23 20:12
Agreed.  The substitution is still needed.
msg95795 - (view) Author: Thomas Vander Stichele (thomasvs) Date: 2009-11-28 17:01
Ok, so this patch can go in as is except for changing .gz to * ?
msg99868 - (view) Author: Toshio Kuratomi (a.badger) * Date: 2010-02-22 23:21
Correct.
msg107247 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-06-06 22:37
Distutils is frozen, since changing even internal details breaks third-party tools, and Distutils2 has removed RPM support, since it’s better handled by OS-specific tools that comply with various policies and have smaller release cycles. Tarek, are you closing this bug?
msg107898 - (view) Author: Thomas Vander Stichele (thomasvs) Date: 2010-06-15 22:44
What do you mean, it's frozen ? Without the patch you're already breaking a third party tool, namely rpm.  What other tool worth caring about that uses bdist_rpm could possibly get broken by fixing an obvious bug ? Why is it so impossible to simply fix a bug for a feature that people are trying to use and are baffled by having it not working ?
msg114189 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-17 22:38
Anyone got a reply for msg107898?
msg120997 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010-11-12 00:39
Thomas, sorry if my message was short and unclear.  The freeze policy means that distutils does not get new features, only bug fixes.  The goal is to free time so that the developers (especially Tarek) can work on distutils2, the next generation.  When I said that “changing even internal details breaks third-party tools”, I was talking about tools written in Python that use distutils as a library; they rely on implementation details, internal functions and old bugs, which means distutils can’t get the changes we need to significantly improve the state of Python packaging.  That’s why Tarek has started distutils2, where compatibility can be broken to fix design mistakes and add disruptive new features.

Like I said, we’ve removed bdist_rpm in distutils2; it now lives as an external project: https://pypi.python.org/pypi/pypi2rpm/0.3 .  When distutils2 is merged back into the standard library, bdist_rpm2 can have shorter release cycles to comply with policy changes on rpm-based systems.

In this case, the freeze does not apply: This bug should be fixed in distutils.  Can you update your patch to address Toshio’s remarks?  Thanks.
History
Date User Action Args
2014-07-18 21:52:35BreamoreBoysetversions: + Python 3.4, Python 3.5, - Python 3.1, Python 3.2
2010-11-12 00:39:51eric.araujosetnosy: - BreamoreBoy
messages: + msg120997

assignee: tarek -> eric.araujo
stage: patch review
2010-08-17 22:38:53BreamoreBoysetnosy: + BreamoreBoy

messages: + msg114189
versions: - Python 2.6
2010-06-15 22:44:21thomasvssetmessages: + msg107898
2010-06-06 22:37:15eric.araujosetnosy: + eric.araujo
messages: + msg107247
2010-02-22 23:21:37a.badgersetmessages: + msg99868
2010-01-09 03:24:00jjuliansetnosy: + jjulian
2009-11-28 17:01:33thomasvssetmessages: + msg95795
2009-11-23 20:12:16a.badgersetmessages: + msg95654
2009-11-23 19:25:43thomasvssetmessages: + msg95648
2009-11-23 18:42:32a.badgersetmessages: + msg95643
2009-11-23 11:53:40tareksetnosy: + a.badger
versions: + Python 2.6, Python 3.1, Python 2.7, Python 3.2
messages: + msg95619

assignee: tarek
type: behavior
2009-11-23 09:42:42thomasvssetfiles: + distutils.bdist_rpm.patch

nosy: + thomasvs
messages: + msg95616

keywords: + patch
2009-04-05 18:41:36georg.brandllinkissue1169193 superseder
2009-02-10 16:49:13akitadasetnosy: + akitada, tarek
messages: + msg81561
2002-11-27 14:30:55calvincreate