From owner-freebsd-questions@freebsd.org Mon Jul 4 16:39:07 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 534FEB9094C for ; Mon, 4 Jul 2016 16:39:07 +0000 (UTC) (envelope-from woodsb02@gmail.com) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD6482DE7 for ; Mon, 4 Jul 2016 16:39:06 +0000 (UTC) (envelope-from woodsb02@gmail.com) Received: by mail-wm0-x236.google.com with SMTP id z126so48029169wme.0 for ; Mon, 04 Jul 2016 09:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=oIo9k5AwfGjzjGzn0KndMNrBBseO/kyoXEyDBJQS6vc=; b=MP08LUpycDfIIhT4W5Jo4TgaObjYybn2aY444uKtMH3Fz1OrTzWrtN+KfDKcpfH0jS TNf/iqpQpDMZHoF0apU2kuXrdFXeSuFtZy8q7y2oKY8h9EHewm6wbKGRLcKmxGYccnss Yl8QPGdelX71sXlZDcxU0DIjE5hmtp3C3mIqBs+hLuN0r2q4D8buGwBkz22BgJ9zv7ku VOr0DbpmLwAUPc37wg6ZWvWu/WNiJiEdbTXOanftsB0GB7xcIdwLxmRHftLb4XGs5ILT Sx5vNb9QFwd1u6JhHVoxsDNjnOGGIXFLiPDcnp7SFxnt6ukPn06QJ83vyKll53xBR/nX kNww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=oIo9k5AwfGjzjGzn0KndMNrBBseO/kyoXEyDBJQS6vc=; b=GL7kh8zZmY8TRy8/qqySh8fgkPEFOCPgNSJYv7OOn2itL4s2w05SCBtAhwK96Zvxsf 5DRr1lQl1uYYtIRH8N754iNL+2XEJWglqfmK4ku2SZMWnTQ1TOFzUSJTs4a0gzn01wIY T5l28F10cA+RhY4m8KPqA+I5+I+AoB6LMLkvfPWTxBXTmByFlmCWHx4QA2+HN9vb6zn1 1aJD72dDcYvMt6mXsqEDoGYQ1mn9tzIPAWyJG2sGocHII80D7i2qFTskuRXg8iBZJaTj LufIpJ+vTtOAl8El9jQpxvAazKq9/4qasRlQSQfMMATSAwZHkgcw8HOP8H8IZHdFFDs5 w1tw== X-Gm-Message-State: ALyK8tIx3jVigTXG+EnF5+j6+POUw/+K29/r5j73eBR7nDiHG+But7f2hpvZIAF8deu+FzuswPTapBP+XT89Aw== MIME-Version: 1.0 X-Received: by 10.28.16.193 with SMTP id 184mr12156365wmq.62.1467650345191; Mon, 04 Jul 2016 09:39:05 -0700 (PDT) Received: by 10.194.222.169 with HTTP; Mon, 4 Jul 2016 09:39:05 -0700 (PDT) In-Reply-To: References: Date: Mon, 4 Jul 2016 18:39:05 +0200 Message-ID: Subject: Re: Getting port version From: Ben Woods To: Baho Utot Cc: "freebsd-questions@freebsd.org" Content-Type: text/plain; charset=UTF-8 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:39:07 -0000 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