strongswan make install does not honor DESTDIR for python eggs and ruby gems
As described in the titel, the makefile does not honor DESTDIR when installing.
The build routine for 5.3.0 can be found in my github repo1.
make: Verzeichnis „/home/thermi/aur/PKGBUILDs/strongswan-thermi/src/strongswan-5.3.0/src/libcharon/plugins/vici/ruby“ wird betreten make: Verzeichnis „/home/thermi/aur/PKGBUILDs/strongswan-thermi/src/strongswan-5.3.0/src/libcharon/plugins/vici/ruby“ wird betreten make: Für das Ziel „install-exec-am“ ist nichts zu tun. /usr/bin/gem install --install-dir /home/thermi/aur/PKGBUILDs/strongswan-thermi/pkg/strongswan-thermi/usr/lib/ruby/gems/2.2.0 \ vici-5.3.0.gem ERROR: Use --install-dir or --user-install but not both Makefile:554: die Regel für Ziel „install-data-local“ scheiterte make: *** [install-data-local] Fehler 1
make: Verzeichnis „/home/thermi/aur/PKGBUILDs/strongswan-thermi/src/strongswan-5.3.0/src/libcharon/plugins/vici/python“ wird betreten /usr/bin/easy_install \ dist/vici-5.3.0-py3.4.egg make: Für das Ziel „install-data-am“ ist nichts zu tun. error: can't create or remove files in install directory The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '/usr/lib/python3.4/site-packages/test-easy-install-18369.write-test' The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was: /usr/lib/python3.4/site-packages/ Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable. For information on other options, you may wish to consult the documentation at: https://pythonhosted.org/setuptools/easy_install.html Please make the appropriate changes for your system and try again. Makefile:681: die Regel für Ziel „install-exec-local“ scheiterte make: *** [install-exec-local] Fehler 1
vici: Make installation of Ruby Gem and Python Egg optional
Installing them might not work well when building distro packages (e.g.
with DESTDIR installs). It might be easier to install them later with a
script in the distro package.
When building from source on the local system it could still be useful to
install the packages directly, which can be enabled with separate configure
The main problem with DESTDIR installations of the Python Egg is that
easy_install creates or modifies a file called easy-install.pth in the
installation directory. So it's not actually possible to simply copy
the results in DESTDIR over to the actual system as that file would have
to be merged with any existing one.
#1 Updated by Tobias Brunner over 5 years ago
- Status changed from New to Feedback
I think these are two different issues. When attempting to install the Ruby Gem DESTDIR is actually honored:
install-data-local: vici-$(PACKAGE_VERSION).gem $(GEM) install --install-dir $(DESTDIR)$(RUBYGEMDIR) \ vici-$(PACKAGE_VERSION).gem
Which can be seen in the resulting command:
/usr/bin/gem install --install-dir /home/thermi/aur/PKGBUILDs/strongswan-thermi/pkg/strongswan-thermi/usr/lib/ruby/gems/2.2.0 \ vici-5.3.0.gem
What I don't get is the error message here:
ERROR: Use --install-dir or --user-install but not both
I only see
--install-dir in the command above. Maybe that's the default on your system? (
gem install --help lists the defaults at the bottom). Adding
--no-user-install may help if that's the case.
When installing the Python Egg, on the other hand, DESTDIR is actually not honored.
So this here:
install-exec-local: dist/vici-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg $(EASY_INSTALL) $(PYTHONEGGINSTALLDIR) \ dist/vici-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg
Should probably be changed to:
install-exec-local: dist/vici-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg $(EASY_INSTALL) $(DESTDIR)$(PYTHONEGGINSTALLDIR) \ dist/vici-$(PACKAGE_VERSION)-py$(PYTHON_VERSION).egg
#3 Updated by Tobias Brunner over 5 years ago
- File vici-install-gem-egg-share-5.3.0-tarball.patch vici-install-gem-egg-share-5.3.0-tarball.patch added
As discussed via IRC
--user-install is the default on Arch, set via
/etc/gemrc. And as we saw installing the Python Egg with
easy_install might not be ideal, especially with
DESTDIR, as it creates an
easy-install.pth file in the target directory (site-packages), so it's not directly possible to package the resulting files and deploy them on other systems (that file would have to be merged with any existing one).
A better approach might be to just install the generated Python Egg and Ruby Gem in
/usr/share/strongswan and let users or packages install (and later uninstall) them manually. I've pushed a commit to this end to the vici-install-share branch and attached a patch that applies to the generated files in the 5.3.0 tarball, which avoids having to run
#5 Updated by Tobias Brunner over 5 years ago
Is there some way to make the configure script not require the ruby stuff
for building the package?
The only thing needed is
gem (which obviously has some Ruby dependencies) and since you can't build Ruby Gems without it I don't think there is a way to avoid it other than not configuring
#6 Updated by Tobias Brunner about 5 years ago
- Tracker changed from Issue to Bug
- Category set to build
- Assignee set to Tobias Brunner
- Target version set to 5.3.1
- Resolution set to Fixed
With the referenced commit the gem and egg are not installed anymore by default during
make install. To install them the
--enable-ruby-gems-install/--enable-python-eggs-install have to explicitly be configured.