From owner-freebsd-questions@freebsd.org Mon Jul 4 16:23:38 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60880B91EE3 for ; Mon, 4 Jul 2016 16:23:38 +0000 (UTC) (envelope-from baho-utot@columbus.rr.com) Received: from cdptpa-oedge-vip.email.rr.com (cdptpa-outbound-snat.email.rr.com [107.14.166.226]) by mx1.freebsd.org (Postfix) with ESMTP id 2B6AA2051 for ; Mon, 4 Jul 2016 16:23:37 +0000 (UTC) (envelope-from baho-utot@columbus.rr.com) Received: from [75.187.32.8] ([75.187.32.8:40417] helo=raspberrypi.bildanet.com) by cdptpa-oedge02 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id DB/E2-12481-28D8A775; Mon, 04 Jul 2016 16:23:31 +0000 Received: from [192.168.1.40] (helo=baho-utot.bildanet.com) by raspberrypi.bildanet.com with esmtp (Exim 4.84) (envelope-from ) id 1bK6eg-0000jG-J1 for freebsd-questions@freebsd.org; Mon, 04 Jul 2016 12:23:30 -0400 To: freebsd-questions@freebsd.org From: Baho Utot Subject: Getting port version Message-ID: Date: Mon, 4 Jul 2016 12:23:30 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-RR-Connecting-IP: 107.14.168.130:25 X-Cloudmark-Score: 0 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jul 2016 16:23:38 -0000 I am creating a bourne script ( I would use python but that is not in base ) to build packages. Synth, poudiere etc will not work, this is for a raspberry pi 2 and those tools don't run on the platform I need to get the port version from the port 1. so I can construct a string and have a look see if that port is already in the repository 2. I want to know what version I am building I have tried: #!/bin/sh for a in "dns/unbound ports-mgmt/pkg lang/perl5.20" ; do VERSION="$( grep PORTVERSION= /usr/ports/${a}/Makefile )" printf "Package: %s Version: %s\n" "${a}" "${VERSION##*=}" done That fails because all ports don't follow that, for instance: lang/perl5.20 has PORTVERSION= ${PERL_VERSION} ports-mgmt/pkg has DISTVERSION= Is there some other way I can fetch the version from the Makefile?