[Bug 230287] Mk/Uses/perl5.mk: Check existence of directory before "find" command usage for this directory

[email protected]
Newsgroups gmane.os.freebsd.devel.x11
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230287

            Bug ID: 230287
           Summary: Mk/Uses/perl5.mk: Check existence of directory before
                    "find" command usage for this directory
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected], [email protected],
                    [email protected]
                CC: [email protected], [email protected]
 Attachment #195755 maintainer-approval?([email protected])
             Flags:
                CC: [email protected]

Created attachment 195755
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=195755&action=edit
Proposed patch (since 473539 revision)

Hello.

I noticed, that some ports, which have USES+=perl5 (and USE_PERL5=build),
started to report about non existing
"<..>/work/stage/usr/local/lib/perl5/site_perl" directory, when using some
"find" command.
For example, x11-servers/xorg-server port:
-8<--
# cd /usr/ports/x11-servers/xorg-server
# make stage
<..>
find:
/usr/ports/x11-servers/xorg-server/work/stage/usr/local/lib/perl5/site_perl: No
such file or directory
install  -s -m 0644
/usr/ports/x11-servers/xorg-server/work/xorg-server-1.18.4/hw/xfree86/dixmods/.libs/libglx.so

/usr/ports/x11-servers/xorg-server/work/stage/usr/local/lib/xorg/modules/extensions/.xorg/
<..>
# make clean
===>  Cleaning for xorg-server-1.18.4_9,1
-->8-

ftp/wget port:
-8<--
# cd /usr/ports/ftp/wget
# make stage
<..>
Making install in testenv
find: /usr/ports/wget/work/stage/usr/local/lib/perl5/site_perl: No such file or
directory
====> Compressing man pages (compress-man)
<..>
# make clean
===>  Cleaning for wget-1.19.5
-->8-

I found, that this is because of ports r473539 changes, which added removal of
README.pod files, if they exists in "${STAGEDIR}${PREFIX}/${SITE_PERL_REL}"
directory.

I propose to add some check for "${STAGEDIR}${PREFIX}/${SITE_PERL_REL}"
directory before find command usage for this directory:
-8<--
@[ -d "${STAGEDIR}${PREFIX}/${SITE_PERL_REL}" ] && \
        ${FIND} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL} -name README.pod -delete
|| :
-->8-

Similar to what was used for "${STAGEDIR}${SITE_MAN3}" directory:
https://svnweb.freebsd.org/ports/head/Mk/Uses/perl5.mk?view=markup&pathrev=473539#l306
-8<--
@[ -d "${STAGEDIR}${SITE_MAN3}" ] && \
        ${FIND} ${STAGEDIR}${SITE_MAN3} -name '*::README.3' -delete || :
-->8-

How to check:
% [ -d "/usr/ports" ] && echo exists || echo not exists
exists
% find /usr/ports -maxdepth 1 -name Makefile
/usr/ports/Makefile
% cd /usr/ports && find * -maxdepth 0 -name Makefile
Makefile
% [ -d "/usr/ports/nonexistent" ] && echo exists || echo not exists
not exists
% find /usr/ports/nonexistent -maxdepth 1 -name Makefile
find: /usr/ports/nonexistent: No such file or directory
% [ -d "/usr/ports/nonexistent" ] && find /usr/ports/nonexistent -maxdepth 1
-name Makefile

Also possible to redirect message about non-existing directory to /dev/null:
% sh -c "find /usr/ports/nonexistent -maxdepth 1 -name Makefile 2>/dev/null"
% sh -c "cd /usr/ports/nonexistent 2>/dev/null && find * -maxdepth 0 -name
Makefile"

CC: mat@

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-x11
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.