[Oval-commits] r138 - trunk/oval-server/src/dsaUpdater
Pavel Vinogradov
blaze-guest at alioth.debian.org
Wed Aug 15 10:38:23 UTC 2007
Author: blaze-guest
Date: 2007-08-15 10:38:23 +0000 (Wed, 15 Aug 2007)
New Revision: 138
Modified:
trunk/oval-server/src/dsaUpdater/ftpUpdater.py
Log:
Finish ftpUpdater module
Modified: trunk/oval-server/src/dsaUpdater/ftpUpdater.py
===================================================================
--- trunk/oval-server/src/dsaUpdater/ftpUpdater.py 2007-08-15 09:21:50 UTC (rev 137)
+++ trunk/oval-server/src/dsaUpdater/ftpUpdater.py 2007-08-15 10:38:23 UTC (rev 138)
@@ -32,26 +32,42 @@
raise ftpConnectException
def __parse(self, line):
+ mtime = None
+ type = None
+
+ #year = 2007, in this case LIST return time instead of year
patern = re.compile(r'[drxr\- ]+(\d) *\d+ *\d+ *\d+ (\w+) (\d+) (\d+:\d+) (.*)')
result = patern.search(line)
if result:
+ type = result.groups()[0]
month = self.month[result.groups()[1]]
day = int(result.groups()[2])
(hour, min) = result.groups()[3].split(':')
+ file = result.groups()[4]
mtime = datetime(2007, month, day, int(hour), int(min), 0)
-
+ else:
+ #year != 2007
+ patern = re.compile(r'[drxr\- ]+(\d) *\d+ *\d+ *\d+ (\w+) (\d+) *(\d+) (.*)')
+ result = patern.search(line)
+ if result:
+ type = result.groups()[0]
+ month = self.month[result.groups()[1]]
+ day = int(result.groups()[2])
+ year = int(result.groups()[3])
+ file = result.groups()[4]
+ mtime = datetime(year, month, day, 12, 12, 0)
+ if mtime:
+ logging.critical ('File %s with mtime %s vs %s' % (file, mtime, self.actual))
if mtime > self.actual:
- if result.groups()[0] == '1':
- self.result.append(self.curdir+os.sep+result.groups()[4])
+ if type == '1':
+ self.result.append(self.curdir+os.sep+file)
else:
- if result.groups()[0] == '3':
- self.dirs.append(result.groups()[4])
+ if type == '3':
+ self.dirs.append(file)
else:
- pass
- #print result.groups()
+ logging.critical('Unknown file type: %s' % type)
else:
- #We need to parse line with date
- pass
+ logging.critical('Bad line format: %s' % line)
def __writer (self, data):
file = open (self.curfile, 'a')
@@ -109,6 +125,4 @@
upd = ftpUpdater('/debian/dsa', '/tmp/dsa', 'server')
upd.sync()
except ftpConnectException:
- logging.critical('Ftp server not available.')
-
-
\ No newline at end of file
+ logging.critical('Ftp server not available.')
\ No newline at end of file
More information about the Oval-commits
mailing list