1.\" $OpenBSD: clean-old-distfiles.1,v 1.5 2023/07/06 10:43:37 espie Exp $ 2.\" 3.\" Copyright (c) 2012 Marc Espie <espie@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: July 6 2023 $ 18.Dt CLEAN-OLD-DISTFILES 1 19.Os 20.Sh NAME 21.Nm clean-old-distfiles 22.Nd remove obsolete ports distfiles 23.Sh SYNOPSIS 24.Nm clean-old-distfiles 25.Op Fl mnvx 26.Op Fl e Ar except 27.Op Fl h Ar history 28.Op Ar timestamp 29.Sh DESCRIPTION 30Each time 31.Xr dpb 1 32is run for a full scan of the 33.Xr ports 7 34tree, it appends to the 35.Pa history 36log, listing files in the 37.Pa distfiles 38directory that are not, or no longer, 39needed for building the complete tree. 40It can also be run solely for that purpose, by using: 41.Pp 42.D1 $ Sy dpb Fl D Cm HISTORY_ONLY 43.Pp 44When 45.Nm 46is run later, it uses the information from the history log 47to delete unneeded files. 48When a file is deleted, the corresponding entry is also deleted 49from the history log. 50.Pp 51By default, 52.Nm 53deletes all files listed in the history log. 54.Pp 55If a 56.Ar timestamp 57is given, it is interpreted as a number of seconds since the Epoch, 58similar to the 59.Xr date 1 60.Fl r 61argument, and only those files are deleted that were recorded as 62obsolete at that time or earlier. 63It can also be set to a date in ISO8601 format, like 64.Sq 2023-07-01 65or 66.Sq 2023-07-02T12:00:00Z . 67.Pp 68For normal files, 69.Nm 70verifies 71.Xr sha256 1 72checksums prior to removal. 73It also removes links under 74.Pa by_cipher/sha256 , 75but it trusts that the checksums for these are accurate. 76.Pp 77Options are as follows: 78.Bl -tag -width nnnn 79.It Fl e Ar except 80Read exception list from file 81.Ar except . 82Each line is the name of a file that shouldn't be removed. 83.It Fl h Ar history 84Read log from history file 85.Ar history 86instead of the default 87.Pa /usr/ports/distfiles/history . 88Turns on 89.Fl nv , 90as this is a testing option. 91.It Fl m 92Causes 93.Nm 94to display the progress meter even if not on a terminal. 95.It Fl n 96Don't really remove files. 97.It Fl v 98Display what will be removed, as 99.Ql rm file 100lines. 101.It Fl x 102Causes 103.Nm 104to not display the progress meter. 105.El 106.Sh FILES 107.Bl -tag -width /usr/ports 108.It Pa /usr/ports 109base of the ports tree, can be overridden with env variable 110.Ev PORTSDIR . 111.It Pa /usr/ports/distfiles 112location of the distfiles repository, can be overridden with env variable 113.Ev DISTDIR . 114.It Pa /usr/ports/distfiles/history 115log of obsolete distfiles. 116.El 117.Sh SEE ALSO 118.Xr dpb 1 , 119.Xr sha256 1 , 120.Xr mirroring-ports 7 121