Skip to content

Commit

Permalink
Builder: Determine new files based on modification time
Browse files Browse the repository at this point in the history
Instead of naively looking at files that did not exist before, the
new output file detector now uses modification time as well to
determine if a file is new (and needs to be copied to the master).
  • Loading branch information
skyjake committed Apr 8, 2013
1 parent d9f5a93 commit c5269bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
16 changes: 7 additions & 9 deletions distrib/autobuild.py
Expand Up @@ -55,16 +55,13 @@ def todays_platform_release():

# We'll copy the new files to the build dir.
os.chdir(builder.config.DISTRIB_DIR)
existingFiles = os.listdir('releases')
oldFiles = DirState('releases', subdirs=False)

print 'platform_release.py...'
os.system("python platform_release.py > %s 2> %s" % ('buildlog.txt', 'builderrors.txt'))

currentFiles = os.listdir('releases')
for n in existingFiles:
currentFiles.remove(n)

for n in currentFiles:
os.system("python platform_release.py > %s 2> %s" % \
('buildlog.txt', 'builderrors.txt'))

for n in DirState('releases', subdirs=False).list_new_files(oldFiles):
# Copy any new files.
remote_copy(os.path.join('releases', n), ev.file_path(n))

Expand All @@ -74,7 +71,8 @@ def todays_platform_release():
if '_amd64' in n: arch = 'amd64'
remote_copy(os.path.join('releases', n),
os.path.join(builder.config.APT_REPO_DIR,
builder.config.APT_DIST + '/main/binary-%s' % arch, n))
builder.config.APT_DIST + \
'/main/binary-%s' % arch, n))

# Also the build logs.
remote_copy('buildlog.txt', ev.file_path('doomsday-out-%s.txt' % sys_id()))
Expand Down
5 changes: 3 additions & 2 deletions distrib/builder/utils.py
Expand Up @@ -28,8 +28,9 @@ def __repr__(self):


class DirState:
def __init__(self, path=None):
def __init__(self, path=None, subdirs=True):
self.files = {} # path -> FileState
self.subdirs = subdirs
if path:
self.update(path, path)

Expand All @@ -39,7 +40,7 @@ def update(self, path, omitted=None):
fullPath = os.path.join(path, name)
self.files[omit_path(fullPath, omitted)] = \
FileState(os.path.isdir(fullPath), os.stat(fullPath).st_mtime)
if os.path.isdir(fullPath):
if os.path.isdir(fullPath) and self.subdirs:
self.update(fullPath, omitted)

def list_new_files(self, oldState):
Expand Down

0 comments on commit c5269bb

Please sign in to comment.