Tracking Binary Ports/Pkgs Tree

Reed A. Cartwright cartwright at asu.edu
Mon Dec 1 19:02:15 UTC 2014


The attachment was stripped, so I created a gist.

https://gist.github.com/reedacartwright/8622973baf89b263a6d7

#!/bin/sh
# Copyright (c) 2014 Reed A. Cartwright <cartwright at asu.edu>
#
# This script determines the revision number used to build FreeBSD packages
# and syncs a local ports directory to match it.
#
# USAGE: sync_local_ports.sh [name or abs_path]
#
# Requirements: textproc/jq, ports-mgmt/poudriere

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

PORTSTREE=$1
if [ -z "$PORTSTREE" ]; then
    PORTSTREE="default"
fi

# If the argument is not an absolute path, use poudriere to resolve it.
# We test for absolute path by seeing if it begins with a slash.
if [ "${PORTSTREE#/}" != "${PORTSTREE}" ]; then
PORTSDIR="${PORTSTREE}"
else
PORTSDIR=`poudriere ports -ql | awk "\\\$1 == \"${PORTSTREE}\" { print \\\$3 }"`
fi

if [ ! -d "${PORTSDIR}" ]; then
>&2 echo "ERROR: Unable to resolve ports tree '${PORTSTREE}' to a directory."
exit 1
fi

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

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

if expr "$REV" : '^[[:digit:]][[:digit:]]*$' >/dev/null; then
svnlite up -r "${REV}" "${PORTSDIR}"
else
>& echo "ERROR: Unable to determine revision number for latest packages."
fi


On Mon, Dec 1, 2014 at 3:55 AM, Stefan Esser <se at freebsd.org> wrote:
> Am 01.12.2014 um 08:55 schrieb Reed A. Cartwright:
>> I turned my one liner into a script.  I've attached it; hopefully, it
>> will not be stripped.
>
>
> Hi Reed,
>
> it has been stripped ;-)
>
> Please resend with your script inline, not attached.
>
> (There are mime-types that are not stripped by the mail-list
> processor, but I forgot which types that are ...)
>
> Regards, STefan



-- 
Reed A. Cartwright, PhD
Barrett Honors Faculty
Assistant Professor of Genomics, Evolution, and Bioinformatics
School of Life Sciences
Center for Evolutionary Medicine and Informatics
The Biodesign Institute
Arizona State University
==================
Address: The Biodesign Institute, PO Box 875301, Tempe, AZ 85287-5301 USA
Packages: The Biodesign Institute, 1001 S. McAllister Ave, Tempe, AZ
85287-5301 USA
Office: Biodesign A-224A, 1-480-965-9949
Website: http://cartwrig.ht/


More information about the freebsd-ports mailing list