[PC-BSD Dev] pcbsd system source idea and question

Ken Moore ken at pcbsd.org
Thu Dec 19 06:24:18 PST 2013


On 12/19/13 09:16, Kris Moore wrote:
> On 12/19/2013 03:12, Joe Maloney wrote:
>> Here is what I've been able to come up with now for a more simple 
>> version.
>>
>> http://pastebin.com/7PHASL4S
>>
>> I've been testing and it works but it takes about 25 minutes to fetch 
>> all the source.
>>
>> I had to use something like this to make up for not being able to run 
>> to instances of prog, args in startPorts to run two git commands on 
>> after another.:
>>
>> system("git --git-dir=/usr/ports/.git fetch" );
>>
>> Otherwise they would run at the same time which would be bad.  I'm 
>> not sure of a better way to do it at this point but my gut tells me 
>> using system() might not be a great idea.
>>
>> I haven't commited this yet as it's really slow and I figured I would 
>> see what your thoughts were first.
>>
>> Joe Maloney
>>
>>
> So, to speed it up, I would add --depth=1, which will greatly speed up 
> the initial checkout.
>
> # git clone --depth=1 https://github.com/pcbsd/freebsd-ports.git
>
> I do that on my builders here and it took the checkout from 20 minutes 
> down to about 45 seconds :)
>
> As for using "system" it may be better to use QProcess::execute() 
> instead. 
-snip-

Since you are already using QProcesses, you can also have it run 
QCoreApplication::processEvents() in regular intervals while the command 
is running to prevent the GUI from hanging like this:
--------------------------
proc->start("command")
while(!proc->waitForFinished(500)){ //0.5 sec wait
   QCoreApplication::processEvents();
}
if( proc->exitCode() != 0){ qDebug() << "Error"; }
else{
   proc->start("command 2")
}
---------------------------
and repeat as necessary to run other commands in sequence.
You might want to look at the QProcess.setWorkingDirectory() function as 
well, so you might not need to run special flags for running in an 
alternate directory if you just make the process "change" into the 
directory you want to run from.

-- 
~~ Ken Moore ~~
PC-BSD/iXsystems

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pcbsd.org/pipermail/dev/attachments/20131219/c9a808a2/attachment-0001.html>


More information about the Dev mailing list