mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-02 22:54:52 +00:00
Remove portsnap(8)
Rather than having a tool in the FreeBSD base system for obtaining the FreeBSD ports tree, users are encouraged to `pkg install git` and then `git clone https://git.FreeBSD.org/ports.git /usr/ports`. The portsnap servers will continue operating until FreeBSD 13 reaches its End-of-Life, and portsnap is available from the ports tree as ports-mgmt/portsnap. Requested by: portmgr Relnotes: yes Differential Revision: https://reviews.freebsd.org/D39563 X-MFC: no
This commit is contained in:
parent
fb30bb0d4d
commit
df53ae0fdd
|
@ -52,6 +52,13 @@
|
||||||
# xargs -n1 | sort | uniq -d;
|
# xargs -n1 | sort | uniq -d;
|
||||||
# done
|
# done
|
||||||
|
|
||||||
|
# 20230420: portsnap.8 removed
|
||||||
|
OLD_FILES+=etc/portsnap.conf
|
||||||
|
OLD_FILES+=usr/libexec/make_index
|
||||||
|
OLD_FILES+=usr/sbin/portsnap
|
||||||
|
OLD_FILES+=usr/share/examples/etc/portsnap.conf
|
||||||
|
OLD_FILES+=usr/share/man/man8/portsnap.8.gz
|
||||||
|
|
||||||
# 20230331: libpcap updated to 1.10.3
|
# 20230331: libpcap updated to 1.10.3
|
||||||
OLD_FILES+=usr/include/fmtutils.h
|
OLD_FILES+=usr/include/fmtutils.h
|
||||||
|
|
||||||
|
|
4
UPDATING
4
UPDATING
|
@ -27,6 +27,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW:
|
||||||
world, or to merely disable the most expensive debugging functionality
|
world, or to merely disable the most expensive debugging functionality
|
||||||
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
|
||||||
|
|
||||||
|
20230422:
|
||||||
|
Remove portsnap(8). Users are encouraged to obtain the ports tree
|
||||||
|
using git instead.
|
||||||
|
|
||||||
20230420:
|
20230420:
|
||||||
Add jobs.mk to save typing. Enables -j${JOB_MAX} and logging
|
Add jobs.mk to save typing. Enables -j${JOB_MAX} and logging
|
||||||
eg.
|
eg.
|
||||||
|
|
|
@ -49,7 +49,7 @@ SUBDIR+= bootpd
|
||||||
SUBDIR+= fingerd
|
SUBDIR+= fingerd
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_FREEBSD_UPDATE} != "no" || ${MK_PORTSNAP} != "no"
|
.if ${MK_FREEBSD_UPDATE} != "no"
|
||||||
_phttpget= phttpget
|
_phttpget= phttpget
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,11 @@ nsmb.conf - smbfs lookups configuration file
|
||||||
pf.conf - pf(4) example configuration file
|
pf.conf - pf(4) example configuration file
|
||||||
pf.os - SYN fingerprint database
|
pf.os - SYN fingerprint database
|
||||||
phones - phone number database for tip(1)
|
phones - phone number database for tip(1)
|
||||||
portsnap.conf - portsnap(8) configuration file
|
|
||||||
printcap - configuration file for lpr(1)
|
printcap - configuration file for lpr(1)
|
||||||
profile - system-wide .profile for sh(1)
|
profile - system-wide .profile for sh(1)
|
||||||
protocols - see protocols(5)
|
protocols - see protocols(5)
|
||||||
rc - system startup script (see init(8))
|
rc - system startup script (see init(8))
|
||||||
rc.bsdextended - startup policy for the mac_bsdextended(4) security module.
|
rc.bsdextended - startup policy for the mac_bsdextended(4) security module.
|
||||||
rc.firewall - ipfw(8) setup script with basic rulesets
|
rc.firewall - ipfw(8) setup script with basic rulesets
|
||||||
rc.initdiskless - configuration file to boot a diskless machine
|
rc.initdiskless - configuration file to boot a diskless machine
|
||||||
rc.resume - sample run command file for APM Resume Event
|
rc.resume - sample run command file for APM Resume Event
|
||||||
|
@ -65,7 +64,7 @@ snmpd.config - example configuration file for bsnmpd(1)
|
||||||
sysctl.conf - configuration file for sysctl(8)
|
sysctl.conf - configuration file for sysctl(8)
|
||||||
syslog.conf - configuration file for syslogd(8)
|
syslog.conf - configuration file for syslogd(8)
|
||||||
ttys - defines port configuration for init(8)
|
ttys - defines port configuration for init(8)
|
||||||
defaults/bluetooth.device.conf -
|
defaults/bluetooth.device.conf -
|
||||||
defaults/devfs.rules - default configuration rules for devfs(8)
|
defaults/devfs.rules - default configuration rules for devfs(8)
|
||||||
defaults/periodic.conf - default configuration file for periodic(8)
|
defaults/periodic.conf - default configuration file for periodic(8)
|
||||||
defaults/rc.conf - default system configuration info (see rc.conf(5))
|
defaults/rc.conf - default system configuration info (see rc.conf(5))
|
||||||
|
|
|
@ -53,7 +53,6 @@ MAN= acct.5 \
|
||||||
periodic.conf.5 \
|
periodic.conf.5 \
|
||||||
phones.5 \
|
phones.5 \
|
||||||
portindex.5 \
|
portindex.5 \
|
||||||
portsnap.conf.5 \
|
|
||||||
procfs.5 \
|
procfs.5 \
|
||||||
protocols.5 \
|
protocols.5 \
|
||||||
quota.user.5 \
|
quota.user.5 \
|
||||||
|
@ -103,7 +102,7 @@ MAN+= freebsd-update.conf.5
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_HESIOD} != "no"
|
.if ${MK_HESIOD} != "no"
|
||||||
MAN+= hesiod.conf.5
|
MAN+= hesiod.conf.5
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_PF} != "no"
|
.if ${MK_PF} != "no"
|
||||||
|
|
|
@ -1,147 +0,0 @@
|
||||||
.\"-
|
|
||||||
.\" Copyright 2004-2005 Colin Percival
|
|
||||||
.\" All rights reserved
|
|
||||||
.\"
|
|
||||||
.\" Redistribution and use in source and binary forms, with or without
|
|
||||||
.\" modification, are permitted providing 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 AUTHOR ``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 AUTHOR 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.
|
|
||||||
.\"
|
|
||||||
.\" $FreeBSD$
|
|
||||||
.\"
|
|
||||||
.Dd January 30, 2005
|
|
||||||
.Dt PORTSNAP.CONF 5
|
|
||||||
.Os FreeBSD
|
|
||||||
.Sh NAME
|
|
||||||
.Nm portsnap.conf
|
|
||||||
.Nd configuration file for
|
|
||||||
.Xr portsnap 8
|
|
||||||
.Sh DESCRIPTION
|
|
||||||
The
|
|
||||||
.Nm
|
|
||||||
file controls where
|
|
||||||
.Xr portsnap 8
|
|
||||||
fetches ports tree snapshots from,
|
|
||||||
which RSA key should be trusted to sign the updates, and what
|
|
||||||
directories should hold the compressed and live ports trees.
|
|
||||||
.Pp
|
|
||||||
A line of the form
|
|
||||||
.Dl SERVERNAME=portsnap.example.com
|
|
||||||
specifies the source from which snapshots should be fetched.
|
|
||||||
This is equivalent to the
|
|
||||||
.Fl s Ar server
|
|
||||||
option to
|
|
||||||
.Xr portsnap 8 ,
|
|
||||||
and will be ignored if the command-line
|
|
||||||
option is used.
|
|
||||||
.Pp
|
|
||||||
A line of the form
|
|
||||||
.Dl KEYPRINT=0123456789abc ... 456789abcdef
|
|
||||||
(64 characters in total)
|
|
||||||
specifies the SHA-256 hash of the OpenSSL public key file
|
|
||||||
belonging to an RSA keypair which is trusted to sign updates.
|
|
||||||
This is equivalent to the
|
|
||||||
.Fl k Ar KEY
|
|
||||||
option to
|
|
||||||
.Xr portsnap 8 ,
|
|
||||||
and will be ignored if the command-line
|
|
||||||
option is used.
|
|
||||||
.Pp
|
|
||||||
A line of the form
|
|
||||||
.Dl WORKDIR=/path/to/workdir
|
|
||||||
specifies the directory in which portsnap should maintain its compressed
|
|
||||||
snapshot of the ports tree.
|
|
||||||
This is equivalent to the
|
|
||||||
.Fl d Ar workdir
|
|
||||||
option to
|
|
||||||
.Xr portsnap 8 ,
|
|
||||||
and will be ignored if the command-line option
|
|
||||||
is used.
|
|
||||||
.Pp
|
|
||||||
A line of the form
|
|
||||||
.Dl PORTSDIR=/path/to/portstree
|
|
||||||
specifies the directory in which portsnap will create the live ports
|
|
||||||
tree from its compressed snapshot via the
|
|
||||||
.Cm extract
|
|
||||||
and
|
|
||||||
.Cm update
|
|
||||||
commands.
|
|
||||||
This is equivalent to the
|
|
||||||
.Fl p Ar portsdir
|
|
||||||
option to
|
|
||||||
.Xr portsnap 8 ,
|
|
||||||
and will be ignored if the command-line option
|
|
||||||
is used.
|
|
||||||
.Pp
|
|
||||||
If more than one line of any of the above forms is included in
|
|
||||||
.Nm
|
|
||||||
then only the last one will take effect.
|
|
||||||
.Pp
|
|
||||||
A line of the form
|
|
||||||
.Dl INDEX INDEXFILE DESCRIBEFILE
|
|
||||||
will instruct
|
|
||||||
.Xr portsnap 8
|
|
||||||
that the specified INDEX file is generated from the specified
|
|
||||||
describe file distributed by the portsnap server.
|
|
||||||
.Pp
|
|
||||||
Finally, a line of the form
|
|
||||||
.Dl REFUSE foo bar
|
|
||||||
will instruct
|
|
||||||
.Xr portsnap 8
|
|
||||||
to ignore parts of the ports tree with paths starting with
|
|
||||||
.Ar foo
|
|
||||||
or
|
|
||||||
.Ar bar ,
|
|
||||||
which are interpreted as extended regular expressions by
|
|
||||||
.Xr egrep 1 .
|
|
||||||
This will result in those parts of the tree not being updated
|
|
||||||
in the compressed snapshot when the
|
|
||||||
.Cm fetch
|
|
||||||
and
|
|
||||||
.Cm cron
|
|
||||||
commands are used and not being extracted when the
|
|
||||||
.Cm extract
|
|
||||||
command is used (unless a specific
|
|
||||||
.Ar path
|
|
||||||
is passed to
|
|
||||||
.Xr portsnap 8 ) ,
|
|
||||||
and if those parts of the ports tree are present they
|
|
||||||
will not be updated when the
|
|
||||||
.Cm update
|
|
||||||
command is used.
|
|
||||||
Unlike the other options, the parameters in REFUSE lines
|
|
||||||
accumulate and all such lines are considered.
|
|
||||||
.Bf Em
|
|
||||||
Note that operating with an incomplete ports tree is not
|
|
||||||
supported and may cause unexpected results.
|
|
||||||
.Ef
|
|
||||||
.Pp
|
|
||||||
Any lines not of the above forms will be ignored.
|
|
||||||
.Sh FILES
|
|
||||||
.Bl -tag -width "/etc/portsnap.conf"
|
|
||||||
.It Pa /etc/portsnap.conf
|
|
||||||
Default location of the portsnap configuration file.
|
|
||||||
.El
|
|
||||||
.Sh SEE ALSO
|
|
||||||
.Xr egrep 1 ,
|
|
||||||
.Xr fetch 1 ,
|
|
||||||
.Xr sha256 1 ,
|
|
||||||
.Xr portsnap 8
|
|
||||||
.Sh AUTHORS
|
|
||||||
.An Colin Percival Aq Mt cperciva@FreeBSD.org
|
|
|
@ -1437,10 +1437,6 @@ bootstrap tool.
|
||||||
Do not build
|
Do not build
|
||||||
.Xr pmccontrol 8
|
.Xr pmccontrol 8
|
||||||
and related programs.
|
and related programs.
|
||||||
.It Va WITHOUT_PORTSNAP
|
|
||||||
Do not build or install
|
|
||||||
.Xr portsnap 8
|
|
||||||
and related files.
|
|
||||||
.It Va WITHOUT_PPP
|
.It Va WITHOUT_PPP
|
||||||
Do not build
|
Do not build
|
||||||
.Xr ppp 8
|
.Xr ppp 8
|
||||||
|
|
|
@ -155,7 +155,6 @@ __DEFAULT_YES_OPTIONS = \
|
||||||
PF \
|
PF \
|
||||||
PKGBOOTSTRAP \
|
PKGBOOTSTRAP \
|
||||||
PMC \
|
PMC \
|
||||||
PORTSNAP \
|
|
||||||
PPP \
|
PPP \
|
||||||
QUOTAS \
|
QUOTAS \
|
||||||
RADIUS_SUPPORT \
|
RADIUS_SUPPORT \
|
||||||
|
|
|
@ -645,9 +645,6 @@ DIRDEPS+= \
|
||||||
usr.sbin/pmccontrol \
|
usr.sbin/pmccontrol \
|
||||||
usr.sbin/pmcstat \
|
usr.sbin/pmcstat \
|
||||||
usr.sbin/pmcstudy \
|
usr.sbin/pmcstudy \
|
||||||
usr.sbin/portsnap/make_index \
|
|
||||||
usr.sbin/portsnap/phttpget \
|
|
||||||
usr.sbin/portsnap/portsnap \
|
|
||||||
usr.sbin/powerd \
|
usr.sbin/powerd \
|
||||||
usr.sbin/ppp \
|
usr.sbin/ppp \
|
||||||
usr.sbin/pppctl \
|
usr.sbin/pppctl \
|
||||||
|
|
|
@ -2025,7 +2025,7 @@ OLD_FILES+=usr/share/man/man5/freebsd-update.conf.5.gz
|
||||||
OLD_FILES+=usr/share/man/man8/freebsd-update.8.gz
|
OLD_FILES+=usr/share/man/man8/freebsd-update.8.gz
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_FREEBSD_UPDATE} == no && ${MK_PORTSNAP} == no
|
.if ${MK_FREEBSD_UPDATE} == no
|
||||||
OLD_FILES+=usr/libexec/phttpget
|
OLD_FILES+=usr/libexec/phttpget
|
||||||
OLD_FILES+=usr/share/man/man8/phttpget.8.gz
|
OLD_FILES+=usr/share/man/man8/phttpget.8.gz
|
||||||
.endif
|
.endif
|
||||||
|
@ -6843,14 +6843,6 @@ OLD_FILES+=usr/share/man/man8/pmcstat.8.gz
|
||||||
OLD_FILES+=usr/share/man/man8/pmcstudy.8.gz
|
OLD_FILES+=usr/share/man/man8/pmcstudy.8.gz
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if ${MK_PORTSNAP} == no
|
|
||||||
OLD_FILES+=etc/portsnap.conf
|
|
||||||
OLD_FILES+=usr/libexec/make_index
|
|
||||||
OLD_FILES+=usr/sbin/portsnap
|
|
||||||
OLD_FILES+=usr/share/examples/etc/portsnap.conf
|
|
||||||
OLD_FILES+=usr/share/man/man8/portsnap.8.gz
|
|
||||||
.endif
|
|
||||||
|
|
||||||
.if ${MK_PPP} == no
|
.if ${MK_PPP} == no
|
||||||
OLD_FILES+=etc/newsyslog.conf.d/ppp.conf
|
OLD_FILES+=etc/newsyslog.conf.d/ppp.conf
|
||||||
OLD_FILES+=etc/ppp/ppp.conf
|
OLD_FILES+=etc/ppp/ppp.conf
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
.\" $FreeBSD$
|
|
||||||
Do not build or install
|
|
||||||
.Xr portsnap 8
|
|
||||||
and related files.
|
|
|
@ -187,7 +187,6 @@ SUBDIR.${MK_OPENSSL_KTLS}+= rpc.tlsservd
|
||||||
SUBDIR.${MK_PF}+= ftp-proxy
|
SUBDIR.${MK_PF}+= ftp-proxy
|
||||||
SUBDIR.${MK_PKGBOOTSTRAP}+= pkg
|
SUBDIR.${MK_PKGBOOTSTRAP}+= pkg
|
||||||
SUBDIR.${MK_PMC}+= pmc pmcannotate pmccontrol pmcstat pmcstudy
|
SUBDIR.${MK_PMC}+= pmc pmcannotate pmccontrol pmcstat pmcstudy
|
||||||
SUBDIR.${MK_PORTSNAP}+= portsnap
|
|
||||||
SUBDIR.${MK_PPP}+= ppp
|
SUBDIR.${MK_PPP}+= ppp
|
||||||
SUBDIR.${MK_QUOTAS}+= edquota
|
SUBDIR.${MK_QUOTAS}+= edquota
|
||||||
SUBDIR.${MK_QUOTAS}+= quotaon
|
SUBDIR.${MK_QUOTAS}+= quotaon
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# $FreeBSD$
|
|
||||||
|
|
||||||
SUBDIR= portsnap make_index
|
|
||||||
|
|
||||||
.include <bsd.subdir.mk>
|
|
|
@ -1,5 +0,0 @@
|
||||||
# $FreeBSD$
|
|
||||||
|
|
||||||
LIBEXECDIR?= /usr/libexec
|
|
||||||
|
|
||||||
.include "../Makefile.inc"
|
|
|
@ -1,8 +0,0 @@
|
||||||
# $FreeBSD$
|
|
||||||
|
|
||||||
PROG= make_index
|
|
||||||
MAN=
|
|
||||||
|
|
||||||
BINDIR= ${LIBEXECDIR}
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
|
|
@ -1,16 +0,0 @@
|
||||||
# $FreeBSD$
|
|
||||||
# Autogenerated - do NOT edit!
|
|
||||||
|
|
||||||
DIRDEPS = \
|
|
||||||
include \
|
|
||||||
include/xlocale \
|
|
||||||
lib/${CSU_DIR} \
|
|
||||||
lib/libc \
|
|
||||||
lib/libcompiler_rt \
|
|
||||||
|
|
||||||
|
|
||||||
.include <dirdeps.mk>
|
|
||||||
|
|
||||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
|
||||||
# local dependencies - needed for -jN in clean tree
|
|
||||||
.endif
|
|
|
@ -1,515 +0,0 @@
|
||||||
/*-
|
|
||||||
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
|
||||||
*
|
|
||||||
* Copyright 2005 Colin Percival
|
|
||||||
* All rights reserved
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted providing 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 AUTHOR ``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 AUTHOR 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
__FBSDID("$FreeBSD$");
|
|
||||||
|
|
||||||
#include <err.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
struct port;
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
char * name;
|
|
||||||
struct port * p;
|
|
||||||
} DEP;
|
|
||||||
|
|
||||||
typedef struct port {
|
|
||||||
char * pkgname;
|
|
||||||
char * portdir;
|
|
||||||
char * prefix;
|
|
||||||
char * comment;
|
|
||||||
char * pkgdescr;
|
|
||||||
char * maintainer;
|
|
||||||
char * categories;
|
|
||||||
size_t n_edep;
|
|
||||||
DEP * edep;
|
|
||||||
size_t n_pdep;
|
|
||||||
DEP * pdep;
|
|
||||||
size_t n_fdep;
|
|
||||||
DEP * fdep;
|
|
||||||
size_t n_bdep;
|
|
||||||
DEP * bdep;
|
|
||||||
size_t n_rdep;
|
|
||||||
DEP * rdep;
|
|
||||||
char * www;
|
|
||||||
int recursed;
|
|
||||||
} PORT;
|
|
||||||
|
|
||||||
static void usage(void);
|
|
||||||
static char * strdup2(const char *str);
|
|
||||||
static DEP * makelist(char * str, size_t * n);
|
|
||||||
static PORT * portify(char * line);
|
|
||||||
static int portcompare(char * a, char * b);
|
|
||||||
static void heapifyports(PORT **pp, size_t size, size_t pos);
|
|
||||||
static PORT * findport(PORT ** pp, size_t st, size_t en, char * name, char * from);
|
|
||||||
static void translateport(PORT ** pp, size_t pplen, PORT * p);
|
|
||||||
static DEP * recurse_one(DEP * d, size_t * nd);
|
|
||||||
static void recurse(PORT * p);
|
|
||||||
static void heapifypkgs(DEP * d, size_t size, size_t pos);
|
|
||||||
static void sortpkgs(DEP * d, size_t nd);
|
|
||||||
static void printport(PORT * p);
|
|
||||||
|
|
||||||
static void
|
|
||||||
usage(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
fprintf(stderr, "usage: make_index file\n");
|
|
||||||
exit(1);
|
|
||||||
/* NOTREACHED */
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
strdup2(const char *str)
|
|
||||||
{
|
|
||||||
char * r;
|
|
||||||
|
|
||||||
r = strdup(str);
|
|
||||||
if (r == NULL)
|
|
||||||
err(1, "strdup");
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Take a space-separated list and return an array of (char *) */
|
|
||||||
static DEP *
|
|
||||||
makelist(char * str, size_t * n)
|
|
||||||
{
|
|
||||||
DEP * d;
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
/* No depends at all? */
|
|
||||||
if (str[0] == 0) {
|
|
||||||
*n = 0;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Count the number of fields */
|
|
||||||
*n = 1;
|
|
||||||
for (i = 0; str[i] != 0; i++)
|
|
||||||
if (str[i] == ' ')
|
|
||||||
(*n)++;
|
|
||||||
|
|
||||||
/* Allocate and fill an array */
|
|
||||||
d = malloc(*n * sizeof(DEP));
|
|
||||||
if (d == NULL)
|
|
||||||
err(1, "malloc(DEP)");
|
|
||||||
for (i = 0; i < *n; i++) {
|
|
||||||
d[i].name = strdup2(strsep(&str, " "));
|
|
||||||
|
|
||||||
/* Strip trailing slashes */
|
|
||||||
if (d[i].name[strlen(d[i].name) - 1] == '/')
|
|
||||||
d[i].name[strlen(d[i].name) - 1] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Take a port's describe line and split it into fields */
|
|
||||||
static PORT *
|
|
||||||
portify(char * line)
|
|
||||||
{
|
|
||||||
PORT * p;
|
|
||||||
size_t i, n;
|
|
||||||
|
|
||||||
/* Verify that line has the right number of fields */
|
|
||||||
for (n = i = 0; line[i] != 0; i++)
|
|
||||||
if (line[i] == '|')
|
|
||||||
n++;
|
|
||||||
if (n != 12)
|
|
||||||
errx(1, "Port describe line is corrupt:\n%s\n", line);
|
|
||||||
|
|
||||||
p = malloc(sizeof(PORT));
|
|
||||||
if (p == NULL)
|
|
||||||
err(1, "malloc(PORT)");
|
|
||||||
|
|
||||||
p->pkgname = strdup2(strsep(&line, "|"));
|
|
||||||
p->portdir = strdup2(strsep(&line, "|"));
|
|
||||||
p->prefix = strdup2(strsep(&line, "|"));
|
|
||||||
p->comment = strdup2(strsep(&line, "|"));
|
|
||||||
p->pkgdescr = strdup2(strsep(&line, "|"));
|
|
||||||
p->maintainer = strdup2(strsep(&line, "|"));
|
|
||||||
p->categories = strdup2(strsep(&line, "|"));
|
|
||||||
p->edep = makelist(strsep(&line, "|"), &p->n_edep);
|
|
||||||
p->pdep = makelist(strsep(&line, "|"), &p->n_pdep);
|
|
||||||
p->fdep = makelist(strsep(&line, "|"), &p->n_fdep);
|
|
||||||
p->bdep = makelist(strsep(&line, "|"), &p->n_bdep);
|
|
||||||
p->rdep = makelist(strsep(&line, "|"), &p->n_rdep);
|
|
||||||
p->www = strdup2(strsep(&line, "|"));
|
|
||||||
|
|
||||||
p->recursed = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* line will now be equal to NULL -- we counted the field
|
|
||||||
* separators at the top of the function.
|
|
||||||
*/
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns -1, 0, or 1 based on a comparison of the portdir strings */
|
|
||||||
static int
|
|
||||||
portcompare(char * a, char * b)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
/* Find first non-matching position */
|
|
||||||
for (i = 0; ; i++) {
|
|
||||||
if (a[i] != b[i])
|
|
||||||
break;
|
|
||||||
if (a[i] == 0) /* End of strings */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* One string is a prefix of the other */
|
|
||||||
if (a[i] == 0)
|
|
||||||
return -1;
|
|
||||||
if (b[i] == 0)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* One string has a category which is a prefix of the other */
|
|
||||||
if (a[i] == '/')
|
|
||||||
return -1;
|
|
||||||
if (b[i] == '/')
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* The two strings are simply different */
|
|
||||||
if (a[i] < b[i])
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Heapify (PORT *) number pos in a pseudo-heap pp[0]..pp[size - 1] */
|
|
||||||
static void
|
|
||||||
heapifyports(PORT **pp, size_t size, size_t pos)
|
|
||||||
{
|
|
||||||
size_t i = pos;
|
|
||||||
PORT * tmp;
|
|
||||||
|
|
||||||
top:
|
|
||||||
/* Find the largest value out of {pos, 2*pos+1, 2*pos+2} */
|
|
||||||
if ((2 * pos + 1 < size) &&
|
|
||||||
(portcompare(pp[i]->portdir, pp[2 * pos + 1]->portdir) < 0))
|
|
||||||
i = 2 * pos + 1;
|
|
||||||
if ((2 * pos + 2 < size) &&
|
|
||||||
(portcompare(pp[i]->portdir, pp[2 * pos + 2]->portdir) < 0))
|
|
||||||
i = 2 * pos + 2;
|
|
||||||
|
|
||||||
/* If necessary, swap elements and iterate down the tree. */
|
|
||||||
if (i != pos) {
|
|
||||||
tmp = pp[pos];
|
|
||||||
pp[pos] = pp[i];
|
|
||||||
pp[i] = tmp;
|
|
||||||
pos = i;
|
|
||||||
goto top;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Translate a port directory name into a (PORT *), and free the name */
|
|
||||||
static PORT *
|
|
||||||
findport(PORT ** pp, size_t st, size_t en, char * name, char * from)
|
|
||||||
{
|
|
||||||
size_t mid;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
if (st == en)
|
|
||||||
errx(1, "%s: no entry for %s", from, name);
|
|
||||||
|
|
||||||
mid = (st + en) / 2;
|
|
||||||
r = portcompare(pp[mid]->portdir, name);
|
|
||||||
|
|
||||||
if (r == 0) {
|
|
||||||
free(name);
|
|
||||||
return pp[mid];
|
|
||||||
} else if (r < 0)
|
|
||||||
return findport(pp, mid + 1, en, name, from);
|
|
||||||
else
|
|
||||||
return findport(pp, st, mid, name, from);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Translate all depends from names into PORT *s */
|
|
||||||
static void
|
|
||||||
translateport(PORT ** pp, size_t pplen, PORT * p)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
for (i = 0; i < p->n_edep; i++)
|
|
||||||
p->edep[i].p = findport(pp, 0, pplen, p->edep[i].name, p->portdir);
|
|
||||||
for (i = 0; i < p->n_pdep; i++)
|
|
||||||
p->pdep[i].p = findport(pp, 0, pplen, p->pdep[i].name, p->portdir);
|
|
||||||
for (i = 0; i < p->n_fdep; i++)
|
|
||||||
p->fdep[i].p = findport(pp, 0, pplen, p->fdep[i].name, p->portdir);
|
|
||||||
for (i = 0; i < p->n_bdep; i++)
|
|
||||||
p->bdep[i].p = findport(pp, 0, pplen, p->bdep[i].name, p->portdir);
|
|
||||||
for (i = 0; i < p->n_rdep; i++)
|
|
||||||
p->rdep[i].p = findport(pp, 0, pplen, p->rdep[i].name, p->portdir);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Recurse on one specific depends list */
|
|
||||||
static DEP *
|
|
||||||
recurse_one(DEP * d, size_t * nd)
|
|
||||||
{
|
|
||||||
size_t i, j, k, n, N;
|
|
||||||
|
|
||||||
N = n = *nd;
|
|
||||||
for (i = 0; i < n; i++) {
|
|
||||||
recurse(d[i].p);
|
|
||||||
for (j = 0; j < d[i].p->n_rdep; j++) {
|
|
||||||
for (k = 0; k < N; k++) {
|
|
||||||
if (d[i].p->rdep[j].p == d[k].p)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (k == N) {
|
|
||||||
N++;
|
|
||||||
if (N >= *nd) {
|
|
||||||
*nd += *nd;
|
|
||||||
d = realloc(d, *nd * sizeof(DEP));
|
|
||||||
if (d == NULL)
|
|
||||||
err(1, "realloc(d)");
|
|
||||||
}
|
|
||||||
d[k].p = d[i].p->rdep[j].p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*nd = N;
|
|
||||||
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Recurse on the depends lists */
|
|
||||||
static void
|
|
||||||
recurse(PORT * p)
|
|
||||||
{
|
|
||||||
switch (p->recursed) {
|
|
||||||
case 0:
|
|
||||||
/* First time we've seen this port */
|
|
||||||
p->recursed = 1;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
/* We're in the middle of recursing this port */
|
|
||||||
errx(1, "Circular dependency loop found: %s"
|
|
||||||
" depends upon itself.\n", p->pkgname);
|
|
||||||
case 2:
|
|
||||||
/* This port has already been recursed */
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->edep = recurse_one(p->edep, &p->n_edep);
|
|
||||||
p->pdep = recurse_one(p->pdep, &p->n_pdep);
|
|
||||||
p->fdep = recurse_one(p->fdep, &p->n_fdep);
|
|
||||||
p->bdep = recurse_one(p->bdep, &p->n_bdep);
|
|
||||||
p->rdep = recurse_one(p->rdep, &p->n_rdep);
|
|
||||||
|
|
||||||
/* Finished recursing on this port */
|
|
||||||
p->recursed = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Heapify an element in a package list */
|
|
||||||
static void
|
|
||||||
heapifypkgs(DEP * d, size_t size, size_t pos)
|
|
||||||
{
|
|
||||||
size_t i = pos;
|
|
||||||
PORT * tmp;
|
|
||||||
|
|
||||||
top:
|
|
||||||
/* Find the largest value out of {pos, 2*pos+1, 2*pos+2} */
|
|
||||||
if ((2 * pos + 1 < size) &&
|
|
||||||
(strcmp(d[i].p->pkgname, d[2 * pos + 1].p->pkgname) < 0))
|
|
||||||
i = 2 * pos + 1;
|
|
||||||
if ((2 * pos + 2 < size) &&
|
|
||||||
(strcmp(d[i].p->pkgname, d[2 * pos + 2].p->pkgname) < 0))
|
|
||||||
i = 2 * pos + 2;
|
|
||||||
|
|
||||||
/* If necessary, swap elements and iterate down the tree. */
|
|
||||||
if (i != pos) {
|
|
||||||
tmp = d[pos].p;
|
|
||||||
d[pos].p = d[i].p;
|
|
||||||
d[i].p = tmp;
|
|
||||||
pos = i;
|
|
||||||
goto top;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sort a list of dependent packages in alphabetical order */
|
|
||||||
static void
|
|
||||||
sortpkgs(DEP * d, size_t nd)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
PORT * tmp;
|
|
||||||
|
|
||||||
if (nd == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = nd; i > 0; i--)
|
|
||||||
heapifypkgs(d, nd, i - 1); /* Build a heap */
|
|
||||||
for (i = nd - 1; i > 0; i--) {
|
|
||||||
tmp = d[0].p; /* Extract elements */
|
|
||||||
d[0].p = d[i].p;
|
|
||||||
d[i].p = tmp;
|
|
||||||
heapifypkgs(d, i, 0); /* And re-heapify */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Output an index line for the given port. */
|
|
||||||
static void
|
|
||||||
printport(PORT * p)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
sortpkgs(p->edep, p->n_edep);
|
|
||||||
sortpkgs(p->pdep, p->n_pdep);
|
|
||||||
sortpkgs(p->fdep, p->n_fdep);
|
|
||||||
sortpkgs(p->bdep, p->n_bdep);
|
|
||||||
sortpkgs(p->rdep, p->n_rdep);
|
|
||||||
|
|
||||||
printf("%s|%s|%s|%s|%s|%s|%s|",
|
|
||||||
p->pkgname, p->portdir, p->prefix, p->comment, p->pkgdescr,
|
|
||||||
p->maintainer, p->categories);
|
|
||||||
for (i = 0; i < p->n_bdep; i++)
|
|
||||||
printf("%s%s", i ? " " : "", p->bdep[i].p->pkgname);
|
|
||||||
printf("|");
|
|
||||||
for (i = 0; i < p->n_rdep; i++)
|
|
||||||
printf("%s%s", i ? " " : "", p->rdep[i].p->pkgname);
|
|
||||||
printf("|");
|
|
||||||
printf("%s|", p->www);
|
|
||||||
for (i = 0; i < p->n_edep; i++)
|
|
||||||
printf("%s%s", i ? " " : "", p->edep[i].p->pkgname);
|
|
||||||
printf("|");
|
|
||||||
for (i = 0; i < p->n_pdep; i++)
|
|
||||||
printf("%s%s", i ? " " : "", p->pdep[i].p->pkgname);
|
|
||||||
printf("|");
|
|
||||||
for (i = 0; i < p->n_fdep; i++)
|
|
||||||
printf("%s%s", i ? " " : "", p->fdep[i].p->pkgname);
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Algorithm:
|
|
||||||
* 1. Suck in all the data, splitting into fields.
|
|
||||||
* 1a. If there are no ports, there is no INDEX.
|
|
||||||
* 2. Sort the ports according to port directory.
|
|
||||||
* 3. Using a binary search, translate each dependency from a
|
|
||||||
* port directory name into a pointer to a port.
|
|
||||||
* 4. Recursively follow dependencies, expanding the lists of
|
|
||||||
* pointers as needed (using realloc).
|
|
||||||
* 5. Iterate through the ports, printing them out (remembering
|
|
||||||
* to list the dependent ports in alphabetical order).
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
FILE * f;
|
|
||||||
char * line;
|
|
||||||
size_t linelen;
|
|
||||||
PORT ** pp; /* Array of pointers to PORTs */
|
|
||||||
PORT * tmp;
|
|
||||||
size_t pplen; /* Allocated size of array */
|
|
||||||
size_t i;
|
|
||||||
|
|
||||||
if (argc != 2)
|
|
||||||
usage();
|
|
||||||
if ((f = fopen(argv[1], "r")) == NULL)
|
|
||||||
err(1, "fopen(%s)", argv[1]);
|
|
||||||
|
|
||||||
pplen = 1024;
|
|
||||||
if ((pp = malloc(pplen * sizeof(PORT *))) == NULL)
|
|
||||||
err(1, "malloc(pp)");
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 1. Suck in all the data, splitting into fields.
|
|
||||||
*/
|
|
||||||
for(i = 0; (line = fgetln(f, &linelen)) != NULL; i++) {
|
|
||||||
if (line[linelen - 1] != '\n')
|
|
||||||
errx(1, "Unterminated line encountered");
|
|
||||||
line[linelen - 1] = 0;
|
|
||||||
|
|
||||||
/* Enlarge array if needed */
|
|
||||||
if (i >= pplen) {
|
|
||||||
pplen *= 2;
|
|
||||||
if ((pp = realloc(pp, pplen * sizeof(PORT *))) == NULL)
|
|
||||||
err(1, "realloc(pp)");
|
|
||||||
}
|
|
||||||
|
|
||||||
pp[i] = portify(line);
|
|
||||||
}
|
|
||||||
/* Reallocate to the correct size */
|
|
||||||
pplen = i;
|
|
||||||
if ((pp = realloc(pp, pplen * sizeof(PORT *))) == NULL)
|
|
||||||
err(1, "realloc(pp)");
|
|
||||||
|
|
||||||
/* Make sure we actually reached the EOF */
|
|
||||||
if (!feof(f))
|
|
||||||
err(1, "fgetln(%s)", argv[1]);
|
|
||||||
/* Close the describes file */
|
|
||||||
if (fclose(f) != 0)
|
|
||||||
err(1, "fclose(%s)", argv[1]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 1a. If there are no ports, there is no INDEX.
|
|
||||||
*/
|
|
||||||
if (pplen == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 2. Sort the ports according to port directory.
|
|
||||||
*/
|
|
||||||
for (i = pplen; i > 0; i--)
|
|
||||||
heapifyports(pp, pplen, i - 1); /* Build a heap */
|
|
||||||
for (i = pplen - 1; i > 0; i--) {
|
|
||||||
tmp = pp[0]; /* Extract elements */
|
|
||||||
pp[0] = pp[i];
|
|
||||||
pp[i] = tmp;
|
|
||||||
heapifyports(pp, i, 0); /* And re-heapify */
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 3. Using a binary search, translate each dependency from a
|
|
||||||
* port directory name into a pointer to a port.
|
|
||||||
*/
|
|
||||||
for (i = 0; i < pplen; i++)
|
|
||||||
translateport(pp, pplen, pp[i]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 4. Recursively follow dependencies, expanding the lists of
|
|
||||||
* pointers as needed (using realloc).
|
|
||||||
*/
|
|
||||||
for (i = 0; i < pplen; i++)
|
|
||||||
recurse(pp[i]);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 5. Iterate through the ports, printing them out (remembering
|
|
||||||
* to list the dependent ports in alphabetical order).
|
|
||||||
*/
|
|
||||||
for (i = 0; i < pplen; i++)
|
|
||||||
printport(pp[i]);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,7 +0,0 @@
|
||||||
# $FreeBSD$
|
|
||||||
|
|
||||||
CONFS= portsnap.conf
|
|
||||||
SCRIPTS=portsnap.sh
|
|
||||||
MAN= portsnap.8
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
|
|
@ -1,11 +0,0 @@
|
||||||
# $FreeBSD$
|
|
||||||
# Autogenerated - do NOT edit!
|
|
||||||
|
|
||||||
DIRDEPS = \
|
|
||||||
|
|
||||||
|
|
||||||
.include <dirdeps.mk>
|
|
||||||
|
|
||||||
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
|
|
||||||
# local dependencies - needed for -jN in clean tree
|
|
||||||
.endif
|
|
|
@ -1,288 +0,0 @@
|
||||||
.\"-
|
|
||||||
.\" Copyright 2004-2005 Colin Percival
|
|
||||||
.\" All rights reserved
|
|
||||||
.\"
|
|
||||||
.\" Redistribution and use in source and binary forms, with or without
|
|
||||||
.\" modification, are permitted providing 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 AUTHOR ``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 AUTHOR 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.
|
|
||||||
.\"
|
|
||||||
.\" $FreeBSD$
|
|
||||||
.\"
|
|
||||||
.Dd July 1, 2018
|
|
||||||
.Dt PORTSNAP 8
|
|
||||||
.Os FreeBSD
|
|
||||||
.Sh NAME
|
|
||||||
.Nm portsnap
|
|
||||||
.Nd fetch and extract compressed snapshots of the ports tree
|
|
||||||
.Sh SYNOPSIS
|
|
||||||
.Nm
|
|
||||||
.Op Fl I
|
|
||||||
.Op Fl d Ar workdir
|
|
||||||
.Op Fl f Ar conffile
|
|
||||||
.Op Fl k Ar KEY
|
|
||||||
.Op Fl l Ar descfile
|
|
||||||
.Op Fl p Ar portsdir
|
|
||||||
.Op Fl s Ar server
|
|
||||||
.Cm command ...
|
|
||||||
.Op Ar path
|
|
||||||
.Sh DESCRIPTION
|
|
||||||
The
|
|
||||||
.Nm
|
|
||||||
tool is used to fetch and update compressed snapshots
|
|
||||||
of the
|
|
||||||
.Fx
|
|
||||||
ports tree, and extract and update an
|
|
||||||
uncompressed ports tree.
|
|
||||||
.Pp
|
|
||||||
In a normal update operation,
|
|
||||||
.Nm
|
|
||||||
will routinely restore modified files to their unmodified state and
|
|
||||||
delete unrecognized local files.
|
|
||||||
.Sh OPTIONS
|
|
||||||
The following options are supported:
|
|
||||||
.Bl -tag -width "-f conffile"
|
|
||||||
.It Fl d Ar workdir
|
|
||||||
Store working files (e.g.\& downloaded updates) in
|
|
||||||
.Ar workdir .
|
|
||||||
(default:
|
|
||||||
.Pa /var/db/portsnap ,
|
|
||||||
or as given in the configuration file.)
|
|
||||||
.It Fl f Ar conffile
|
|
||||||
Read the configuration from
|
|
||||||
.Ar conffile .
|
|
||||||
(default:
|
|
||||||
.Pa /etc/portsnap.conf )
|
|
||||||
.It Fl I
|
|
||||||
For the
|
|
||||||
.Cm update
|
|
||||||
command, update INDEX files, but not the rest of the ports tree.
|
|
||||||
.It Fl k Ar KEY
|
|
||||||
Expect a public key with given SHA256 hash.
|
|
||||||
(default: read value from configuration file.)
|
|
||||||
.It Fl l Ar descfile
|
|
||||||
Merge the specified local describes file into the INDEX files being
|
|
||||||
built.
|
|
||||||
The
|
|
||||||
.Ar descfile
|
|
||||||
should be generated by running
|
|
||||||
.Cm make describe
|
|
||||||
in each of the local port directories.
|
|
||||||
.It Fl p Ar portsdir
|
|
||||||
When extracting or updating an uncompressed snapshot,
|
|
||||||
operate on the directory
|
|
||||||
.Ar portsdir .
|
|
||||||
(default:
|
|
||||||
.Pa /usr/ports/ ,
|
|
||||||
or as given in the configuration file.)
|
|
||||||
.It Fl s Ar server
|
|
||||||
Fetch files from the specified server or server pool.
|
|
||||||
(default: portsnap.FreeBSD.org, or as given in the
|
|
||||||
configuration file.)
|
|
||||||
.It path
|
|
||||||
For
|
|
||||||
.Cm extract
|
|
||||||
command only, operate only on parts of the ports tree starting with
|
|
||||||
.Ar path .
|
|
||||||
(e.g.\&
|
|
||||||
.Nm
|
|
||||||
.Cm extract
|
|
||||||
.Ar sysutils/port
|
|
||||||
would extract sysutils/portsman, sysutils/portsnap,
|
|
||||||
sysutils/portupgrade, etc.)
|
|
||||||
.It Fl Fl interactive
|
|
||||||
override auto-detection of calling process.
|
|
||||||
Only use this when calling portsnap from an
|
|
||||||
.Sy interactive, non-terminal application.
|
|
||||||
(Cron jobs are particularly bad since they cause
|
|
||||||
load spikes on the Portsnap mirrors.)
|
|
||||||
.El
|
|
||||||
.Sh COMMANDS
|
|
||||||
The
|
|
||||||
.Cm command
|
|
||||||
can be any one of the following:
|
|
||||||
.Bl -tag -width "-f conffile"
|
|
||||||
.It fetch
|
|
||||||
Fetch a compressed snapshot of the ports tree, or update
|
|
||||||
the existing snapshot.
|
|
||||||
This command should only be used interactively; for
|
|
||||||
non-interactive use, you should use the
|
|
||||||
.Cm cron
|
|
||||||
command.
|
|
||||||
.It cron
|
|
||||||
Sleep a random amount of time between 1 and 3600 seconds,
|
|
||||||
then operate as if the
|
|
||||||
.Cm fetch
|
|
||||||
command was specified.
|
|
||||||
As the name suggests, this command is designed for running
|
|
||||||
from
|
|
||||||
.Xr cron 8 ;
|
|
||||||
the random delay serves to minimize the probability that
|
|
||||||
a large number of machines will simultaneously attempt to
|
|
||||||
fetch updates.
|
|
||||||
.It extract
|
|
||||||
Extract a ports tree, replacing existing files and directories.
|
|
||||||
NOTE: This will remove anything occupying the location where
|
|
||||||
files or directories are being extracted; in particular, any
|
|
||||||
changes made locally to the ports tree (for example, adding new
|
|
||||||
patches) will be silently obliterated.
|
|
||||||
.Pp
|
|
||||||
Only run this command to initialize your portsnap-maintained
|
|
||||||
ports tree for the first time, if you wish to start over with
|
|
||||||
a clean, completely unmodified tree, or if you wish to extract
|
|
||||||
a specific part of the tree (using the
|
|
||||||
.Ar path
|
|
||||||
option).
|
|
||||||
.It update
|
|
||||||
Update a ports tree extracted using the
|
|
||||||
.Cm extract
|
|
||||||
command.
|
|
||||||
You must run this command to apply changes to your ports tree
|
|
||||||
after downloading updates via the
|
|
||||||
.Cm fetch
|
|
||||||
or
|
|
||||||
.Cm cron
|
|
||||||
commands.
|
|
||||||
Again, note that in the parts of the ports tree which are being
|
|
||||||
updated, any local changes or additions will be removed.
|
|
||||||
.It auto
|
|
||||||
Run
|
|
||||||
.Cm fetch
|
|
||||||
or
|
|
||||||
.Cm cron
|
|
||||||
depending on whether stdin is a terminal; then run
|
|
||||||
.Cm update
|
|
||||||
or
|
|
||||||
.Cm extract
|
|
||||||
depending on whether
|
|
||||||
.Ar portsdir
|
|
||||||
exists.
|
|
||||||
.El
|
|
||||||
.Sh TIPS
|
|
||||||
.Bl -bullet
|
|
||||||
.It
|
|
||||||
If your clock is set to local time, adding the line
|
|
||||||
.Pp
|
|
||||||
.Dl 0 3 * * * root /usr/sbin/portsnap cron
|
|
||||||
.Pp
|
|
||||||
to
|
|
||||||
.Pa /etc/crontab
|
|
||||||
is a good way to make sure you always have
|
|
||||||
an up-to-date snapshot of the ports tree available which
|
|
||||||
can quickly be extracted into
|
|
||||||
.Pa /usr/ports .
|
|
||||||
If your clock is set to UTC, please pick a random time other
|
|
||||||
than 3AM, to avoid overly imposing an uneven load on the
|
|
||||||
server(s) hosting the snapshots.
|
|
||||||
.Pp
|
|
||||||
Note that running
|
|
||||||
.Nm
|
|
||||||
.Cm cron
|
|
||||||
or
|
|
||||||
.Nm
|
|
||||||
.Cm fetch
|
|
||||||
does not apply the changes that were received: they only download
|
|
||||||
them.
|
|
||||||
To apply the changes, you must follow these commands with
|
|
||||||
.Nm
|
|
||||||
.Cm update .
|
|
||||||
The
|
|
||||||
.Nm
|
|
||||||
.Cm update
|
|
||||||
command is normally run by hand at a time when you are sure that
|
|
||||||
no one is manually working in the ports tree.
|
|
||||||
.It
|
|
||||||
Running
|
|
||||||
.Nm
|
|
||||||
.Cm update
|
|
||||||
from
|
|
||||||
.Xr cron 8
|
|
||||||
is a bad idea -- if you are ever installing or updating a
|
|
||||||
port at the time the cron job runs, you will probably end up
|
|
||||||
in a mess when
|
|
||||||
.Nm
|
|
||||||
updates or removes files which are being used by the port
|
|
||||||
build.
|
|
||||||
However, running
|
|
||||||
.Nm
|
|
||||||
.Fl I
|
|
||||||
.Cm update
|
|
||||||
is probably safe, and can be used together with
|
|
||||||
.Xr pkg-version 8
|
|
||||||
to identify installed software which is out of date.
|
|
||||||
.It
|
|
||||||
If you wish to use
|
|
||||||
.Nm
|
|
||||||
to keep a large number of machines up to date, you may wish
|
|
||||||
to set up a caching HTTP proxy.
|
|
||||||
Since
|
|
||||||
.Nm
|
|
||||||
uses
|
|
||||||
.Xr fetch 1
|
|
||||||
to download updates, setting the
|
|
||||||
.Ev HTTP_PROXY
|
|
||||||
environment variable will direct it to fetch updates from
|
|
||||||
the given proxy.
|
|
||||||
This is much more efficient than
|
|
||||||
.Em mirroring
|
|
||||||
the files on the portsnap server, since the vast majority
|
|
||||||
of files are not needed by any particular client.
|
|
||||||
.El
|
|
||||||
.Sh PRIVACY NOTICE
|
|
||||||
As an unavoidable part of its operation, a machine running
|
|
||||||
.Nm
|
|
||||||
will make its public IP address and the list of files it fetches
|
|
||||||
available to the server from which it fetches updates.
|
|
||||||
Using these it may be possible to recognize a machine over an extended
|
|
||||||
period of time, determine when it is updated, and identify which
|
|
||||||
portions of the FreeBSD ports tree, if any, are being ignored using
|
|
||||||
"REFUSE" directives in
|
|
||||||
.Pa portsnap.conf .
|
|
||||||
In addition, the FreeBSD release level is transmitted to the server.
|
|
||||||
.Pp
|
|
||||||
Statistical data generated from information collected in this manner
|
|
||||||
may be published, but only in aggregate and after anonymizing the
|
|
||||||
individual systems.
|
|
||||||
.Sh FILES
|
|
||||||
.Bl -tag -width "/etc/portsnap.conf"
|
|
||||||
.It Pa /etc/portsnap.conf
|
|
||||||
Default location of the portsnap configuration file.
|
|
||||||
.It Pa /var/db/portsnap
|
|
||||||
Default location where compressed snapshots are stored.
|
|
||||||
.It Pa /usr/ports
|
|
||||||
Default location where the ports tree is extracted.
|
|
||||||
.El
|
|
||||||
.Sh EXAMPLES
|
|
||||||
Fetch the snapshots and create the
|
|
||||||
.Xr ports 7
|
|
||||||
tree under
|
|
||||||
.Pa /usr/ports :
|
|
||||||
.Dl Nm Ar fetch Ar extract
|
|
||||||
.Pp
|
|
||||||
Update the ports tree:
|
|
||||||
.Dl Nm Ar fetch Ar update
|
|
||||||
.Sh SEE ALSO
|
|
||||||
.Xr fetch 1 ,
|
|
||||||
.Xr sha256 1 ,
|
|
||||||
.Xr fetch 3 ,
|
|
||||||
.Xr portsnap.conf 5 ,
|
|
||||||
.Xr pkg 7 ,
|
|
||||||
.Xr pkg-version 8
|
|
||||||
.Sh AUTHORS
|
|
||||||
.An Colin Percival Aq Mt cperciva@FreeBSD.org
|
|
|
@ -1,36 +0,0 @@
|
||||||
# $FreeBSD$
|
|
||||||
|
|
||||||
# Default directory where compressed snapshots are stored.
|
|
||||||
# WORKDIR=/var/db/portsnap
|
|
||||||
|
|
||||||
# Default location of the ports tree (target for "update" and "extract").
|
|
||||||
# PORTSDIR=/usr/ports
|
|
||||||
|
|
||||||
# Server or server pool from which to fetch updates. You can change
|
|
||||||
# this to point at a specific server if you want, but in most cases
|
|
||||||
# using a "nearby" server won't provide a measurable improvement in
|
|
||||||
# performance.
|
|
||||||
SERVERNAME=portsnap.FreeBSD.org
|
|
||||||
|
|
||||||
# Trusted keyprint. Changing this is a Bad Idea unless you've received
|
|
||||||
# a PGP-signed email from <security-officer@FreeBSD.org> telling you to
|
|
||||||
# change it and explaining why.
|
|
||||||
KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddbd64f13f978f2f3aede40c98633216c330
|
|
||||||
|
|
||||||
# Example of ignoring parts of the ports tree. If you know that you
|
|
||||||
# absolutely will not need certain parts of the tree, this will save
|
|
||||||
# some bandwidth and disk space. See the manual page for more details.
|
|
||||||
#
|
|
||||||
# WARNING: Working with an incomplete ports tree is not supported and
|
|
||||||
# can cause problems due to missing dependencies. If you have REFUSE
|
|
||||||
# directives and experience problems, remove them and update your tree
|
|
||||||
# before asking for help on the mailing lists.
|
|
||||||
#
|
|
||||||
# REFUSE arabic chinese french german hebrew hungarian japanese
|
|
||||||
# REFUSE korean polish portuguese russian ukrainian vietnamese
|
|
||||||
|
|
||||||
# List of INDEX files to build and the DESCRIBE file to use for each
|
|
||||||
#INDEX INDEX-11 DESCRIBE.11
|
|
||||||
#INDEX INDEX-12 DESCRIBE.12
|
|
||||||
#INDEX INDEX-13 DESCRIBE.13
|
|
||||||
INDEX INDEX-14 DESCRIBE.14
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue