From 4ea8b520b80d05a199a555d9be67ed8ed5ee2e06 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Thu, 25 Aug 2011 23:50:15 +0100 Subject: [PATCH] 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. --- README | 6 ------ build.py | 24 ++++++++++-------------- common.py | 6 ++---- metadata/template | 1 - update.py | 15 +-------------- 5 files changed, 13 insertions(+), 39 deletions(-) diff --git a/README b/README index 9439d8cc..14ede1a3 100644 --- a/README +++ b/README @@ -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 diff --git a/build.py b/build.py index 775d3ac4..0159e16d 100755 --- a/build.py +++ b/build.py @@ -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) diff --git a/common.py b/common.py index 7da4d5ff..94043658 100644 --- a/common.py +++ b/common.py @@ -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 diff --git a/metadata/template b/metadata/template index 1ffe6e2b..6df791e9 100644 --- a/metadata/template +++ b/metadata/template @@ -1,4 +1,3 @@ -Use Built:Yes License: Web Site: Source Code: diff --git a/update.py b/update.py index 2d05ce71..06bc9d00 100755 --- a/update.py +++ b/update.py @@ -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'] + addr = app['source'] print "WARNING: Don't have market version (" + app['marketversion'] + ") of " + app['name'] print " (" + app['id'] + ") " + addr warnings += 1 -- 2.30.2