From owner-freebsd-testing@freebsd.org Mon Nov 23 15:14:25 2015 Return-Path: Delivered-To: freebsd-testing@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 959A6A33A80; Mon, 23 Nov 2015 15:14:25 +0000 (UTC) (envelope-from mailinglists@toco-domains.de) Received: from toco-domains.de (mail.toco-domains.de [IPv6:2a01:4f8:150:50a5::6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47B5E176D; Mon, 23 Nov 2015 15:14:25 +0000 (UTC) (envelope-from mailinglists@toco-domains.de) Received: from [0.0.0.0] (mail.toco-domains.de [IPv6:2a01:4f8:150:50a5::6]) by toco-domains.de (Postfix) with ESMTPA id 707981B22046; Mon, 23 Nov 2015 16:14:23 +0100 (CET) Subject: Re: Call for Help: need script for patching ports tree, building with poudriere To: Ricky G References: <564EDE98.9070508@toco-domains.de> Cc: "freebsd-testing@freebsd.org" , "freebsd-ports@freebsd.org" , rodrigc@FreeBSD.org From: Torsten Zuehlsdorff Message-ID: <56532D4F.4090200@toco-domains.de> Date: Mon, 23 Nov 2015 16:14:23 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-testing@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Testing on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Nov 2015 15:14:25 -0000 Hello Ricky, >> Thank you very much for your script! >> >> I took a short look at it and have some questions/suggestions: >> >> Line 119/120: There you're burning an if. I have more skill in bash >> than in sh - but is there no negation possible? > > Honestly, the main reason I started this is to just see what I could > do. Feedback is most appreciated as improving my skills is one of my > goals here. Bash and sh are extremely similar, this is most likely > lack of knowledge on my part. Do you mind explaining further? That is a good attitude :) I am doing this also just to get in touch with something new and learn. As a professional trainer there is a trick in learning: whenever a question arises - by yourself or by another person: take the chance and look for it. So you will remember the answer much better. :) If you need a programming-mentor for this project feel free to contact me off-list. To answer my own question, yes there is You wrote: === if [ -d "${PORTSDIR}" ]; then else === Which directly skips the if condition without doing something. Rewrite it with: === if ! [ -d "${PORTSDIR}" ]; then === This will test if the dir is non existent - exactly what you want! :) >> Line 162: BUILD_LIST="`(cat ${PATCH_FILE} | grep -o '^Index:[ ].*' >> | sed 's/Index: // ; s/Mk.*// ; s/Tools.*// ; s/Templates.*// ; >> s/Keywords.*//' | grep -o -e '.*\/.*\/' | sed 's/.*\/.*\/files\/$// >> ; s/\/$//' | sort | awk '!a[$0]++')`" >> >> This line is relative complicated. Is there any reason not to let >> svn do the work? Like: BUILD_LIST="`${SVN} status | grep -o -e >> '.*\/.*\/' | awk '{ print $2 }'`> Your way is faster (and more >> accurate, since i'm currently too short on time), but the other way >> would allow applying multiple patches and manual changes without >> any problems. But i'm not sure if this is really needed. > > Using the diff file instead of svn is of course faster because there > has much less data to go through. I was considering adding multiple > diff support. Going to take a closer look at this. Do you think its > more important to focus on the diff file or the port tree for > generating a build list? That is a hard question. I asked for svn because i am from Germany and facing often problems with umlauts. My lastname is "Zühlsdorff" but i rewrite it for non-german person and programs to "Zuehlsdorff". Sounds the same, means the same. Back to the core of the question: encoding problems. Can you guarantee that cat and sed work correctly on files with for example an "ü" or containing something like '合気道'? ;) Using svn avoids this problem, because in the portstree you could not find filenames with such characters. An additional though: you are assuming that everything is fine with the input. It accepts all tracks of my music folder without any hestination as a patch-file. ;) Okay, patching fails - but i tries hard and the new versions provides much binary trash through the "cat" after failing. I don't believe we must make it bullet proof. Here we need some input from Craig about the way and environment the script will be used in. > The main reason I didn't want to use the > port tree, at least in my case, is because I have so many ports that > are not sync'd with the current FreeBSD tree. Okay, but therefore you added the PORTSDIR variable? >> Line 201: svn revert -R would do the same, both of our approaches >> have a problem: the ignore for example added files. > > Yeah, I agree. This is a big problem with added patchfiles. I added a > "Hard Revert" (-R) option that I was considering making make the > default that should fix this problem. Can you check and see if it > does for you? I will check this. > I know some people maybe weary of the rm -rf command, > It is also why I added so many checks on a properly set port tree. Do > you think it would be better to just do this "Hard Revert" and remove > the other option? Thanks for the feedback! The revert option should do what they say: reverting. The technical details are the second step. As a rule of thumb: do not lie. When you claim to revert do this. If this needs an rm than do the rm. > I'v already started > working on 0.0.2! I just finished adding better failed patch output. > Going to also add a option to override the scripts portsdir, and add > support for multiple diff files, and take another look at my > BUILD_LIST to make it simpler. Keep the feed back coming please! =] That are great news :) One last question: is there any reason you choose this license? The FreeBSD license contains just the first 2 paragraphs which makes redistribution much easier. Especially paragraph 3 makes you script for example incompatible with the GNU licensed programs. https://www.freebsd.org/copyright/freebsd-license.html Greetings, Torsten