From b2b0e320056bc35721ad8142df7dda40dc5668d8 Mon Sep 17 00:00:00 2001 From: Olivier Mauras Date: Thu, 29 Sep 2016 02:55:33 +0200 Subject: community/salt: fix pkg.latest_version to get pkg.latest working state --- community/salt/0001-alpine-support.patch | 29 ++++++++++++++++++++++++++--- community/salt/APKBUILD | 8 ++++---- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/community/salt/0001-alpine-support.patch b/community/salt/0001-alpine-support.patch index b403431523..fcd7f2d037 100644 --- a/community/salt/0001-alpine-support.patch +++ b/community/salt/0001-alpine-support.patch @@ -2,10 +2,10 @@ Upstream code not yet released --- diff --git a/salt/modules/apk.py b/salt/modules/apk.py new file mode 100644 -index 0000000..c7cf312 +index 0000000..a45d1cf --- /dev/null +++ b/salt/modules/apk.py -@@ -0,0 +1,583 @@ +@@ -0,0 +1,606 @@ +# -*- coding: utf-8 -*- +''' +Support for apk @@ -39,7 +39,7 @@ index 0000000..c7cf312 + +def __virtual__(): + ''' -+ Confirm this module is on a nilrt based system ++ Confirm this module is running on an Alpine Linux distribution + ''' + if __grains__.get('os_family', False) == 'Alpine': + return __virtualname__ @@ -74,6 +74,7 @@ index 0000000..c7cf312 +#def info_installed(*names): +# return 'Not available' + ++ +def version(*names, **kwargs): + ''' + Returns a string representing the package version or an empty string if not @@ -191,11 +192,13 @@ index 0000000..c7cf312 + ret = {} + for name in names: + ret[name] = '' ++ pkgs = list_pkgs() + + # Refresh before looking for the latest version available + if refresh: + refresh_db() + ++ # Upgrade check + cmd = ['apk', 'upgrade', '-s'] + out = __salt__['cmd.run_stdout'](cmd, + output_loglevel='trace', @@ -210,6 +213,26 @@ index 0000000..c7cf312 + except ValueError: + pass + ++ # If version is empty, package may not be installed ++ for pkg in ret: ++ if not ret[pkg]: ++ installed = pkgs.get(pkg) ++ cmd = ['apk', 'search', pkg] ++ out = __salt__['cmd.run_stdout'](cmd, ++ output_loglevel='trace', ++ python_shell=False) ++ for line in salt.utils.itertools.split(out, '\n'): ++ try: ++ pkg_version = '-'.join(line.split('-')[-2:]) ++ pkg_name = '-'.join(line.split('-')[:-2]) ++ if (pkg == pkg_name): ++ if (installed == pkg_version): ++ ret[pkg] = '' ++ else: ++ ret[pkg] = pkg_version ++ except ValueError: ++ pass ++ + # Return a string if only one package name passed + if len(names) == 1: + return ret[names[0]] diff --git a/community/salt/APKBUILD b/community/salt/APKBUILD index eb57a40f40..82688d42b8 100644 --- a/community/salt/APKBUILD +++ b/community/salt/APKBUILD @@ -3,7 +3,7 @@ # Maintainer: Olivier Mauras pkgname=salt pkgver=2016.3.3 -pkgrel=3 +pkgrel=4 pkgdesc="A parallel remote execution system" url="https://github.com/saltstack/salt" arch="noarch" @@ -119,7 +119,7 @@ md5sums="5db25ad762a0780ff5d74561516a97fa salt-2016.3.3.tar.gz c8326b9cff0df6065a1320eefea09b2c salt-minion.initd a24d13b018a35b31b34167bcaa749db5 salt-syndic.confd dffce15d3a16a2dc40dd02d0c24fb4c6 salt-syndic.initd -ac184dd7aaf0706e69a2941a44b7a43a 0001-alpine-support.patch" +d6068875608aa1aab4bf01ac6315c766 0001-alpine-support.patch" sha256sums="7d09bc9142d96ecdfe779cf813e43ab62b9b4632f6e0711af383809661b87e1d salt-2016.3.3.tar.gz b25cfdb769305f2245b27f6753adee590bac10faeb8c43ba605dbf7e931fe258 salt-api.confd f8918f2819b81e69af1b8564b90ec370942ed733aefd4b97e5d2446a892880eb salt-api.initd @@ -129,7 +129,7 @@ f8918f2819b81e69af1b8564b90ec370942ed733aefd4b97e5d2446a892880eb salt-api.initd ae9236919c3fee3eef0ef8ad54334d6f833a51bbd4d42c40214614498acbe573 salt-minion.initd 66a663c426e2fa157ea78f7f9b2f33f17b72dbc48e119f8dd2609aab8f8370e7 salt-syndic.confd 6a453f63e51f2cc1ecb024ee8e7fa1beab7fbcea010f3eb10ea23bdb2383e7f5 salt-syndic.initd -f8f2d169706ec75f6019178ef3e53291648b816715166fb3f237195b473ad559 0001-alpine-support.patch" +5a85f5a59626b1e551b283b0289ea7551a15d0e4b3de7ef94606f0eb09758ad2 0001-alpine-support.patch" sha512sums="89a6f9e7d8a337ec5addda2374c833d251162150c4e57ce34f7f9e81a75f540539071064c0e7c4486ef6e447c6422363f868e9b035e4c5af2f3d320e98e0226d salt-2016.3.3.tar.gz 975ba2f5e681fbd62045da61cc3dc065b148683a07b5df7eca9f131e47314eb6bfa8660ca1c06a3bd93683c7097d0ff9f8e514273dd24d82fb2de6a255e6b275 salt-api.confd 435d399bfecf431d0c713031e2ae57ce25b5c6edc98b62f33bd7a4ff1c587e3cdeb988445ae0c3e9ffc1911555c3694654d98815f9562b8a14bf0688ec1ebea6 salt-api.initd @@ -139,4 +139,4 @@ cfbbeb8023a383e7c42d84e3346edfd068c9ec7650c4ddc3caa38534da325a67497e1f06ca02cc1f c6634a592c6f3e65dd2b704cb500486bf8004c5b287d4a4d42b09af36ef129c59d6a89f005af058cf7911e8587d927b3db931186569084f13ebaca56f6ef93a0 salt-minion.initd bafc6ea10cdafd0aef868feb35aecbe4ae6a7dff0ae42862bded85715ad763eb89e1ed27437866a7e5f2b9f7064e3c2a3fb59814487744ba4227238d95cf3818 salt-syndic.confd d71133e834685304e0167554035ebbc861252f972bbe981cc71e45b70f15d94a28a02a369463c9a641372919689f96b62a0408b14f824ad986d536e52b1e5ec0 salt-syndic.initd -a937cfd3d546dbb15bd7bafac63873010c6207ffffa2c83a7857c140af5806a505b75ed3959fa6ea2e2fd2a8117314e5300269826d7b808a20eda696983ef701 0001-alpine-support.patch" +4e94d90beaa3a43278d6745c36bbb41f868a09ffc38957c84351b3a6ed70527c1730033586db0f42b9f1133849ec6a187ebad1fd70eb5689647fea4ccf293e7b 0001-alpine-support.patch" -- cgit v1.2.3