Page MenuHomeFreeBSD

Add @rmempty keyword
ClosedPublic

Authored by bapt on Oct 1 2020, 6:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Nov 6 2024, 5:16 AM
Unknown Object (File)
Nov 6 2024, 5:16 AM
Unknown Object (File)
Nov 6 2024, 5:16 AM
Unknown Object (File)
Nov 4 2024, 2:25 AM
Unknown Object (File)
Oct 9 2024, 10:54 PM
Unknown Object (File)
Sep 22 2024, 5:13 AM
Unknown Object (File)
Sep 18 2024, 12:41 AM
Unknown Object (File)
Sep 16 2024, 8:59 AM
Subscribers

Details

Reviewers
manu
mat
Group Reviewers
portmgr
Commits
rP552943: Add new keyword rmempty
Summary

If a file is empty then remove it, instead of using a @*exec

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bapt requested review of this revision.Oct 1 2020, 6:44 PM

I am sure there are examples of ports doing that, but listing a few here would be nice.

mail/vpopmail/pkg-plist:33:@unexec if [ -f %D/vpopmail/etc/defaultdomain ] && [ ! -s %D/vpopmail/etc/defaultdomain ]; then rm -f %D/vpopmail/etc/defaultdomain; fi
mail/mailagent/pkg-plist:38:@unexec [ -s %%ORGFILE%% ] || rm -f %%ORGFILE%% || true
games/gnome-nibbles/pkg-plist:12:@unexec [ -s %D/share/games/gnibbles.4.1.scores ] || rm -f %D/share/games/gnibbles.4.1.scores
games/bsdtris/pkg-plist:6:@unexec if test ! -s /var/games/bsdtris.scores; then rm -f /var/games/bsdtris.scores; fi
games/xboing/pkg-plist:136:@unexec if test ! -s %D/lib/X11/xboing/.xboing.scr ; then rm -f %D/lib/X11/xboing/.xboing.scr ; fi
games/tali/pkg-plist:6:@unexec [ -s %D/share/games/gtali.Regular.scores ] || rm -f %D/share/games/gtali.Regular.scores
games/gnome-robots/pkg-plist:18:@unexec [ -s %D/share/games/gnobots.robots_with_safe_teleport.scores ] || rm -f %D/share/games/gnobots2.robots_with_safe_teleport.scores
games/zangband/pkg-plist:6:@unexec cmp -s %D/%%ANGBANDLIB%%/apex/scores.raw /dev/null && rm %D/%%ANGBANDLIB%%/apex/scores.raw || true
games/nighthawk/pkg-plist:203:@unexec if [ ! -s /var/games/nighthawk.scores ]; then rm -f /var/games/nighthawk.scores; fi
net-mgmt/arpwatch/pkg-plist:15:@preunexec test -f %D/arpwatch/arp.dat && test -s %D/arpwatch/arp.dat || rm -f %D/arpwatch/arp.dat
Mk/bsd.ocaml.mk:188:    @${ECHO_CMD} "@postunexec if [ ! -s %D/${OCAML_LDCONF} ]; then ${RM} %D/${OCAML_LDCONF}; fi || true" >> ${TMPPLIST}
databases/firebird25-server/pkg-plist:30:@preunexec [ -s /%%LOCALSTATEDIR%%/firebird.log ] || rm -f /%%LOCALSTATEDIR%%/firebird.log
lang/php74/pkg-plist:223:@postunexec [ -s %D/include/php/ext/php_config.h ] || rm %D/include/php/ext/php_config.h
....

Can you also convert a few ports to this after you add the keyword?

This revision is now accepted and ready to land.Oct 21 2020, 3:58 PM
This revision was automatically updated to reflect the committed changes.

I know it’s late now because it’s already been committed, but I think this should be renamed to @empty. @rmdir was renamed to @dir because plists most logically express the contents, not what to do when they’re deleted.

I know it’s late now because it’s already been committed, but I think this should be renamed to @empty. @rmdir was renamed to @dir because plists most logically express the contents, not what to do when they’re deleted.

I disagree @rmdir was renmaed @dir because it also ensures the directory is actually present and creates it.
@rmempty only remove files if they are empty, but do not create empty files.

Ah, that’s a good point about the distinction!