Bug 268125 - print/hplip: Staging fails to remove nonexistant data/images with no-X11
Summary: print/hplip: Staging fails to remove nonexistant data/images with no-X11
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Tijl Coosemans
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-02 12:01 UTC by Stewart Morgan
Modified: 2022-12-02 16:49 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (tijl)


Attachments
Patch to conditionally remove data/images (348 bytes, patch)
2022-12-02 12:01 UTC, Stewart Morgan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stewart Morgan 2022-12-02 12:01:33 UTC
Created attachment 238488 [details]
Patch to conditionally remove data/images

Hello,
With X11-off, I get a build failure due to the data/images directory missing:

/bin/rmdir /wrkdirs/usr/ports/print/hplip/work/stage/usr/local/share/hplip/data/images/*  /wrkdirs/usr/ports/print/hplip/work/stage/usr/local/share/hplip/data/images
rmdir: /wrkdirs/usr/ports/print/hplip/work/stage/usr/local/share/hplip/data/images/*: No such file or directory
rmdir: /wrkdirs/usr/ports/print/hplip/work/stage/usr/local/share/hplip/data/images: No such file or directory
*** Error code 1

The attached patch simply wraps this in an "if exists" test and builds, so hope that helps somebody; but perhaps the correct fix would be forceful removal (rm -rf), or to simply remove the whole post-install-X11-off make target? (I've tested neither of those options).

Thanks,

Stewart.
Comment 1 commit-hook freebsd_committer freebsd_triage 2022-12-02 16:32:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f1865a3c0ab76341e5131165e11d25fcd5f478df

commit f1865a3c0ab76341e5131165e11d25fcd5f478df
Author:     Tijl Coosemans <tijl@FreeBSD.org>
AuthorDate: 2022-12-02 16:26:23 +0000
Commit:     Tijl Coosemans <tijl@FreeBSD.org>
CommitDate: 2022-12-02 16:30:54 +0000

    print/hplip: Fix staging with X11 off

    PR:             268125

 print/hplip/Makefile | 4 ----
 1 file changed, 4 deletions(-)
Comment 2 Tijl Coosemans freebsd_committer freebsd_triage 2022-12-02 16:47:36 UTC
The solution is to remove the post-install-X11-off target.

.if exists won't work because it is interpreted when make parses the Makefile which happens before it runs any commands so the files may not exist yet.  You would have to use test(1) like this:

post-install-X11-off:
	if test -e /some/file; then rm ...; fi
Comment 3 Stewart Morgan 2022-12-02 16:49:33 UTC
Ah, of course :facepalm:
Thanks! :)
Stewart.