From 9ffe9b92880124f75f874139f3e55f8a25f9e47d Mon Sep 17 00:00:00 2001 From: lethliel Date: Thu, 4 Oct 2018 15:17:28 +0200 Subject: [PATCH] improve error message if file is not a valid rpm The current error message is quite confusing and nobody knows what "invalid lead magic" means. --- osc/util/rpmquery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osc/util/rpmquery.py b/osc/util/rpmquery.py index 0bf2835f..597b916d 100644 --- a/osc/util/rpmquery.py +++ b/osc/util/rpmquery.py @@ -114,7 +114,7 @@ class RpmQuery(packagequery.PackageQuery, packagequery.PackageQueryResult): data = self.__file.read(self.LEAD_SIZE) leadmgc, = struct.unpack('!I', data[:4]) if leadmgc != self.LEAD_MAGIC: - raise RpmError(self.__path, 'invalid lead magic \'%s\'' % leadmgc) + raise RpmError(self.__path, 'not a rpm (invalid lead magic \'%s\')' % leadmgc) sigtype, = struct.unpack('!h', data[78:80]) if sigtype != self.HEADERSIG_TYPE: raise RpmError(self.__path, 'invalid header signature \'%s\'' % sigtype)