From owner-freebsd-ports@FreeBSD.ORG Thu May 17 21:30:32 2012 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 96F6F106564A; Thu, 17 May 2012 21:30:32 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id C12D48FC0A; Thu, 17 May 2012 21:30:31 +0000 (UTC) Received: by lbon10 with SMTP id n10so2265360lbo.13 for ; Thu, 17 May 2012 14:30:30 -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:content-type; bh=PPoiO+IJf7yu6OkxO4/w/5CqGm9K0Zg5c/vdtSoMuIw=; b=kGoyQ7MuZvHAoG5G6dMTsCJtAE6rU3l2mZiqg7DraUTLzG6I4RFc05XSOHmu5s+GF+ qYst0UjXmVmMugIzsrF3faZIvCcq636ZPymcZJDyLu5HSyxwWfxqoKh+yqBEJs/WTXJb u71GB7Rq07RQIEg/NMpMJXk7omEEdRHlCjrm+0nJR9r++/76HYmnRliuP2QFY4qVCTJ7 SLbiiLrIuFBi4Wc8YSwQzS4RF0/63BVTr1cjjDd86hABk5Hw86vZjDX2nfKF+tP/aV9j fqabmlT9n8X6ok0yGwNdVZjLcgCjyxCzD86dBV8GWhf8faphYOidetAotYRjmlRT2JGZ M+DA== MIME-Version: 1.0 Received: by 10.112.39.135 with SMTP id p7mr3771015lbk.78.1337290230516; Thu, 17 May 2012 14:30:30 -0700 (PDT) Received: by 10.152.24.131 with HTTP; Thu, 17 May 2012 14:30:30 -0700 (PDT) Received: by 10.152.24.131 with HTTP; Thu, 17 May 2012 14:30:30 -0700 (PDT) In-Reply-To: References: Date: Thu, 17 May 2012 23:30:30 +0200 Message-ID: From: =?ISO-8859-1?Q?Fernando_Apestegu=EDa?= To: Chris Rees Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-ports@freebsd.org Subject: Re: On file installation X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 May 2012 21:30:32 -0000 El 17/05/2012 22:29, "Chris Rees" escribi=F3: > > On 17 May 2012 20:58, Fernando Apestegu=EDa wrote: > > On Tue, May 15, 2012 at 9:11 PM, Fernando Apestegu=EDa > > wrote: > >> On Tue, May 15, 2012 at 7:29 PM, Chris Rees wrote: > >>> On 15 May 2012 18:14, Fernando Apestegu=EDa < fernando.apesteguia@gmail.com> wrote: > >>>> On Mon, May 14, 2012 at 7:40 PM, Fernando Apestegu=EDa > >>>> wrote: > >>>>> On Mon, May 14, 2012 at 7:31 PM, Chris Rees wrote: > >>>>>> On 14 May 2012 18:23, Fernando Apestegu=EDa < fernando.apesteguia@gmail.com> wrote: > >>>>>>> Hi, > >>>>>>> > >>>>>>> I'm working on a port for an application written in Java and I'm > >>>>>>> having some problems deciding how to install the application. > >>>>>>> Previous to the installation, the WRKSRC directory contains some .jar > >>>>>>> files and some directories along with some .txt files for > >>>>>>> licenses, but also some .exe and .bat files _which I don't want t= o > >>>>>>> install_. It is basically a package that contains both files for > >>>>>>> windows and non-windows systems. > >>>>>>> > >>>>>>> I was thinking on using COPYTREE_SHARE to install everything and then > >>>>>>> remove the non necessary files, but doesn't look like > >>>>>>> an elegant solution. Also, I wouldn't like to explicitly specify every > >>>>>>> one of the files I want to copy. Is there a way of using somethin= g > >>>>>>> similar to bash's extglob so I can copy !(*.exe|*bat)? If not, how to proceed? > >>>>>>> > >>>>>>> I already looked at the existent ports to find something similar but > >>>>>>> it seems hard to find. I also had a look at bsd.port.mk but > >>>>>>> I couldn't find what I'm looking for. > >>>>>> > >>>>>> You can use find primaries with COPYTREE_SHARE such as; > >>>>>> > >>>>>> (cd ${WRKSRC}/wherever && ${COPYTREE_SHARE} \* > >>>>>> ${JAVALIBDIR}/${PORTNAME}/wherever "-not -name \*.exe -and -not -name > >>>>>> \*.bat" > >>>>> > >>>>> Thanks! I think that is what I was looking for :) > >>>> > >>>> Sorry guys, but I think I need more help :). I tried with the following line: > >>>> > >>>> ( cd ${WRKSRC}/JDownloader && ${COPYTREE_SHARE} \* > >>>> ${PREFIX}/${PORTNAME}/ "! -name \*.exe" ) > >>>> > >>>> but it doesn't seem to follow primaries and it still installs the .exe > >>>> files. I just tried with: > >>>> > >>>> ( cd ${WRKSRC}/JDownloader && ${COPYTREE_SHARE} \* > >>>> ${PREFIX}/${PORTNAME}/ "! -name JDownloader.exe" ) > >>>> > >>>> and check that effectively the file is not installed so I suppose this > >>>> has something to do with quoting and escaping special characters (th= e > >>>> asterisk). I found the following line in audio/xmp/Makefile: > >>>> > >>>> ( cd ${WRKSRC}/docs && ${COPYTREE_SHARE} \* \ > >>>> ${DOCSDIR} '! ( -name Makefile -or -name xmp.1 \ > >>>> -or -name *.bak -or -name *.orig )' ) > >>>> > >>>> that seems pretty close to what I'm trying to do, so I tried with this: > >>>> > >>>> ( cd ${WRKSRC}/JDownloader && ${COPYTREE_SHARE} \* > >>>> ${PREFIX}/${PORTNAME}/ '! ( -name *.exe )' ) > >>>> > >>>> but then, the asterisk is expanded and find fails: > >>>> > >>>> find: JDownloader.exe: unknown primary or operator > >>>> > >>>> what am I doing wrong? > >>> > >>> Escape the *; > >>> > >>> (cd ${WRKSRC}/JDownloader && ${COPYTREE_SHARE} \* ${PREFIX}/${PORTNAME}/ > >>> '! ( -name \*.exe )' ) > >> > >> That executes the following: > >> > >> (cd /usr/home/fernape/porting/jdownloader/port/work/JDownloader && > >> /bin/sh -c '(/usr/bin/find -d $0 $2 | /usr/bin/cpio -dumpl $1 > >>>/dev/null 2>&1) && /usr/sbin/chown -R root:wheel $1 && > >> /usr/bin/find -d $0 $2 -type d -exec chmod 755 $1/{} \; && > >> /usr/bin/find -d $0 $2 -type f -exec chmod 444 $1/{} \;' -- \* > >> /usr/local/jdownloader/ '! ( -name \*.exe )' ) > >> > >> which results in: > >> > >> $ ls /usr/local/jdownloader > >> > >> JDUpdate.exe JDownloaderBETA.exe jd/ > >> license.txt outdated.dat tools/ > >> windows_restore.bat > >> JDownloader.exe JDownloaderD3D.exe jdupdate.jar > >> license_german.txt plugins/ version.txt > >> JDownloader.jar java/ libs/ > >> licenses/ tmp/ windows_createlog.bat > >> > >> The .exe files are still there. > > > > Sorry or my insistence :) > > > > This is what I have in my Makefile: > > > > ( cd ${WRKSRC}/JDownloader && ${COPYTREE_SHARE} \* \ > > ${PREFIX}/${PORTNAME} '! ( -name *.exe -or -name *.dll \ > > -or -name *.bat )' ) > > > > what I've observed is that 'make install' fails with this message: > > > > find: JDownloader.exe: unknown primary or operator > > find: JDownloader.exe: unknown primary or operator > > > > However, if I replace the expression so I filter with something like > > *.txt and there is only > > one file in the directory, it works. I checked this with audio/xmp > > > > $cat Makefile > > ... > > .if !defined(NOPORTDOCS) > > ${ECHO_MSG} Installing documentation in ${DOCSDIR} > > ( cd ${WRKSRC}/docs && ${COPYTREE_SHARE} \* \ > > ${DOCSDIR} '! ( -name Makefile -or -name xmp.1 \ > > -or -name *.bak -or -name *.orig )' ) > > .endif > > > > ... > > > > $ make > > > > $ ls work/xmp-3.5.0/docs/*.bak > > work/xmp-3.5.0/docs/xmp.1.bak > > > > Only one file (make install works fine). > > > > $ touch work/xmp-3.5.0/docs/test.bak > > > > $make install > > > > =3D=3D=3D> Installing for xmp-3.5.0,1 > > =3D=3D=3D> xmp-3.5.0,1 depends on file: /usr/local/bin/unzip - found > > =3D=3D=3D> Generating temporary packing list > > =3D=3D=3D> Checking if audio/xmp already installed > > Installing xmp in /usr/local/bin > > Installing xmp.conf in /usr/local/etc/xmp > > Installing modules.conf in /usr/local/etc/xmp > > Installing manpages in /usr/local/man/man1 > > > > Installation complete. To customize, copy /usr/local/etc/xmp/xmp.conf > > and /usr/local/etc/xmp/modules.conf to $HOME/.xmp/ > > > > Installing documentation in /usr/local/share/doc/xmp > > find: xmp.1.bak: unknown primary or operator > > chown: /usr/local/share/doc/xmp: No such file or directory > > *** Error code 1 > > > > Stop in /usr/ports/audio/xmp. > > *** Error code 1 > > > > Stop in /usr/ports/audio/xmp. > > > > > > Why is this? > > > > Thanks in advances > > OK, you got me curious enough to get testing. > > The problem is that the -name *.bak expands to -name test.bak > xmp1.bak, which fails. Escaping for the shell without upsetting find > also appears non-trivial, due to the multiple levels of escaping > (Make, then sh, then sh again, then find) > > You should instead use -regex: > > (cd ${WRKSRC}/JDownloader && ${COPYTREE_SHARE} \* \ > ${PREFIX}/${PORTNAME}/ '! ( -regex .*.exe )' ) > > Hideous, but it works. (If you're unfamiliar with REs, I might point > out that you shouldn't forget the leading dot ;)) Thanks, I'll give it a try tomorrow. I'm familiar with REs, no problem there :) I'm just surprised this wasn't noticed before. After all, the whole point when using primaries is to match several files and not just one. However, find primaries are not widely used in the ports collection, maybe that's the reason. Cheers. > > Chris