1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
.\" $OpenBSD: mirroring-ports.7,v 1.23 2012/01/30 17:09:10 espie Exp $
.\"
.\" Copyright (c) 2000,2012 Marc Espie
.\"
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd $Mdocdate: January 30 2012 $
.Dt MIRRORING-PORTS 7
.Os
.Sh NAME
.Nm mirroring-ports
.Nd how to build a mirror for ports distfiles
.Sh DESCRIPTION
The
.Nm OpenBSD Ports Collection
offers some powerful tools to mirror software sources.
.Pp
.Xr dpb 1
features a
.Fl F
option which is explicitly designed for mirroring distfiles.
.Pp
If run with
.Fl F Ar jobs ,
.Nm dpb
will
.Bl -bullet
.It
Limit itself to fetching distfiles, and not build any packages.
.It
Disregard any architecture or broken annotation, and try to fetch every
distfile.
.It
Fetch files to a temporary copy named
.Ic some_file.part
using
.Sq ftp -C
to resume interrupted downloads.
.It
Keep a global list of sha256 checksums as
.Ic ${DISTDIR}/distinfo ,
and use that to refetch files when the ports tree records a changing checksum.
.It
Produces a log of old distfiles in
.Ic ${DISTDIR}/history ,
.It
Create sha256 links under
.Ic ${DISTDIR}/by_cipher/sha256
as per
.Xr link-checksum 1 Ns 's
former duties.
.El
.Pp
For partial distfiles collections,
.Nm dpb
can also be run with
.Fl D Ns Ar HISTORY_ONLY
to scan the full ports tree and update
.Ic ${DISTDIR}/history
without fetching anything.
.Sh FILES
.Bl -tag -width toto
.It Pa ${DISTDIR}/distinfo
a cache of known distfiles with their respective checksums.
.It Pa ${DISTDIR}/history
List of files appearing in
.Pa ${DISTDIR}/distinfo
that seem to no longer be required by the ports tree.
.Xr dpb 1
will append to this file each time it is run on the whole tree
(option
.Fl a )
and only if the ports tree scan finishes without error.
Each line is of the form
.Bd -offset indent
.Li timestamp SHA256(file) = sha
.Ed
.Pp
denoting the first fime a file/sha entry was no longer seen in the ports tree.
.El
.Sh SEE ALSO
.Xr clean-old-distfiles 1 ,
.Xr dpb 1 ,
.Xr ports 7
.Sh HISTORY
The new integrated
.Fl F
option to
.Xr dpb 1
was introduced in
.Ox 5.1 ,
replacing the original infrastructure introduced in
.Ox 2.7 .
.Sh CAVEATS
Changing checksums is a recurring problem that is outside the direct
control of the
.Ox
Project.
Some software distributors change distribution files without
warning, without changing the file name proper.
Once the problem has been identified, the port maintainer should usually
contact the software author to fix the problem, or, if the software author
is unresponsive, the maintainer should use
.Ev DIST_SUBDIR
to provide some state to guard against shifting checksums.
.Pp
However, a more robust approach is also needed, so that ports users can
depend on distfiles mirrors to carry what they need irrespective of those
synchronization issues.
The
.Pa by-cipher/sha256
directory provides more persistant access to the distfiles,
indexed through the actual checksums that the files should match.
Provided mirroring is run sufficiently often,
two versions of the same distfile with respective checksums cksum1 and cksum2
will be available under the names
.Pa ${DISTFILES}/sha256/c1/cksum1/distfile
and
.Pa ${DISTFILES}/sha256/c2/cksum2/distfile .
.Pp
If
.Ev REFETCH
is set to true,
.Xr bsd.port.mk 5
will try to retrieve files under that naming scheme as a last resort.
|