chiark / gitweb /
Stopped copying built files around so much
authorCiaran Gultnieks <ciaran@ciarang.com>
Thu, 25 Aug 2011 22:50:15 +0000 (23:50 +0100)
committerCiaran Gultnieks <ciaran@ciarang.com>
Thu, 25 Aug 2011 22:50:15 +0000 (23:50 +0100)
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
build.py
common.py
metadata/template
update.py

diff --git a/README b/README
index 9439d8ccaf3176ce96783815fff0b731ab4346b1..14ede1a30e9920b8a3cb204a99f0658c4fa1ca0a 100644 (file)
--- 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
index 775d3ac4923ac6bea3a580077dca91e28e9686db..0159e16dddccd6104d0f6a1f040b93addd71c772 100755 (executable)
--- 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)
 
index 7da4d5ffd079828a82754dc702b6fcff58cd9356..94043658311161d3ac5cbfc17b1118b71a58c4e1 100644 (file)
--- 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
index 1ffe6e2b5846b9b4177fa83c716732a95b03be74..6df791e974ca753f32184bcffb93b3a9e0145544 100644 (file)
@@ -1,4 +1,3 @@
-Use Built:Yes
 License:
 Web Site:
 Source Code:
index 2d05ce717a395a83e7b7a15a72ce60f3031685ba..06bc9d001cf4ca3e20d2c28fc248ad1b194c71dd 100755 (executable)
--- 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