end
execute "jessie_backports" do
- command "echo 'deb http://http.debian.net/debian jessie-backports main' > /etc/apt/sources.list.d/backports.list"
+ command "echo 'deb #{debian_mirror} jessie-backports main' > /etc/apt/sources.list.d/backports.list"
only_if "grep jessie /etc/apt/sources.list"
end
@item
Ruby (debian packages ruby and rubygems)
@item
-Vagrant (unpackaged, tested on v1.4.3)
+Vagrant (debian package vagrant - 1.4.x or higher required)
@item
vagrant-cachier plugin (unpackaged): `vagrant plugin install vagrant-cachier`
@item
# Set to True if your base box is 64 bit (e.g. testing32.box isn't)
# arch64 = True
+
+# If this is running on an older machine or on a virtualized system,
+# it can run a lot slower. If the provisioning fails with a warning
+# about the timeout, extend the timeout here. (default: 600 seconds)
+#
+# boot_timeout = 1200
p = subprocess.Popen(['vagrant', '--version'],
stdout=subprocess.PIPE)
- vver = p.communicate()[0]
+ vver = p.communicate()[0].strip().split(' ')[1]
+ if vver.split('.')[0] != '1' or int(vver.split('.')[1]) < 4:
+ raise BuildException("Unsupported vagrant version {0}".format(vver))
+
with open(os.path.join('builder', 'Vagrantfile'), 'w') as vf:
- if vver.startswith('Vagrant version 1.2'):
- vf.write('Vagrant.configure("2") do |config|\n')
- vf.write('config.vm.box = "buildserver"\n')
- vf.write('end\n')
- else:
- vf.write('Vagrant::Config.run do |config|\n')
- vf.write('config.vm.box = "buildserver"\n')
- vf.write('end\n')
+ vf.write('Vagrant.configure("2") do |config|\n')
+ vf.write('config.vm.box = "buildserver"\n')
+ vf.write('config.vm.synced_folder ".", "/vagrant", disabled: true\n')
+ vf.write('end\n')
logging.info("Starting new build server")
retcode, _ = vagrant(['up'], cwd='builder')
if matches:
vercode = matches.group(1)
else:
- xml = parse_xml(path)
- if "package" in xml.attrib:
- s = xml.attrib["package"].encode('utf-8')
- if app_matches_packagename(app, s):
- package = s
- if "{http://schemas.android.com/apk/res/android}versionName" in xml.attrib:
- version = xml.attrib["{http://schemas.android.com/apk/res/android}versionName"].encode('utf-8')
- base_dir = os.path.dirname(path)
- version = retrieve_string_singleline(base_dir, version)
- if "{http://schemas.android.com/apk/res/android}versionCode" in xml.attrib:
- a = xml.attrib["{http://schemas.android.com/apk/res/android}versionCode"].encode('utf-8')
- if string_is_integer(a):
- vercode = a
+ try:
+ xml = parse_xml(path)
+ if "package" in xml.attrib:
+ s = xml.attrib["package"].encode('utf-8')
+ if app_matches_packagename(app, s):
+ package = s
+ if "{http://schemas.android.com/apk/res/android}versionName" in xml.attrib:
+ version = xml.attrib["{http://schemas.android.com/apk/res/android}versionName"].encode('utf-8')
+ base_dir = os.path.dirname(path)
+ version = retrieve_string_singleline(base_dir, version)
+ if "{http://schemas.android.com/apk/res/android}versionCode" in xml.attrib:
+ a = xml.attrib["{http://schemas.android.com/apk/res/android}versionCode"].encode('utf-8')
+ if string_is_integer(a):
+ vercode = a
+ except Exception:
+ logging.warning("Problem with xml at {0}".format(path))
# Remember package name, may be defined separately from version+vercode
if package is None:
'--detach-sig']
if 'gpghome' in config:
gpgargs.extend(['--homedir', config['gpghome']])
+ if 'gpgkey' in config:
+ gpgargs.extend(['--local-user', config['gpgkey']])
gpgargs.append(os.path.join(output_dir, apkfilename))
p = FDroidPopen(gpgargs)
if p.returncode != 0:
'oss.sonatype.org/content/repositories/snapshots',
'oss.sonatype.org/content/repositories/releases',
'oss.sonatype.org/content/groups/public',
+ 'clojars.org/repo', # Clojure free software libs
]
]
help="Spew out even more information than normal")
parser.add_option("-c", "--clean", action="store_true", default=False,
help="Build from scratch, rather than attempting to update the existing server")
-parser.add_option("--debian-mirror", default="http://http.debian.net/debian/",
- help="Use the specified Debian mirror in the box's /etc/apt/sources.list.")
options, args = parser.parse_args()
# set up default config
+cachedir = os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver')
config = {
'arch64': False,
'basebox': 'jessie32',
- 'baseboxurl': 'https://f-droid.org/jessie32.box',
- 'cachedir': os.path.join(os.getenv('HOME'), '.cache', 'fdroidserver'),
+ # TODO in py3, convert this to pathlib.Path(absolute_path_string).as_uri()
+ 'baseboxurl': [
+ 'file://' + os.path.join(cachedir, 'jessie32.box'),
+ 'https://f-droid.org/jessie32.box',
+ ],
+ 'debian_mirror': 'http://http.debian.net/debian/',
+ 'boot_timeout': 600,
+ 'cachedir': cachedir,
'cpus': 1,
'memory': 3584,
}
v.customize ["modifyvm", :id, "--cpus", "{3}"]
end
+ config.vm.boot_timeout = {4}
+
config.vm.provision :shell, :path => "fixpaths.sh"
""".format(config['basebox'],
baseboxurl,
config['memory'],
- config.get('cpus', 1))
+ config.get('cpus', 1),
+ config['boot_timeout'])
if 'aptproxy' in config and config['aptproxy']:
vagrantfile += """
config.vm.provision :shell, :inline => 'sudo echo "Acquire::http {{ Proxy \\"{0}\\"; }};" > /etc/apt/apt.conf.d/02proxy && sudo apt-get update'
chef.add_recipe "kivy"
end
end
-""" % (options.debian_mirror)
+""" % (config['debian_mirror'])
# Check against the existing Vagrantfile, and if they differ, we need to
# create a new box: