commit fc01ab35813942ab2bad7db4d43a6de5e0354a7a Author: Jim Meyering meyering@redhat.com Date: Thu Nov 10 09:11:26 2011 +0100
maint: improve new "unitdir" definition and uses
* Makefile.am (unitdir): Use $(prefix)/lib rather than "$(sysconfdir)/..". There is no requirement that $(sysconfdir) be a sibling of /lib. Include $(DESTDIR) in the definition, since every use had that.
Makefile.am | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) --- diff --git a/Makefile.am b/Makefile.am index b0b1587..30e546e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -139,7 +139,7 @@ iwhd-users.js: $(top_builddir)/config.status > $@-t && chmod a-w $@-t && mv $@-t $@
logrotate_dir = $(DESTDIR)$(sysconfdir)/logrotate.d -unitdir = $(sysconfdir)/../lib/systemd/system +unitdir = $(DESTDIR)$(prefix)/lib/systemd/system .PHONY: install-data-local install-data-local: iwhd.init iwhd-conf.js iwhd-users.js mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d @@ -149,8 +149,8 @@ install-data-local: iwhd.init iwhd-conf.js iwhd-users.js $(INSTALL) -m 600 iwhd-users.js $(DESTDIR)$(sysconfdir)/iwhd/users.js mkdir -p $(DESTDIR)$(sysconfdir)/sysconfig $(INSTALL_DATA) $(top_srcdir)/iwhd.sysconfig $(DESTDIR)$(sysconfdir)/sysconfig/iwhd - mkdir -p $(DESTDIR)$(unitdir) - $(INSTALL_DATA) $(top_srcdir)/iwhd.service $(DESTDIR)$(unitdir)/iwhd.service + mkdir -p $(unitdir) + $(INSTALL_DATA) $(top_srcdir)/iwhd.service $(unitdir)/iwhd.service mkdir -p $(logrotate_dir) $(INSTALL_DATA) $(top_srcdir)/iwhd.logrotate $(logrotate_dir)/iwhd mkdir -p $(DESTDIR)$(DEFAULT_FS_DIR) @@ -161,7 +161,7 @@ uninstall-local: $(DESTDIR)$(sysconfdir)/iwhd/conf.js \ $(DESTDIR)$(sysconfdir)/iwhd/users.js \ $(DESTDIR)$(sysconfdir)/sysconfig/iwhd \ - $(DESTDIR)/$(unitdir)/iwhd.service \ + $(unitdir)/iwhd.service \ $(logrotate_dir)/iwhd rmdir $(DESTDIR)$(DEFAULT_FS_DIR)
On Thu, 10 Nov 2011 09:40:07 +0000 (UTC) Jim Meyering meyering@fedoraproject.org wrote:
logrotate_dir = $(DESTDIR)$(sysconfdir)/logrotate.d -unitdir = $(sysconfdir)/../lib/systemd/system +unitdir = $(DESTDIR)$(prefix)/lib/systemd/system .PHONY: install-data-local
I didn't want this because I thought that prefix may be /usr, in which case this does not work... But on second thought $(sysconfdir) turns into /usr/etc in such case too, right?
-- Pete
Pete Zaitcev wrote:
On Thu, 10 Nov 2011 09:40:07 +0000 (UTC) Jim Meyering meyering@fedoraproject.org wrote:
logrotate_dir = $(DESTDIR)$(sysconfdir)/logrotate.d -unitdir = $(sysconfdir)/../lib/systemd/system +unitdir = $(DESTDIR)$(prefix)/lib/systemd/system .PHONY: install-data-local
I didn't want this because I thought that prefix may be /usr, in which case this does not work... But on second thought $(sysconfdir) turns into /usr/etc in such case too, right?
Right, unless you override it.
On Thu, 10 Nov 2011 18:10:49 +0100 Jim Meyering jim@meyering.net wrote:
logrotate_dir = $(DESTDIR)$(sysconfdir)/logrotate.d -unitdir = $(sysconfdir)/../lib/systemd/system +unitdir = $(DESTDIR)$(prefix)/lib/systemd/system .PHONY: install-data-local
I didn't want this because I thought that prefix may be /usr, in which case this does not work... But on second thought $(sysconfdir) turns into /usr/etc in such case too, right?
Right, unless you override it.
I'm asking because I cannot build the RPM, because the following happens:
[zaitcev@simbelmyne ~]$ rpmbuild -ba rpms/SPECS/iwhd.spec .................. RPM build errors: File not found: /q/zaitcev/rpms/BUILDROOT/iwhd-1.0-1.z2.el6.x86_64/lib/systemd/system/iwhd.service [zaitcev@simbelmyne ~]$ find rpms/BUILDROOT/iwhd-1.0-1.z2.el6.x86_64 -name 'iwhd.service' rpms/BUILDROOT/iwhd-1.0-1.z2.el6.x86_64/usr/lib/systemd/system/iwhd.service
(this is with the fix for "chmod 600 iwhd.users" in t/oauth, which is unrelated, but necessary to build RPMs)
-- Pete
Pete Zaitcev wrote:
On Thu, 10 Nov 2011 18:10:49 +0100 Jim Meyering jim@meyering.net wrote:
logrotate_dir = $(DESTDIR)$(sysconfdir)/logrotate.d -unitdir = $(sysconfdir)/../lib/systemd/system +unitdir = $(DESTDIR)$(prefix)/lib/systemd/system .PHONY: install-data-local
I didn't want this because I thought that prefix may be /usr, in which case this does not work... But on second thought $(sysconfdir) turns into /usr/etc in such case too, right?
Right, unless you override it.
I'm asking because I cannot build the RPM, because the following happens:
[zaitcev@simbelmyne ~]$ rpmbuild -ba rpms/SPECS/iwhd.spec .................. RPM build errors: File not found: /q/zaitcev/rpms/BUILDROOT/iwhd-1.0-1.z2.el6.x86_64/lib/systemd/system/iwhd.service [zaitcev@simbelmyne ~]$ find rpms/BUILDROOT/iwhd-1.0-1.z2.el6.x86_64 -name 'iwhd.service' rpms/BUILDROOT/iwhd-1.0-1.z2.el6.x86_64/usr/lib/systemd/system/iwhd.service
Oh! Thanks for catching that. Here's the fix:
From 9bdb7d01ea61a455654f7283f771aaea8a95048d Mon Sep 17 00:00:00 2001
From: Jim Meyering meyering@redhat.com Date: Fri, 11 Nov 2011 08:46:25 +0100 Subject: [PATCH] build/rpm: install iwhd.service in the right place
* Makefile.am (p): Define a surrogate for $(prefix) that we can nuke when it's /usr. Use it in $(unitdir) definition so that iwhd.service is installed under /lib/..., rather than under /usr/lib/... [bug introduced via commit fc01ab35, "maint: improve new "unitdir" definition and uses"] Reported by Pete Zaitcev. --- Makefile.am | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 30e546e..df9d4f1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -138,8 +138,11 @@ iwhd-users.js: $(top_builddir)/config.status $(AM_V_GEN)echo '[ { "name":"admin", "secret":"replaceme" } ]' \ > $@-t && chmod a-w $@-t && mv $@-t $@
+# Honor $(prefix) in the expansion of $(unitdir), except when it is "/usr". +p = $$(echo '$(prefix)' | sed 's,^/usr$$,,') +unitdir = $(DESTDIR)$(p)/lib/systemd/system + logrotate_dir = $(DESTDIR)$(sysconfdir)/logrotate.d -unitdir = $(DESTDIR)$(prefix)/lib/systemd/system .PHONY: install-data-local install-data-local: iwhd.init iwhd-conf.js iwhd-users.js mkdir -p $(DESTDIR)$(sysconfdir)/rc.d/init.d -- 1.7.8.rc0.61.g8a042
iwhd-commit@lists.fedorahosted.org