This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Generate rpm filelist including directories
Type: Stage:
Components: Distutils Versions: Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: loewis Nosy List: akitada, loewis, nijel, tarek, terry.reedy
Priority: normal Keywords: patch

Created on 2003-06-16 12:57 by nijel, last changed 2022-04-10 16:09 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-distutils-rpm.patch nijel, 2003-06-16 12:57
python-distutils-rpm-2.patch nijel, 2003-06-16 13:49
python-distutils-rpm-3.patch nijel, 2003-06-16 15:37
python-distutils-rpm-4.patch nijel, 2003-06-17 08:36
python-distutils-rpm-5.patch nijel, 2003-06-17 15:53
python-distutils-rpm-6.patch nijel, 2003-06-24 14:18
python-distutils-rpm-7.patch nijel, 2004-11-23 16:18
python-distutils-rpm-8.patch nijel, 2004-11-29 10:43
Messages (25)
msg44007 - (view) Author: Michal Čihař (nijel) * Date: 2003-06-16 12:57
Attached patch adds --record-rpm option to distutils,
that allows generating of rpm-like filelist, that
contains also directories. Currently most rpm vendors
are using some external commands to get dir list or
have hard coded it in spec file.
msg44008 - (view) Author: Michal Čihař (nijel) * Date: 2003-06-16 13:49
Logged In: YES 
user_id=192186

Updated version fixes problems with self defined get_outputs
methods.
msg44009 - (view) Author: Michal Čihař (nijel) * Date: 2003-06-16 15:37
Logged In: YES 
user_id=192186

One more update:
- fix generating of dirs in chrooted installs for install_data
- don't include directory for install_scripts
msg44010 - (view) Author: Michal Čihař (nijel) * Date: 2003-06-17 08:36
Logged In: YES 
user_id=192186

Version 4 improves handling of mutliple levels of install
directories.
msg44011 - (view) Author: Michal Čihař (nijel) * Date: 2003-06-17 15:53
Logged In: YES 
user_id=192186

Sorry for posting buch of patches here, but I test it with
more and more modules and I find more and more problems :-)
msg44012 - (view) Author: Michal Čihař (nijel) * Date: 2003-06-24 14:18
Logged In: YES 
user_id=192186

Version 6 now works as expected for all python packages
using distutils in SuSE distro.
msg44013 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-02-01 19:40
Logged In: YES 
user_id=21627

I like the feature, but not the implementation:

- The option should not be called "record-rpm", as it does
not record
  RPM files, but directories.

- RPM-specific code should be completely restricted to the
bdist_rpm 
  command. For the case of directories, you should create a
mechanism
  to collect all directories, and then traverse this list to
create the 
  proper %dir directives in the spec file.

- I'm not sure that overloading get_outputs is a good idea.
Instead,
  introducing get_output_dirs might be better.

msg44014 - (view) Author: Michal Čihař (nijel) * Date: 2004-02-02 18:35
Logged In: YES 
user_id=192186

I agree, that the implementation is not perfect. It's mostly
quick hack, that needed to be written to avoid
postprocessing of generated file lists. I'm open to rewrite
it when somebody gives me better idea for implementation,
but probably I won't have time for this in next month.

Why I called it record-rpm - it does same as record, but
adds directories needed for rpm.

Limiting to bdist_rpm is IMHO not good idea, as in this case
it is not usable for distribution vendors (bdist_rpm is not
suitable for this case, at least as I see situation in SUSE).

I choose overloading get_outputs just to avoid code
duplication in many cases.
msg44015 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-02-02 21:15
Logged In: YES 
user_id=21627

We are not much interested in quick hacks. Are you willing
to revise your implementation to make it well-designed? If
not, I'll reject it (and hope that somebody else will submit
a well-designed implementation of that feature in the future).
msg44016 - (view) Author: Michal Čihař (nijel) * Date: 2004-02-02 21:21
Logged In: YES 
user_id=192186

It would be probably best, if somebody with more knowledge,
how distutils work, would help with design.
msg44017 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-02-02 21:35
Logged In: YES 
user_id=21627

I can pose a few principles: put RPM-specific code just into
bdist_rpm, and enhance other commands to provide generic
functionality which might be usable only to RPM at the
moment, but could be useful more generally in the future.

Also, make sure all commands continue to work if no RPMs are
built (e.g. the standard "install" command should continue
to work).

I think you code is quite close algorithmically, it just
needs to be re-arranged  a bit.
msg44018 - (view) Author: Michal Čihař (nijel) * Date: 2004-02-02 21:42
Logged In: YES 
user_id=192186

I still do not see how to put that into bdist_rpm and keep
it usable:

- bdist_rpm creates tarbal and then calls rpm which builds
it and the installation itself is done by install

