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
[email protected]
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
[email protected]
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

--- pungi-Original/pungi        2007-05-15 16:43:54.000000000 +0200
+++ /usr/bin/pungi      2007-05-15 18:38:15.000000000 +0200
@@ -18,6 +18,7 @@
 import yum
 
 from ConfigParser import SafeConfigParser
+from time import localtime
 
 def main():
     # Set some default variables, can be overrided in config file
@@ -77,6 +78,11 @@
     if not opts.destdir == "*CONFFILE*":
         config.set('default', 'destdir', opts.destdir)
 
+    t = localtime()
+    tstamp = "%s-%s-%s-%s%s" % (t[0],t[1],t[2],t[3],t[4])
+    config.set('default', 'destdir', 
+           os.path.join(config.get('default','destdir'),tstamp))
+
     destdir = config.get('default', 'destdir')
 
     if not os.path.exists(destdir):
--
Fedora-buildsys-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/fedora-buildsys-list

Reply via email to