Stopped copying built files around so much

This is much faster and less heavy on the disk space. "Use Built" is now
obsolete. If there is a built version, it's included.
This commit is contained in:
Ciaran Gultnieks 2011-08-25 23:50:15 +01:00
parent d8a0d61faa
commit 4ea8b520b8
5 changed files with 13 additions and 39 deletions

6
README
View file

@ -198,12 +198,6 @@ Another example, using extra parameters:
Build Version:1.09.03,10903,45,subdir=Timeriffic,oldsdkloc=yes
==Use Built==
Set this to "Yes" to use built versions of the application for the repository.
Currently, this just triggers update.py to copy the relevant apks and tarballs
from the 'built' directory before updating the repo index.
==AntiFeatures==
This is optional - if present, it contains a comma-separated list of any of

View file

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
#
# build.py - part of the FDroid server tools
# Copyright (C) 2010, Ciaran Gultnieks, ciaran@ciarang.com
# Copyright (C) 2010-11, Ciaran Gultnieks, ciaran@ciarang.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@ -41,20 +41,15 @@ parser.add_option("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_option("-p", "--package", default=None,
help="Build only the specified package")
parser.add_option("-c", "--clean", action="store_true", default=False,
help="Clean mode - build everything from scratch")
(options, args) = parser.parse_args()
# Get all apps...
apps = common.read_metadata(options.verbose)
#Clear and/or create the 'built' directory, depending on mode:
built_dir = 'built'
if options.clean:
if os.path.exists(built_dir):
shutil.rmtree(built_dir)
if not os.path.exists(built_dir):
os.mkdir(built_dir)
output_dir = "repo"
tmp_dir = "tmp"
if not os.path.isdir('tmp'):
os.makedirs('tmp')
if not os.path.isdir('build'):
os.makedirs('build')
@ -82,9 +77,10 @@ for app in apps:
for thisbuild in app['builds']:
dest = os.path.join(built_dir, app['id'] + '_' +
dest = os.path.join(output_dir, app['id'] + '_' +
thisbuild['vercode'] + '.apk')
dest_unsigned = dest + "_unsigned"
dest_unsigned = os.path.join(tmp_dir, app['id'] + '_' +
thisbuild['vercode'] + '_unsigned.apk')
if os.path.exists(dest):
print "..version " + thisbuild['version'] + " already exists"
@ -329,7 +325,7 @@ for app in apps:
# Build the source tarball right before we build the release...
tarname = app['id'] + '_' + thisbuild['vercode'] + '_src'
tarball = tarfile.open(os.path.join(built_dir,
tarball = tarfile.open(os.path.join(output_dir,
tarname + '.tar.gz'), "w:gz")
tarball.add(build_dir, tarname)
tarball.close()
@ -425,7 +421,7 @@ for app in apps:
print "Unexpected version/version code in output"
sys.exit(1)
# Copy the unsigned apk to our 'built' directory for further
# Copy the unsigned apk to our temp directory for further
# processing...
shutil.copyfile(src, dest_unsigned)

View file

@ -251,7 +251,6 @@ def parse_metadata(metafile, **kw):
thisinfo['repotype'] = ''
thisinfo['repo'] = ''
thisinfo['builds'] = []
thisinfo['usebuilt'] = False
thisinfo['requiresroot'] = False
mode = 0
buildline = []
@ -286,6 +285,8 @@ def parse_metadata(metafile, **kw):
thisinfo['donate'] = value
elif field == 'Disabled':
thisinfo['disabled'] = value
elif field == 'Use Built':
pass #Ignoring this - will be removed
elif field == 'AntiFeatures':
parts = value.split(",")
for part in parts:
@ -311,9 +312,6 @@ def parse_metadata(metafile, **kw):
buildline = [value[:-1]]
else:
thisinfo['builds'].append(parse_buildline(value))
elif field == "Use Built":
if value == "Yes":
thisinfo['usebuilt'] = True
elif field == "Requires Root":
if value == "Yes":
thisinfo['requiresroot'] = True

View file

@ -1,4 +1,3 @@
Use Built:Yes
License:
Web Site:
Source Code:

View file

@ -74,16 +74,6 @@ if (repo_url is None or repo_name is None or
# Get all apps...
apps = common.read_metadata(verbose=options.verbose)
# Copy apks and source tarballs for stuff we've built from source that
# is flagged to be included in the repo...
for app in apps:
if app['usebuilt']:
if not options.quiet:
print "Copying built files for " + app['id']
src = os.path.join('built', app['id'] + "_*")
for file in glob.glob(src):
shutil.copy(file, 'repo/')
# Gather information about all the apk files in the repo directory...
apks = []
for apkfile in glob.glob(os.path.join('repo','*.apk')):
@ -398,10 +388,7 @@ for app in apps:
# Output a message of harassment if we don't have the market version:
if not gotmarketver and app['marketvercode'] != '0':
if app['usebuilt']:
addr = app['source']
else:
addr = app['web']
print "WARNING: Don't have market version (" + app['marketversion'] + ") of " + app['name']
print " (" + app['id'] + ") " + addr
warnings += 1