From owner-freebsd-questions@freebsd.org Mon Jul 4 16:48:02 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 8ABA7B90C39 for ; Mon, 4 Jul 2016 16:48:02 +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.225]) by mx1.freebsd.org (Postfix) with ESMTP id 5187821C9 for ; Mon, 4 Jul 2016 16:48:01 +0000 (UTC) (envelope-from baho-utot@columbus.rr.com) Received: from [75.187.32.8] ([75.187.32.8:40436] helo=raspberrypi.bildanet.com) by cdptpa-oedge02 (envelope-from ) (ecelerity 3.5.0.35861 r(Momo-dev:tip)) with ESMTP id AA/F0-12481-B339A775; Mon, 04 Jul 2016 16:47:55 +0000 Received: from [192.168.1.40] (helo=baho-utot.bildanet.com) by raspberrypi.bildanet.com with esmtp (Exim 4.84) (envelope-from ) id 1bK72I-0000l4-Ni for freebsd-questions@freebsd.org; Mon, 04 Jul 2016 12:47:54 -0400 Subject: Re: Getting port version References: To: "freebsd-questions@freebsd.org" From: Baho Utot Message-ID: Date: Mon, 4 Jul 2016 12:47:54 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: X-RR-Connecting-IP: 107.14.168.130:25 X-Cloudmark-Score: 0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.22 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:48:02 -0000 On 07/04/16 12:39, Ben Woods wrote: > On Monday, 4 July 2016, Baho Utot > wrote: > > 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? > > > I think it should be sufficient to run this from within the port > directory: > $ make -VPORTVERSION > > You can use that technique to print out any other Makefile variable > values. > > Regards, > Ben > > > -- > > -- > From: Benjamin Woods > woodsb02@gmail.com Ok I will give it a go