[oe] [OE-core][PATCH v6 2/4] gpg_sign: detach_sign: fix gpg > 2.1 STDIN file descriptor
Burton, Ross
ross.burton at intel.com
Thu Feb 25 09:27:14 UTC 2016
On 22 February 2016 at 13:37, Markus Lehtonen <
markus.lehtonen at linux.intel.com> wrote:
> As far as I can tell get_gpg_version returns a string. However, you
> compare that with a float. This should give more correct behavior:
> + if gpg_ver > "2.1":
>
Not sure I'd trust that either, version comparison logic is painful.
Something like this might be more resilient to interesting versioning:
dots = versionstring.split('.')
assert len(dots) >2
if int(dots[0]) >= 2 and int(dots[1])>= 1:
Also:
+ job = subprocess.Popen([self.gpg_bin, "--version"],
stdout=subprocess.PIPE)
+ (stdout, _) = job.communicate()
+
+ if job.returncode:
+ raise bb.build.FuncFailed("Could not get gpg version (is %s
installed?)" %
+ self.gpg_bin)
+ return stdout.split()[2]
That's a long-winded way of saying:
try:
return subprocess.check_output((self.gpg_bin, "version")).split()[2]
except CalledProcessExceptionOrWhateverThisExceptionIsCalled:
raise bb.build.FuncFailed("Could not get gpg version (%s). Called %s,
output %s" % (e, e.cmd, e.output))
Ross
More information about the Openembedded-devel
mailing list