Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 818188 - Fix ftp-directory-name generation. r=bc

  • Loading branch information...
commit 64644494edc5a37cad7ccc5d28d4796f84aa552c 1 parent e6ded27
@markrcote markrcote authored
Showing with 17 additions and 9 deletions.
  1. +7 −7 builds.py
  2. +10 −2 trigger_runs.py
View
14 builds.py
@@ -26,34 +26,32 @@ def nightly_ftpdir(self, year, month):
month)
def ftpdirs(self, start_time, end_time):
+ logging.debug('Getting ftp dirs...')
dirs = []
y = start_time.year
m = start_time.month
- while y < end_time.year or m <= end_time.month:
+ while y < end_time.year or (y == end_time.year and m <= end_time.month):
dirs.append(self.nightly_ftpdir(y, m))
if m == 12:
y += 1
m = 1
else:
m += 1
+ logging.debug('Searching these ftp dirs: %s' % ', '.join(dirs))
return dirs
def build_info_from_ftp(self, ftpline):
srcdir = ftpline.split(' ')[-1].strip()
build_time = None
dirnamematch = None
- logging.debug('matching dir names')
for r in self.nightly_dirnames:
dirnamematch = r.match(srcdir)
if dirnamematch:
break
if dirnamematch:
- logging.debug('build time')
build_time = datetime.datetime.strptime(dirnamematch.group(1),
'%Y-%m-%d-%H-%M-%S')
build_time = build_time.replace(tzinfo=pytz.timezone('US/Pacific'))
- logging.debug('got build time')
- logging.debug('got info')
return (srcdir, build_time)
def build_date_from_url(self, url):
@@ -147,6 +145,8 @@ def find_latest_build(self, branch_name='nightly'):
return builds[-1]
def find_builds(self, start_time, end_time, branch_name='nightly'):
+ logging.debug('Finding most recent build between %s and %s...' %
+ (start_time, end_time))
branch = self.branch(branch_name)
if not branch:
logging.error('unsupported branch "%s"' % branch_name)
@@ -162,10 +162,10 @@ def find_builds(self, start_time, end_time, branch_name='nightly'):
for d in branch.ftpdirs(start_time, end_time):
url = urlparse.urlparse(d)
- logging.debug('logging into %s...' % url.netloc)
+ logging.debug('Logging into %s...' % url.netloc)
f = ftplib.FTP(url.netloc)
f.login()
- logging.debug('looking for builds in %s...' % url.path)
+ logging.debug('Looking for builds in %s...' % url.path)
lines = self.FtpLineCache()
f.dir(url.path, lines)
file('lines.out', 'w').write('\n'.join(lines.lines))
View
12 trigger_runs.py
@@ -66,8 +66,6 @@ def main(args, options):
import sys
from optparse import OptionParser
- logging.basicConfig(level=logging.INFO)
-
usage = '''%prog [options] <datetime, date/datetime, or date/datetime range>
Triggers one or more test runs.
@@ -98,8 +96,18 @@ def main(args, options):
dest='branch', default='nightly',
help='branch to search for builds, defaults to nightly;'
' can be "tinderbox" for both m-c and m-i')
+ parser.add_option('-v', '--verbose', action='store_true', dest='verbose',
+ default=False, help='verbose output')
(options, args) = parser.parse_args()
if len(args) > 2:
parser.print_help()
sys.exit(errno.EINVAL)
+
+ if options.verbose:
+ log_level = logging.DEBUG
+ else:
+ log_level = logging.INFO
+
+ logging.basicConfig(level=log_level)
+
sys.exit(main(args, options))
Please sign in to comment.
Something went wrong with that request. Please try again.