Pungis work directory.

Joel Andres Granados jgranado at redhat.com
Wed May 16 17:22:52 UTC 2007


Joel Andres Granados wrote:
> Jesse Keating wrote:
>> On Friday 13 April 2007 09:34:44 Joel Andres Granados wrote:
>>  
>>> I ran pungi once and created a fedora iso.  When I ran it again with 
>>> the
>>> same config file, and forgot to erase the previous work directory
>>> files,  pungi shows a traceback telling me that some file already 
>>> exists.
>>> I have two proposals for this situation.
>>> 1.  create a timestamp directory inside the working directory for each
>>> pungi run.   The problem with this approach is that the use is left 
>>> with
>>> a bunch of directories that are named after whatever time.time() spit
>>> out (not very pretty).  But alas it does away with the ugly traceback
>>>     
>>
>> This needs more thought as I took in a patch that separates out the 
>> different pungi tasks to be called separately, so the work dir 
>> _could_ exist in some cases.  Will think more on this.
>>
>>   
>> ------------------------------------------------------------------------
>>
>> -- 
>> Fedora-buildsys-list mailing list
>> Fedora-buildsys-list at redhat.com
>> https://www.redhat.com/mailman/listinfo/fedora-buildsys-list
> Yes, depending on the command line options, the working directory is 
> either used or not.  IMHO I think the second solution (Tell the user 
> what is happening) is the best way to go.  In this way if the 
> directory is needed and is already there the user will receive a 
> message, but if the directory is not needed pungi will be silent about 
> the situation.
> I'll revisit this patch today and see if it behaves like expected.  
> I'll post any results on the list.
>
> Regards.
>
> -- 
> Fedora-buildsys-list mailing list
> Fedora-buildsys-list at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-buildsys-list
Looked into this a little more and came up with something completely 
different than my previous post. :)

I tested to see what would happen with each if the options (-G -B -P -S 
-I)  and I found out that on G,B and I tracedback, in the other options 
it didn't.  When I tested again (I don't know why I tested two times), I 
found that the tracebacks where different in G, B and I.  So basically 
the trace backs depend on the state of the directory.  If the directory 
is in one state the traceback happens in one line, if it is in another 
state it has the possibility of occurring in another.
So I thought that the best way to fix it would be to check for the 
existence of the directory in every directory creation,  so I looked for 
every occurrence of "os.makedirs":

/usr/lib/python2.5/site-packages/pypungi/gather.py:64:            
os.makedirs(logdir)
/usr/lib/python2.5/site-packages/pypungi/gather.py:275:            
os.makedirs(pkgdir)
/usr/lib/python2.5/site-packages/pypungi/gather.py:342:            
os.makedirs(pkgdir)
/usr/lib/python2.5/site-packages/pypungi/pungi.py:45:            
os.makedirs(self.workdir)
/usr/lib/python2.5/site-packages/pypungi/pungi.py:165:        
os.makedirs(docsdir)
/usr/lib/python2.5/site-packages/pypungi/pungi.py:263:                
os.makedirs("%s-disc%d/SRPMS" % (timber.dist_dir, i))
/usr/lib/python2.5/site-packages/pypungi/pungi.py:293:            
os.makedirs('%s-disc1' % self.topdir)
/usr/lib/python2.5/site-packages/pypungi/pungi.py:320:        
os.makedirs(self.isodir)
/usr/bin/pungi:90:            os.makedirs(destdir)
/usr/bin/pungi:99:            os.makedirs(cachedir)

I just don't like it... IMO its just not right to check for the 
existence of the directory in every line!!!

So I take what I said in my last post back, and am sticking with the 
"create a new root directory for each execution" solution.  I changed it 
a little.  Instead of using time.time(), I used time.localtime()'s 
elements.  So now the directory would be something like 
"/srv/pungi/Fedora/2007-5-16-1430/..."  IMO it looks much better than 
what time.time() spits out.

The diff is attached.

Regards

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pungi-diff
Url: http://lists.fedoraproject.org/pipermail/buildsys/attachments/20070516/78ed3de8/attachment.pl 


More information about the buildsys mailing list