Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Nov 2015 16:14:23 +0100
From:      Torsten Zuehlsdorff <mailinglists@toco-domains.de>
To:        Ricky G <ricky1252@hotmail.com>
Cc:        "freebsd-testing@freebsd.org" <freebsd-testing@freebsd.org>, "freebsd-ports@freebsd.org" <freebsd-ports@freebsd.org>, rodrigc@FreeBSD.org
Subject:   Re: Call for Help: need script for patching ports tree, building with poudriere
Message-ID:  <56532D4F.4090200@toco-domains.de>
In-Reply-To: <SNT146-W4271A2597FBC1A75A972A6A11A0@phx.gbl>
References:  <CAG=rPVcOb4g9DD08c7vAsor8UMf3GnckAJ2wkO37p8Ao3G2GwA@mail.gmail.com> <SNT146-W8224851E20D3E1FDA17AD4A1150@phx.gbl> <CAG=rPVfZV4kZbhG5c-%2BrjFG4vGTzMmrRasSyBQ%2BgCtY8FBEtoA@mail.gmail.com> <SNT146-W629FAF58F79486179755FEA1100@phx.gbl> <564EDE98.9070508@toco-domains.de> <SNT146-W4271A2597FBC1A75A972A6A11A0@phx.gbl>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?56532D4F.4090200>