You are not logged in.
Hi,
I'm currently maintaining a package for AUR called hblock, but since updating to a newer version I am having problems building it locally.
When running makepkg or installing using yay I always get the same error:
Failed to reload daemon: Connection reset by peer
make: *** [Makefile:131: install] Error 1
==> ERROR: A failure occured in package().
Aborting...
Error making: hblock
The make stage seems to work, but I'm guessing this is a problem with Systemd as this package should install a timer.
Thanks for your help :)
Last edited by JustMeErazem (2019-03-16 18:07:07)
Offline
You need to set SKIP_SERVICE_START=1 otherwise that Makefile tries to run daemon-reload, enable the service, and start the service.
Then PLEASE PLEASE PLEASE report upstream telling the author they most definitely should not do any of those steps in a Makefile.
Then send a fruitbasket to the pacman developers who set up makepkg in a way that prevents upstream developers from doing such silly and obnoxious things.
EDIT: oh, and you should override their setting for SYSTEMDUNITDIR to be a proper path of /usr/lib/systemd/system/ rather than letting the makefile try to place the unit files directly under /etc/, or just set SKIP_SERVICE_INSTALL=1 and skip that whole section of the install directive and do it right yourself in the package function.
EDIT 2: in fact it'd probably be easiest to just completely bypass that Makefile's install directive:
package() {
cd "$pkgname-$pkgver"
install -Dm 0755 hblock "${pkgdir}/usr/bin/"
install -Dm 0644 resources/systemd/hblock.service "${pkgdir}/usr/lib/systemd/system/"
install -Dm 0644 resources/systemd/hblock.timer "${pkgdir}/usr/lib/systemd/system/"
}
Last edited by Trilby (2019-03-16 15:33:30)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
This reports the error:
install: target '/home/erazem/documents/projects/hblock-aur/pkg/hblock/usr/bin/' is not a directory: No such file or directory
The code is:
build() {
cd "${pkgname}-${pkgver}"
make
}
package() {
cd "${pkgname}-${pkgver}"
install -Dm 0755 hblock "${pkgdir}/usr/bin/"
install -Dm 0644 resources/systemd/hblock.service "${pkgdir}/usr/lib/systemd/system/"
install -Dm 0644 resources/systemd/hblock.timer "${pkgdir}/usr/lib/systemd/system/"
#make DESTDIR="${pkgdir}/" SKIP_SERVICE_START=1 install
}
Last edited by JustMeErazem (2019-03-16 15:50:47)
Offline
Oops, I'm used to using the target directory invocation of `install`. Either add the file names to the ends of those install commands, or use this:
package() {
cd "$pkgname-$pkgver"
install -Dm 0755 -t "${pkgdir}/usr/bin/" hblock
install -Dm 0644 -t "${pkgdir}/usr/lib/systemd/system/" resources/systemd/hblock.{service,timer}
}
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
The new error is:
install: ommiting directory 'hblock'
package() {
install -Dm 0755 -t "${pkgdir}/usr/bin/" hblock
install -Dm 0644 -t "${pkgdir}/usr/lib/systemd/system/" resources/systemd/hblock.{service,timer}
#make DESTDIR="${pkgdir}/" SKIP_SERVICE_START=1 install
}
Offline
When using -D you need to specify the filename in the target as well as the source.
package() {
cd "$pkgname-$pkgver"
install -Dm 0755 hblock "${pkgdir}/usr/bin/hblock"
install -Dm 0644 resources/systemd/hblock.service "${pkgdir}/usr/lib/systemd/system/hblock.service"
install -Dm 0644 resources/systemd/hblock.timer "${pkgdir}/usr/lib/systemd/system/hblock.timer"
}
Also missing dependency on zip. Do you still need a build function?
Edit:
Also as it is MIT licensed see PKGBUILD#license.
Edit2:
Trilby's solution in post #4 works here if I remove the directory change I get
Starting package()...
install: cannot stat 'hblock': No such file or directory
==> ERROR: A failure occurred in package().
Aborting...
Last edited by loqs (2019-03-16 16:26:09)
Offline
Hi, I've updated the license, added the dependencies and have followed your instructions but I still get the error:
erazem@laptop-erazem: ~/documents/projects/hblock # makepkg 17:27:15
==> Making package: hblock 2.0.5-4 (sob 16 mar 2019 17:27:32 CET)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found v2.0.5.tar.gz
==> Validating source files with sha256sums...
v2.0.5.tar.gz ... Passed
==> Extracting sources...
-> Extracting v2.0.5.tar.gz with bsdtar
==> Removing existing $pkgdir/ directory...
==> Entering fakeroot environment...
==> Starting package()...
install: cannot stat 'hblock': No such file or directory
==> ERROR: A failure occurred in package().
Aborting...
This is my PKGBUILD:
pkgname='hblock'
pkgver=2.0.5
pkgrel=4
pkgdesc='An adblocker that creates a hosts file from automatically downloaded blacklists'
arch=('any')
url='https://github.com/hectorm/hblock'
license=('MIT')
depends=('bash' 'zip')
sha256sums=('2de6856a863e1901d03f6566ed7b425778e65484b7f62c2ebe7c2b2f6fd23363')
source=("https://github.com/hectorm/${pkgname}/archive/v${pkgver}.tar.gz")
package() {
install -Dm 0755 hblock "${pkgdir}/usr/bin/hblock"
install -Dm 0644 resources/systemd/hblock.service "${pkgdir}/usr/lib/systemd/system/hblock.service"
install -Dm 0644 resources/systemd/hblock.timer "${pkgdir}/usr/lib/systemd/system/hblock.timer"
install -Dm 0644 LICENSE.md "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
#make DESTDIR="${pkgdir}/" SKIP_SERVICE_START=1 install
}
I've included all the options so you can evaluate if the dependencies and license have been set properly.
Edit: Even if following post #4 I still get the error:
install: ommiting directory 'hblock'
Last edited by JustMeErazem (2019-03-16 16:31:30)
Offline
Please see the output you just posted
==> Starting package()...
install: cannot stat 'hblock': No such file or directory
==> ERROR: A failure occurred in package().
Aborting...
That is not
install: ommiting directory 'hblock'
You have not changed to "$pkgname-$pkgver" at the start of package()
Offline
Wow, I must have accidentally deleted the cd command, thanks, that fixed it
Offline
Thanks so much to all of you for your help
Last edited by JustMeErazem (2019-03-16 18:07:17)
Offline
Please remember to mark your thread [SOLVED] (edit the title of your first post).
Offline
Then PLEASE PLEASE PLEASE report upstream telling the author they most definitely should not do any of those steps in a Makefile.
Hi, I'm the upstream developer. Currently the Makefile invokes "systemctl" for ease of installation, but I understand this is not the desired behavior for a package maintainer.
I would like to know if the following patch solves the problems you expose:
diff --git a/Makefile b/Makefile
index 160321a..4ad6a13 100755
--- a/Makefile
+++ b/Makefile
@@ -8,5 +8,3 @@ PREFIX := $(DESTDIR)/usr/local
BINDIR := $(PREFIX)/bin
-SYSCONFDIR := $(DESTDIR)/etc
-SYSTEMDUNITDIR := $(DESTDIR)/etc/systemd/system
-
+SYSTEMDUNITDIR := $(DESTDIR)/usr/lib/systemd/system
SHELLCHECK := $(shell command -v shellcheck 2>/dev/null)
@@ -129,14 +127,6 @@ install:
mkdir -p '$(BINDIR)'
- install -m 0755 '$(HBLOCK)' '$(BINDIR)'/hblock
- @if [ -x '$(SYSTEMCTL)' ]; then \
- if [ '$(SKIP_SERVICE_INSTALL)' != 1 ]; then \
- mkdir -p '$(SYSTEMDUNITDIR)'; \
- install -m 0644 '$(RESOURCESDIR)'/systemd/hblock.service '$(SYSTEMDUNITDIR)'/hblock.service; \
- install -m 0644 '$(RESOURCESDIR)'/systemd/hblock.timer '$(SYSTEMDUNITDIR)'/hblock.timer; \
- if [ '$(SKIP_SERVICE_START)' != 1 ]; then \
- '$(SYSTEMCTL)' daemon-reload; \
- '$(SYSTEMCTL)' enable hblock.timer; \
- '$(SYSTEMCTL)' start hblock.timer; \
- fi; \
- fi; \
+ install -Dm 0755 '$(HBLOCK)' '$(BINDIR)'/hblock
+ @if [ -x '$(SYSTEMCTL)' ] && [ '$(SKIP_SERVICE_INSTALL)' != 1 ]; then \
+ install -Dm 0644 '$(RESOURCESDIR)'/systemd/hblock.service '$(SYSTEMDUNITDIR)'/hblock.service; \
+ install -Dm 0644 '$(RESOURCESDIR)'/systemd/hblock.timer '$(SYSTEMDUNITDIR)'/hblock.timer; \
fi
@@ -153,12 +143,10 @@ installcheck:
fi
- @if [ -x '$(SYSTEMCTL)' ]; then \
- if [ '$(SKIP_SERVICE_INSTALL)' != 1 ]; then \
- if [ ! -f '$(SYSTEMDUNITDIR)'/hblock.service ]; then \
- >&2 printf '%s\n' 'hblock service is not installed'; \
- exit 1; \
- fi; \
- if [ ! -f '$(SYSTEMDUNITDIR)'/hblock.timer ]; then \
- >&2 printf '%s\n' 'hblock timer is not installed'; \
- exit 1; \
- fi; \
+ @if [ -x '$(SYSTEMCTL)' ] && [ '$(SKIP_SERVICE_INSTALL)' != 1 ]; then \
+ if [ ! -f '$(SYSTEMDUNITDIR)'/hblock.service ]; then \
+ >&2 printf '%s\n' 'hblock service is not installed'; \
+ exit 1; \
+ fi; \
+ if [ ! -f '$(SYSTEMDUNITDIR)'/hblock.timer ]; then \
+ >&2 printf '%s\n' 'hblock timer is not installed'; \
+ exit 1; \
fi; \
@@ -174,11 +162,4 @@ uninstall:
@if [ -x '$(SYSTEMCTL)' ]; then \
- if [ -f '$(SYSTEMDUNITDIR)'/hblock.timer ]; then \
- '$(SYSTEMCTL)' stop hblock.timer; \
- '$(SYSTEMCTL)' disable hblock.timer; \
- rm -f '$(SYSTEMDUNITDIR)'/hblock.timer; \
- fi; \
- if [ -f '$(SYSTEMDUNITDIR)'/hblock.service ]; then \
- rm -f '$(SYSTEMDUNITDIR)'/hblock.service; \
- fi; \
- '$(SYSTEMCTL)' daemon-reload; \
+ rm -f '$(SYSTEMDUNITDIR)'/hblock.service; \
+ rm -f '$(SYSTEMDUNITDIR)'/hblock.timer; \
fi
diff --git a/resources/rpm/SPECS/hblock.spec b/resources/rpm/SPECS/hblock.spec
index d830bc7..101c1a2 100644
--- a/resources/rpm/SPECS/hblock.spec
+++ b/resources/rpm/SPECS/hblock.spec
@@ -27,3 +27,3 @@ your system from connecting to them.
%install
-make DESTDIR="%{buildroot}" PREFIX="%{buildroot}%{_prefix}" SYSTEMDUNITDIR="%{buildroot}%{_unitdir}" SKIP_SERVICE_START=1 install
+make DESTDIR="%{buildroot}" PREFIX="%{buildroot}%{_prefix}" SYSTEMDUNITDIR="%{buildroot}%{_unitdir}" install
Offline
That looks great. Thanks for the prompt attention to this and a solution that addresses all my gripes very well.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline