From b321e26a65bf9a2d92489dc1e4501c8b5089a5df Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Thu, 20 Sep 2012 14:14:18 +0100 Subject: [PATCH 1/5] Remove already built disabled builds from repo --- fdroidserver/update.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index a7dceaaf..ac8fc2c8 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -235,6 +235,21 @@ def main(): else: apkcache = {} cachechanged = False + + # Check repo directory for disabled builds and remove them... + for app in apps: + for build in app['builds']: + if build['commit'].startswith('!'): + apkfilename = app['id'] + '_' + str(build['vercode']) + '.apk' + apkpath = os.path.join('repo', apkfilename) + srcpath = apkfilename[:-4] + "_src.tar.gz" + for name in [apkpath, srcpath]: + if os.path.exists(name): + print "Deleting disabled build output " + apkfilename + os.remove(name) + if apkcache.has_key(apkfilename): + del apkcache[apkfilename] + apks = [] for apkfile in glob.glob(os.path.join('repo','*.apk')): From 8983aaf2f955af06d1e58eac32cc24712921f315 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Thu, 20 Sep 2012 14:14:53 +0100 Subject: [PATCH 2/5] Allow extra time for initial ssh connection to build server --- fdroidserver/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fdroidserver/build.py b/fdroidserver/build.py index dfe65cad..7c9e70a5 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -114,7 +114,7 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path): sshs = ssh.SSHClient() sshs.set_missing_host_key_policy(ssh.AutoAddPolicy()) sshs.connect(sshconfig['hostname'], username=sshconfig['user'], - port=int(sshconfig['port']), timeout=10, look_for_keys=False, + port=int(sshconfig['port']), timeout=60, look_for_keys=False, key_filename=sshconfig['identityfile']) # Get an SFTP connection... From ea8d90040ebb8d01c9ddcce47f274666a59d8a6d Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Thu, 20 Sep 2012 14:16:08 +0100 Subject: [PATCH 3/5] Handle split path srclibs properly on buildserver --- fdroidserver/build.py | 6 ++++-- fdroidserver/common.py | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 7c9e70a5..f18b308c 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -179,14 +179,16 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path): if thisbuild.has_key('srclibs'): for lib in thisbuild['srclibs'].split(';'): name, _ = lib.split('@') - srclibpaths.append((name, common.getsrclib(lib, 'build/extlib', sdk_path))) + srclibpaths.append((name, common.getsrclib(lib, 'build/extlib', sdk_path, basepath=True))) # If one was used for the main source, add that too. basesrclib = vcs.getsrclib() if basesrclib: srclibpaths.append(basesrclib) - print "Sending srclibs:" for _, lib in srclibpaths: + print "Sending srclib '" + lib + "'" ftp.chdir('/home/vagrant/build/extlib') + if not os.path.exists(lib): + raise BuildException("Missing srclib directory '" + lib + "'") send_dir(lib) # Execute the build script... diff --git a/fdroidserver/common.py b/fdroidserver/common.py index e7b62c9d..58d05bb8 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -843,10 +843,12 @@ class MetaDataException(Exception): # Get the specified source library. -# Returns the path to it. +# Returns the path to it. Normally this is the path to be used when referencing +# it, which may be a subdirectory of the actual project. If you want the base +# directory of the project, pass 'basepath=True'. # TODO: These are currently just hard-coded in this method. It will be a # metadata-driven system eventually, but not yet. -def getsrclib(spec, extlib_dir, sdk_path): +def getsrclib(spec, extlib_dir, sdk_path, basepath=False): name, ref = spec.split('@') if name == 'GreenDroid': @@ -866,6 +868,8 @@ def getsrclib(spec, extlib_dir, sdk_path): 'update', 'project', '-p', libdir]) != 0: raise BuildException('Error updating ActionBarSherlock project') + if basepath: + return sdir return libdir if name == 'Amazing-ListView': @@ -878,6 +882,8 @@ def getsrclib(spec, extlib_dir, sdk_path): 'update', 'project', '-p', libdir]) != 0: raise BuildException('Error updating Amazing-ListView project') + if basepath: + return sdir return libdir if name == 'ViewPagerIndicator': @@ -890,6 +896,8 @@ def getsrclib(spec, extlib_dir, sdk_path): 'update', 'project', '-p', libdir]) != 0: raise BuildException('Error updating Android-ViewPagerIndicator project') + if basepath: + return sdir return libdir if name == 'UITableView': @@ -902,6 +910,8 @@ def getsrclib(spec, extlib_dir, sdk_path): 'update', 'project', '-p', libdir]) != 0: raise BuildException('Error updating UITableView project') + if basepath: + return sdir return libdir if name == 'ViewPagerTabs': @@ -929,6 +939,8 @@ def getsrclib(spec, extlib_dir, sdk_path): 'update', 'project', '-p', libdir]) != 0: raise BuildException('Error updating ActionBar project') + if basepath: + return sdir return libdir if name == 'ActionBarNW': @@ -941,6 +953,8 @@ def getsrclib(spec, extlib_dir, sdk_path): 'update', 'project', '-p', libdir]) != 0: raise BuildException('Error updating ActionBarNW project') + if basepath: + return sdir return libdir if name == 'FacebookSDK': @@ -953,6 +967,8 @@ def getsrclib(spec, extlib_dir, sdk_path): 'update', 'project', '-p', libdir]) != 0: raise BuildException('Error updating FacebookSDK project') + if basepath: + return sdir return libdir if name == 'OI': From fda286b1e3ef87696879e56e078d19756283c850 Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Thu, 20 Sep 2012 14:16:30 +0100 Subject: [PATCH 4/5] Documented no nesting of lists in descriptions --- docs/fdroid.texi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/fdroid.texi b/docs/fdroid.texi index 3c866862..1e9b9182 100644 --- a/docs/fdroid.texi +++ b/docs/fdroid.texi @@ -598,7 +598,8 @@ browser or the wiki. The link text will be the apps name. Links to web addresses can be done using @code{[http://example.com Text]}. Bulletted lists are done by simply starting each item with a @code{*} on -a new line, and numbered lists are the same but using @code{#}. +a new line, and numbered lists are the same but using @code{#}. There is +currently no support for nesting lists - you can have one level only. @node Repo Type @section Repo Type From aef5b7443747841ab44a6ebb7535fa119681dd0d Mon Sep 17 00:00:00 2001 From: Ciaran Gultnieks Date: Thu, 20 Sep 2012 14:16:55 +0100 Subject: [PATCH 5/5] Added auto-update mode --- fdroidserver/checkupdates.py | 40 +++++++++++++++++++++++++++++++++--- fdroidserver/common.py | 2 ++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/fdroidserver/checkupdates.py b/fdroidserver/checkupdates.py index 1b99b085..aa7c648e 100644 --- a/fdroidserver/checkupdates.py +++ b/fdroidserver/checkupdates.py @@ -181,7 +181,9 @@ def main(): 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") + help="Check only the specified package") + parser.add_option("--auto", action="store_true", default=False, + help="Process auto-updates") (options, args) = parser.parse_args() # Get all apps... @@ -197,6 +199,8 @@ def main(): for app in apps: print "Processing " + app['id'] + '...' + writeit = False + mode = app['Update Check Mode'] if mode == 'Market': (version, vercode) = check_market(app) @@ -219,8 +223,38 @@ def main(): print '...updating to version:' + version + ' vercode:' + vercode app['Current Version'] = version app['Current Version Code'] = str(int(vercode)) - metafile = os.path.join('metadata', app['id'] + '.txt') - common.write_metadata(metafile, app) + writeit = True + + if options.auto: + mode = app['Auto Update Mode'] + if mode == 'None': + pass + elif mode.startswith('Version '): + pattern = mode[8:] + gotcur = False + latest = None + for build in app['builds']: + if build['vercode'] == app['Current Version Code']: + gotcur = True + if not latest or build['vercode'] > latest['vercode']: + latest = build + if not gotcur: + newbuild = latest.copy() + del newbuild['origlines'] + newbuild['vercode'] = app['Current Version Code'] + newbuild['version'] = app['Current Version'] + print "...auto-generating build for " + newbuild['version'] + commit = pattern.replace('%v', newbuild['version']) + commit = commit.replace('%c', newbuild['vercode']) + newbuild['commit'] = commit + app['builds'].append(newbuild) + writeit = True + else: + print 'Invalid auto update mode' + + if writeit: + metafile = os.path.join('metadata', app['id'] + '.txt') + common.write_metadata(metafile, app) print "Finished." diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 58d05bb8..3c6695ff 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -426,6 +426,7 @@ def parse_metadata(metafile, **kw): thisinfo['Disabled'] = None thisinfo['AntiFeatures'] = None thisinfo['Update Check Mode'] = 'Market' + thisinfo['Auto Update Mode'] = 'None' thisinfo['Current Version'] = '' thisinfo['Current Version Code'] = '0' thisinfo['Repo Type'] = '' @@ -594,6 +595,7 @@ def write_metadata(dest, app): mf.write('\n') if len(app['builds']) > 0: mf.write('\n') + writefield('Auto Update Mode') writefield('Update Check Mode') if len(app['Current Version']) > 0: writefield('Current Version')