Commit graph

4 commits

Author SHA1 Message Date
John Marino
4b4fde4cf6 redundant-opt-files script: Fix deleted port output
The last change was flawed; for deleted ports it was writing out the
origin, but it should be writing out the appropriate ports cache
database directory.
2016-03-24 21:33:36 +00:00
John Marino
4a68b19d0e redundant-opt-files script: Handle cache for deleted ports
The redundant-opt-file scripts assumes that if options are cached,
then the port that it was created by still exists.  This, of course, is
a terrible assumption.

If the cached options refer to a port that has since been deleted or
otherwise no longer exists, just print the origin and continue.  The
normal use case is that the origin will be piped to xargs rm -rf which
will purge the obsolete directory as desired.
2016-03-24 20:16:59 +00:00
John Marino
aafd191750 redundant-opt-files.sh script: validate PORTSDIR value
Before checking validity of $db_dir, verify $portdir is valid and eject if
it is not.  This provides a better error message when PORTSDIR is invalid.
2016-03-17 13:18:21 +00:00
John Marino
75229eb39f Add new tool script: redundant-opt-files.sh
I got a request to make Synth identify "redundant" cached option files,
where "redundant" means the saved port options are identical to the
default options.  For Synth (and portmaster?) which use the port's
cache options, these redundant files are somewhat of a liability.  At
best they do nothing (Synth assumes default options) and at worst they
will cause a future build to stop if the maintainer changes the port
options later.

This situation is avoidable.  Rather than build detection into Synth,
I decided to write a generic shell script for ports.  When run, it
will display the full path to the port's options directory if the
cached options are the same as the defaults.  This output is suitable
to pipe to "xargs rm -rf" to remove all the redundant options in a
single command.
2016-02-14 09:59:08 +00:00