- when building package for distribution (SUSE) bdist_rpm is
not used at all
msg44019 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-02-02 22:00
Logged In: YES 
user_id=21627

Then I don't understand how your patch works: Does it not
generate %dir lines for the .spec file? And isn't the spec
file generated by the bdist_rpm command?
msg44020 - (view) Author: Michal Čihař (nijel) * Date: 2004-02-02 22:04
Logged In: YES 
user_id=192186

It does extend --record with directory entries. This
resulting file is then used by rpm:

%install
python setup.py install --root=$RPM_BUILD_ROOT
--record-rpm=INSTALLED_FILES

%files -f INSTALLED_FILES
%defattr(-,root,root)
msg44021 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-02-02 22:20
Logged In: YES 
user_id=21627

I see. Wouldn't it better if the bdist_rpm command would
generate a .spec file that completely contains all
directives? Then, this could be enhanced to make use of more
features of RPMs, such as %doc, %docdir, %verify, etc.

It would also allow to keep RPM specifics out of the install
command.
msg44022 - (view) Author: Michal Čihař (nijel) * Date: 2004-02-03 18:50
Logged In: YES 
user_id=192186

As I said bdist_rpm is not suitable for building packages in
distribution - all packages are built same way using spec
file and sources (+patches). And this building packages for
distribution (I work for SUSE) is main goal why I did this.
msg44023 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-02-04 21:19
Logged In: YES 
user_id=21627

It is unfortunate that bdist_rpm is not useful to generate
RPMs for distribution, because this is the primary purpose
of that command: generating RPMs. So if the command does not
meet your needs, we should change it to make it meet your
needs. E.g. would it help if bdist_rpm would generate the
.spec file for you?
msg44024 - (view) Author: Michal Čihař (nijel) * Date: 2004-02-04 21:33
Logged In: YES 
user_id=192186

It's pripary purpose is IMHO to allow building of rpms when
you distribute some python stuff. It is good for this case.

The problem for distributions, is that all packages need to
be handled same way (in case they use some automatically
building system), so you can not differ whether it is
packaged some python stuff or kernel. So separate spec file
and sources is the only solution. Generating spec file
doesn't help much as it can get changed every version and
vendor has own additional information in spec file, which
would require hand merging.

Another idea I just got is to generate just file list using
separate bdist_rpm and use it separately, but I'm not sure
whether it is doable - information about file list is not
probably available there, is it?

It would be used like:

python setup.py install --root=$RPM_BUILD_ROOT
python setup.py bdist_rpm --filelist=INSTALLED_FILES
msg44025 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-02-04 22:07
Logged In: YES 
user_id=21627

This might work. bdist_rpm would have to invoke the install
command, but only to compute the file list, instead of
actually performing copying.
msg44026 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-02-04 22:09
Logged In: YES 
user_id=21627

Alternatively, adding --record-dirs to the install command
would be acceptable as well, so you could post-process the
directory list, e.g. with awk.
msg44027 - (view) Author: Michal Čihař (nijel) * Date: 2004-11-23 16:18
Logged In: YES 
user_id=192186

After long delay I finally found time to look at this.

I decided to go other way that doesn't need soo much
modifications. Instead of adding directories during copying
and messing all the code, it now just postproceses filelist
and generates directory list out of that. This leads to much
smaller patch and need to modify just one file. I'd like to
hear comments from you.

I currently tested just few packages and I'll give it more
testing in next days.

Patch is against 2.4c1.
msg44028 - (view) Author: Michal Čihař (nijel) * Date: 2004-11-29 10:43
Logged In: YES 
user_id=192186

Here is a bit updated version, only thing that has changed
is list of directories not beeing included in output.
msg81558 - (view) Author: Akira Kitada (akitada) * Date: 2009-02-10 16:45
Duplicate of issue1035576
msg108663 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-06-26 00:45
This appears to be a feature request. That would normally now mean this issue is applicable to 3.2 only. Or is the rule different for disutils?

Should #755286 and #1035576 both remain open?

Tarek, does distutils2 work supercede these?

Nijel, could at least some of the earlier versions of the patch be removed (people normally do this when submitting better versions)?
msg108760 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-06-27 00:07
See Tarek's message on #1035576.
History
Date User Action Args
2022-04-10 16:09:15adminsetgithub: 38658
2010-06-27 00:07:52terry.reedysetstatus: open -> closed
resolution: wont fix
messages: + msg108760
2010-06-26 00:45:02terry.reedysetnosy: + terry.reedy

messages: + msg108663
versions: + Python 2.7, - Python 2.5
2009-02-10 16:45:14akitadasetnosy: + tarek, akitada
messages: + msg81558
2003-06-16 12:57:18nijelcreate