building rpm fails

Bug #1784418 reported by fizikz
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Caffeine
Fix Released
Undecided
Unassigned

Bug Description

"python3 setup.py bdist_rpm" fails on Fedora 28. Have I missed something?

The tarball from https://bazaar.launchpad.net/~caffeine-developers/caffeine/main/revision/666?start_revid=666 was downloaded, and extracted, and the above command was run in "[DIR]/~caffeine-developers/caffeine/main/".

The build seems to fail due to a missing VERSION file in the nested "build" directory, even though the file exist in the parent "main" directory. Perhaps it was meant to be created in the building process?

Below is the output with the errors:

Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.tnl3IZ
+ umask 022
+ cd [DIR]/~caffeine-developers/caffeine/main/build/bdist.linux-x86_64/rpm/BUILD
+ cd caffeine-2.9.4
+ python3 setup.py build
Traceback (most recent call last):
  File "setup.py", line 12, in <module>
    VERSION = open(join(ROOT_DIR, "VERSION")).read().strip()
FileNotFoundError: [Errno 2] No such file or directory: '[DIR]/~caffeine-developers/caffeine/main/build/bdist.linux-x86_64/rpm/BUILD/caffeine-2.9.4/VERSION'
error: Bad exit status from /var/tmp/rpm-tmp.tnl3IZ (%build)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.tnl3IZ (%build)
error: command 'rpmbuild' failed with exit status 1

Revision history for this message
Reuben Thomas (rrt) wrote :

I don't know much about building RPMs, and last tried nearly fifteen years ago. If there's a problem in caffeine's build system, I'll happily accept patches.

Revision history for this message
fizikz (fizikz) wrote :

Unfortunately I'm not familiar with building packages or setup.py. I used "python3 setup.py --help-commands" to find that setup.py provides options for building binary distributions, including RPM distributions with the bdist_rpm option.

The attached image shows that the build directory created by the building process duplicates many of the files/directories from the caffeine source, but is missing the VERSION file.

I don't mind testing if there are suggestions for a solution.

Revision history for this message
Reuben Thomas (rrt) wrote :

This error is fixed with 676; of course, whether it now builds a useful RPM is another matter; I've not tested it!

Changed in caffeine:
status: New → Fix Released
Revision history for this message
fizikz (fizikz) wrote :

679 builds an RPM successfully. While the package installs, it does not work and as it seems not to specify dependencies:

$ caffeine --version
Traceback (most recent call last):
  File "/usr/bin/caffeine", line 29, in <module>
    from ewmh import EWMH
ModuleNotFoundError: No module named 'ewmh'

Calling the version works after installing: perl-HTML-Tree perl-IO-stringy perl-Net-DBus perl-Time-HiRes perl-XML-Twig python3-ewmh

However, it still fails to run:

$ caffeine-indicator
Traceback (most recent call last):
  File "/usr/bin/caffeine-indicator", line 32, in <module>
    gi.require_version('AyatanaAppIndicator3', '0.1')
  File "/usr/lib64/python3.8/site-packages/gi/__init__.py", line 129, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace AyatanaAppIndicator3 not available

I'm not sure if the library AyatanaAppIndicator3 is available in Fedora repos.

Revision history for this message
Reuben Thomas (rrt) wrote :

For the dependencies, see debian/control. These will need to be specified in a setup.cfg file. Happy to accept a patch that does that. (No idea why you needed to install those Perl modules; you should need only xdg-utils, and I don't think it depends on any of those!)

Revision history for this message
fizikz (fizikz) wrote :

I did not test installing those packages individually, but installed the full list since the caffeine-indicator package built in the RPM Sphere repo requires them when it is installed: https://rpmsphere.github.io/ I don't know if they are truly needed.

Out of the dependencies in /debian/control ( gir1.2-gtk-3.0, gir1.2-ayatanaappindicator3-0.1,
 python3-xlib, python3-pkg-resources, python3-gi, python3-ewmh, xdg-utils (>= 1.1.1) ), I have not found matching packages in Fedora for gir1.2-gtk-3.0, gir1.2-ayatanaappindicator3-0.1, python3-pkg-resources, python3-gi

Revision history for this message
Reuben Thomas (rrt) wrote :

I'm sorry, I don't use any RPM-based or Fedora-like systems, and I don't really have the bandwidth to help with the details of downstream packaging! You can see what the Python-level deps are; it's up to you to translate those for the system you want to package for. The fact that caffeine includes Debian packaging should make that easier. Closing this bug now, but as I said, very happy to accept a `setup.cfg` file if you come up with one to make life easier for future RPM packagers. Good luck!

Revision history for this message
fizikz (fizikz) wrote :

Ok. Thanks for fixing the RPM build failure.

Revision history for this message
Andrej Shadura (andrew.sh) wrote :

The fix for this bug apparently leads to some files being installed directly in /usr rather than in a subdirectory under /usr/share.

Revision history for this message
Reuben Thomas (rrt) wrote (last edit ):

The two files in this line:

```
data_files.append(tuple(("", ["VERSION", "compile_translations.py"])))
```

should not be distributed in the bdist, only in the sdist.

Revision history for this message
Reuben Thomas (rrt) wrote :

This should be fixed in r692, which removes both of those files.

Revision history for this message
Reuben Thomas (rrt) wrote :

(Really, the build system should be thoroughly modernized, but alas! although Babel looks promising as a way of working with pofiles and setuptools, it was not simple to implement, and I was afraid of having to grapple with another complex system. At least things are a bit simpler now.

If this fixes Debian packaging, please let me know, and I'll make a release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.