pkg upgrade question

Mike Clarke jmc-freebsd2 at milibyte.co.uk
Sun Jan 4 11:36:29 UTC 2015


On Sunday 04 Jan 2015 08:50:18 Zsolt Udvari wrote:

> If you don't care about ports tree only the repository, please use
> "pkg version -R". Check "man pkg-version" for documentation

Alternatively you can use svn or svnlite to synchronise your ports 
tree with the snapshot which was used for the packages currently in 
the repository. This is an advantage if you build some packages from 
ports since it ensures you don't get any dependency conflicts. This was 
recently  discussed in a thread in ports@ 
<https://lists.freebsd.org/pipermail/freebsd-ports/2014-November/096804.html>.
A script for synchronising the ports tree for poudriere was posted in 
<https://lists.freebsd.org/pipermail/freebsd-ports/2014-December/096833.html>.

I don't use poudriere so I've modified a copy of the script to 
synchronise /usr/ports instead of the poudriere jails.

The script works for 64 bit 10.x-RELEASE. For 8.x or 9,x you'll need 
to change the value of JAIL.

If you're using 32 bit I think you'll need to change SERVER to 
beefy1.isc.freebsd.org as well as changing JAIL but there appears to 
be a problem with the website at the moment so I can't check.

-- 
Mike Clarke
-------------- next part --------------
#!/bin/sh
# Copyright (c) 2014 Reed A. Cartwright <cartwright at asu.edu>
#
# Modified by Mike Clarke to use /usr/ports instead of poudriere
#
# This script determines the revision number used to build FreeBSD packages
# and syncs a local ports directory to match it. 
#
# USAGE: portsync
#
# REQUIREMENTS: textproc/jq

SERVER=beefy2.isc.freebsd.org
JAIL=10amd64-default

URL="http://${SERVER}/data/${JAIL}/.data.json"

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin

PORTSDIR=/usr/ports

# Fetch data from server
JSON=`fetch -qo - $URL`
if [ $? -gt 0 ]; then
	>&2 echo "ERROR: Unable to fetch data from package server."
	exit 1
fi

# Parse Revision information from server
REV=`echo "${JSON}" | jq -r '.builds[.builds.latest].svn_url | split("@")[1]'`

# Check revision information
if expr "$REV" : '^[[:digit:]][[:digit:]]*$' >/dev/null; then
	# Skip update if revisions are in sync
	CURREV=`svnlite info "${PORTSDIR}" | sed -ne '/^Revision: /s/^Revision: //p'`
	echo "====>> Updating ${PORTSDIR} from revision ${CURREV} to ${REV}"
	if [ "${CURREV}" -ne "${REV}" ]; then
		svnlite up -r "${REV}" "${PORTSDIR}"
	else 
	  echo No update needed
	fi
else
	>& echo "ERROR: Unable to determine revision number for latest packages."
	exit 1
fi


More information about the freebsd-questions mailing list