1.\" $OpenBSD: clean-old-distfiles.1,v 1.4 2020/04/24 12:56:37 schwarze 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: April 24 2020 $ 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 nv 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. 54If a 55.Ar timestamp 56is given, it is interpreted as a number of seconds since the Epoch, 57similar to the 58.Xr date 1 59.Fl r 60argument, and only those files are deleted that were recorded as 61obsolete at that time or earlier. 62.Pp 63For normal files, 64.Nm 65verifies 66.Xr sha256 1 67checksums prior to removal. 68It also removes links under 69.Pa by_cipher/sha256 , 70but it trusts that the checksums for these are accurate. 71.Pp 72Options are as follows: 73.Bl -tag -width nnnn 74.It Fl e Ar except 75Read exception list from file 76.Ar except . 77Each line is the name of a file that shouldn't be removed. 78.It Fl h Ar history 79Read log from history file 80.Ar history 81instead of the default 82.Pa /usr/ports/distfiles/history . 83Turns on 84.Fl nv , 85as this is a testing option. 86.It Fl n 87Don't really remove files. 88.It Fl v 89Display what will be removed, as 90.Ql rm file 91lines. 92.El 93.Sh FILES 94.Bl -tag -width /usr/ports 95.It Pa /usr/ports 96base of the ports tree, can be overridden with env variable 97.Ev PORTSDIR . 98.It Pa /usr/ports/distfiles 99location of the distfiles repository, can be overridden with env variable 100.Ev DISTDIR . 101.It Pa /usr/ports/distfiles/history 102log of obsolete distfiles. 103.El 104.Sh SEE ALSO 105.Xr dpb 1 , 106.Xr sha256 1 , 107.Xr mirroring-ports 7 108