salt/0031-Only-use-LONGSIZE-in-rpm.info-if-available.-Otherwis.patch
Klaus Kämpf 8bc8eaf64f Accepting request 370869 from systemsmanagement:saltstack:testing
- fix detection of base products in SLE11
  * 0030-Bugfix-on-SLE11-series-base-product-reported-as-addi.patch
- fix rpm info for SLE11
  * 0031-Only-use-LONGSIZE-in-rpm.info-if-available.-Otherwis.patch
  * 0032-Add-error-check-when-retcode-is-0-but-stderr-is-pres.patch
- fix init system detection for SLE11
  * 0033-fixing-init-system-dectection-on-sles-11-refs-31617.patch

- Re-add corrected patch:
  0029-Make-use-of-checksum-configurable-defaults-to-MD5-SH.patch

- Make checksum configurable (upstream still wants md5, we
  suggest sha256). bsc#955373
  Add:
  0029-Make-use-of-checksum-configurable-defaults-to-MD5-SH.patch

OBS-URL: https://build.opensuse.org/request/show/370869
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=62
2016-03-15 08:20:39 +00:00

43 lines
1.6 KiB
Diff

From d3d7d20b569ad1ae5bc8a7ba1ac6652aa2e47ec5 Mon Sep 17 00:00:00 2001
From: rallytime <nicole@saltstack.com>
Date: Tue, 23 Feb 2016 17:20:47 -0700
Subject: [PATCH 31/33] Only use LONGSIZE in rpm.info if available. Otherwise,
use SIZE.
Fixes #31366
---
salt/modules/rpm.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/salt/modules/rpm.py b/salt/modules/rpm.py
index 51c72c9..cdf91a6 100644
--- a/salt/modules/rpm.py
+++ b/salt/modules/rpm.py
@@ -422,6 +422,14 @@ def info(*packages, **attr):
salt '*' lowpkg.info apache2 bash attr=version
salt '*' lowpkg.info apache2 bash attr=version,build_date_iso,size
'''
+ # LONGSIZE is not a valid tag for all versions of rpm. If LONGSIZE isn't
+ # available, then we can just use SIZE for older versions. See Issue #31366.
+ rpm_tags = __salt__['cmd.run_all']('rpm --querytags')
+ rpm_tags = rpm_tags.get('stdout').split('\n')
+ if 'LONGSIZE' in rpm_tags:
+ size_tag = '%{LONGSIZE}'
+ else:
+ size_tag = '%{SIZE}'
cmd = packages and "rpm -q {0}".format(' '.join(packages)) or "rpm -qa"
@@ -440,7 +448,7 @@ def info(*packages, **attr):
"build_host": "build_host: %{BUILDHOST}\\n",
"group": "group: %{GROUP}\\n",
"source_rpm": "source_rpm: %{SOURCERPM}\\n",
- "size": "size: %{LONGSIZE}\\n",
+ "size": "size: " + size_tag + "\\n",
"arch": "arch: %{ARCH}\\n",
"license": "%|LICENSE?{license: %{LICENSE}\\n}|",
"signature": "signature: %|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:"
--
2.1.4