cloud-init: 0.7.9 -> 20.2

This commit is contained in:
Jörg Thalheim
2020-08-18 11:49:22 +01:00
parent 4b9a2e13a8
commit 3ca2fd5520
4 changed files with 105 additions and 37 deletions
@@ -1,40 +1,83 @@
{ lib, pythonPackages, fetchurl, cloud-utils }:
{ lib
, fetchFromGitHub
, buildPythonApplication
, jinja2
, oauthlib
, configobj
, pyyaml
, requests
, jsonschema
, jsonpatch
, pytest
, httpretty
, dmidecode
, pytestCheckHook
, shadow
, cloud-utils
, openssh
}:
let version = "0.7.9";
let version = "20.2";
in pythonPackages.buildPythonApplication {
in buildPythonApplication {
pname = "cloud-init";
inherit version;
namePrefix = "";
src = fetchurl {
url = "https://launchpad.net/cloud-init/trunk/${version}/+download/cloud-init-${version}.tar.gz";
sha256 = "0wnl76pdcj754pl99wxx76hkir1s61x0bg0lh27sdgdxy45vivbn";
src = fetchFromGitHub {
owner = "canonical";
repo = "cloud-init";
rev = version;
sha256 = "sha256-QeY/fdIIUSsp5oNxyRtZwpTB747Jf5KAJuYY9yiKUvc=";
};
patches = [ ./add-nixos-support.patch ];
patches = [ ./0001-add-nixos-support.patch ];
prePatch = ''
patchShebangs ./tools
substituteInPlace setup.py --replace /lib/systemd $out/lib/systemd
'';
substituteInPlace setup.py \
--replace /usr $out \
--replace /etc $out/etc \
--replace /lib/systemd $out/lib/systemd \
--replace 'self.init_system = ""' 'self.init_system = "systemd"'
postInstall = ''
install -D -m755 ./tools/write-ssh-key-fingerprints $out/libexec/write-ssh-key-fingerprints
for i in $out/libexec/*; do
wrapProgram $i --prefix PATH : "${lib.makeBinPath [ openssh ]}"
done
'';
substituteInPlace cloudinit/config/cc_growpart.py \
--replace 'util.subp(["growpart"' 'util.subp(["${cloud-utils}/bin/growpart"'
propagatedBuildInputs = [
jinja2
oauthlib
configobj
pyyaml
requests
jsonschema
jsonpatch
];
# Argparse is part of python stdlib
sed -i s/argparse// requirements.txt
'';
checkInputs = [
pytestCheckHook
httpretty
dmidecode
# needed for tests; at runtime we rather want the setuid wrapper
shadow
];
propagatedBuildInputs = with pythonPackages; [ cheetah jinja2 prettytable
oauthlib pyserial configobj pyyaml requests jsonpatch ];
makeWrapperArgs = [
"--prefix PATH : ${lib.makeBinPath [
dmidecode cloud-utils.guest
]}/bin"
];
checkInputs = with pythonPackages; [ contextlib2 httpretty mock unittest2 ];
disabledTests = [
# tries to create /var
"test_dhclient_run_with_tmpdir"
# clears path and fails because mkdir is not found
"test_path_env_gets_set_from_main"
];
doCheck = false;
preCheck = ''
# TestTempUtils.test_mkdtemp_default_non_root does not like TMPDIR=/build
export TMPDIR=/tmp
'';
meta = {
homepage = "https://cloudinit.readthedocs.org";