pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/salt salt: don't crash if no swap is configur...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ef450d561f93
branches:  trunk
changeset: 309566:ef450d561f93
user:      tpaul <tpaul%pkgsrc.org@localhost>
date:      Wed Jun 20 11:50:56 2018 +0000

description:
salt: don't crash if no swap is configured, apply pkgin module fixes

patches/patch-salt_grains_core.py:
- Reapply patch in a NetBSD/OpenBSD specific code block after package update
  to 2018.3.1, from PR pkg/53278
- upstream pull #47600

patches/patch-salt_modules_pkgin.py:
- Apply patch in pkgin specific code block from PR pkg/53344
- upstream pull #47814

bump PKGREVISION
ok <leot>

diffstat:

 sysutils/salt/Makefile                            |   3 +-
 sysutils/salt/distinfo                            |   4 +-
 sysutils/salt/patches/patch-salt_grains_core.py   |  21 ++++++++++++
 sysutils/salt/patches/patch-salt_modules_pkgin.py |  39 +++++++++++++++++++++++
 4 files changed, 65 insertions(+), 2 deletions(-)

diffs (94 lines):

diff -r 9c680b4b6756 -r ef450d561f93 sysutils/salt/Makefile
--- a/sysutils/salt/Makefile    Wed Jun 20 11:15:44 2018 +0000
+++ b/sysutils/salt/Makefile    Wed Jun 20 11:50:56 2018 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.62 2018/06/16 15:23:35 adam Exp $
+# $NetBSD: Makefile,v 1.63 2018/06/20 11:50:56 tpaul Exp $
 
 DISTNAME=      salt-2018.3.1
+PKGREVISION=   1
 CATEGORIES=    sysutils
 MASTER_SITES=  ${MASTER_SITE_PYPI:=s/salt/}
 
diff -r 9c680b4b6756 -r ef450d561f93 sysutils/salt/distinfo
--- a/sysutils/salt/distinfo    Wed Jun 20 11:15:44 2018 +0000
+++ b/sysutils/salt/distinfo    Wed Jun 20 11:50:56 2018 +0000
@@ -1,7 +1,9 @@
-$NetBSD: distinfo,v 1.36 2018/06/16 15:23:35 adam Exp $
+$NetBSD: distinfo,v 1.37 2018/06/20 11:50:56 tpaul Exp $
 
 SHA1 (salt-2018.3.1.tar.gz) = 683dc72a84cf3a19dc1a5734837cf5b2dc19ef2a
 RMD160 (salt-2018.3.1.tar.gz) = 8cc98668c98b89f9d244a665b5a9b76794754b32
 SHA512 (salt-2018.3.1.tar.gz) = 38af8f1e8673f14e62d4a01bdb734efe8a7c8ca5cde83ce652ea0b1e260fbe7e3df04e27033c915b8d10c2ac49a88e26dae83b7f27798fb6ab53054a1329a840
 Size (salt-2018.3.1.tar.gz) = 12939682 bytes
+SHA1 (patch-salt_grains_core.py) = 44c23bbfb76f86027fefcafe83e657f46f5a4871
+SHA1 (patch-salt_modules_pkgin.py) = 7c51659f740508e5b305a31eb0ab6396f522f677
 SHA1 (patch-salt_version.py) = 1827dac3609a938fae38ee5dfd2a873c9723dfbd
diff -r 9c680b4b6756 -r ef450d561f93 sysutils/salt/patches/patch-salt_grains_core.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/salt/patches/patch-salt_grains_core.py   Wed Jun 20 11:50:56 2018 +0000
@@ -0,0 +1,21 @@
+$NetBSD: patch-salt_grains_core.py,v 1.5 2018/06/20 11:50:56 tpaul Exp $
+
+Prevent crash on NetBSD and OpenBSD when no swap is configured.
+https://github.com/saltstack/salt/pull/47600
+PR: pkg/53278
+
+--- salt/grains/core.py.orig   2018-06-13 16:03:06.000000000 +0000
++++ salt/grains/core.py
+@@ -451,7 +451,11 @@ def _bsd_memdata(osdata):
+ 
+         if osdata['kernel'] in ['OpenBSD', 'NetBSD']:
+             swapctl = salt.utils.path.which('swapctl')
+-            swap_total = __salt__['cmd.run']('{0} -sk'.format(swapctl)).split(' ')[1]
++            swap_total = __salt__['cmd.run']('{0} -sk'.format(swapctl))
++            if swap_data == 'no swap devices configured':
++                swap_total = 0
++            else:
++                swap_total = swap_data.split(' ')[1]
+         else:
+             swap_total = __salt__['cmd.run']('{0} -n vm.swap_total'.format(sysctl))
+         grains['swap_total'] = int(swap_total) // 1024 // 1024
diff -r 9c680b4b6756 -r ef450d561f93 sysutils/salt/patches/patch-salt_modules_pkgin.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/salt/patches/patch-salt_modules_pkgin.py Wed Jun 20 11:50:56 2018 +0000
@@ -0,0 +1,39 @@
+$NetBSD: patch-salt_modules_pkgin.py,v 1.1 2018/06/20 11:50:56 tpaul Exp $
+
+Fixes 2 bugs in the pkgin module:
+- pkg.latest_version doesn't return a version for an uninstalled package.
+- pkg.file_dict crashes.
+https://github.com/saltstack/salt/pull/47814
+PR: pkg/53344
+
+--- salt/modules/pkgin.py.orig 2018-04-02 16:35:12.000000000 +0000
++++ salt/modules/pkgin.py
+@@ -181,7 +181,9 @@ def latest_version(*names, **kwargs):
+ 
+         out = __salt__['cmd.run'](cmd, output_loglevel='trace')
+         for line in out.splitlines():
+-            p = line.split(',' if _supports_parsing() else None)
++            if line.startswith('No results found for'):
++                return pkglist 
++            p = line.split(';' if _supports_parsing() else None)
+ 
+             if p and p[0] in ('=:', '<:', '>:', ''):
+                 # These are explanation comments
+@@ -190,7 +192,7 @@ def latest_version(*names, **kwargs):
+                 s = _splitpkg(p[0])
+                 if s:
+                     if not s[0] in pkglist:
+-                        if len(p) > 1 and p[1] == '<':
++                        if len(p) > 1 and p[1] in ('<', '', '='):
+                             pkglist[s[0]] = s[1]
+                         else:
+                             pkglist[s[0]] = ''
+@@ -681,7 +683,7 @@ def file_dict(*packages):
+                 continue  # unexpected string
+ 
+     ret = {'errors': errors, 'files': files}
+-    for field in ret:
++    for field in list(ret):
+         if not ret[field] or ret[field] == '':
+             del ret[field]
+     return ret



Home | Main Index | Thread Index | Old Index