A new user interface for you! Read more...

File rpmlint-decode-fix.diff of Package rpmlint

Index: rpmlint-1.5/Pkg.py
===================================================================
--- rpmlint-1.5.orig/Pkg.py
+++ rpmlint-1.5/Pkg.py
@@ -85,7 +85,7 @@ def getstatusoutput(cmd, stdoutonly = Fa
                                 stdout=subprocess.PIPE,
                                 stderr=subprocess.STDOUT, close_fds=True)
     proc.stdin.close()
-    text = proc.stdout.read().decode()
+    text = proc.stdout.read()
     sts = proc.wait()
     if sts is None:
         sts = 0
diff -ruN rpmlint-1.5/BinariesCheck.py rpmlint-1.5.new/BinariesCheck.py
--- rpmlint-1.5/BinariesCheck.py	2014-02-27 12:06:25.018163441 +0100
+++ rpmlint-1.5.new/BinariesCheck.py	2014-02-27 12:04:14.210110261 +0100
@@ -198,7 +198,7 @@
         try:
             fobj = open(path, 'rb')
             fobj.seek(-12, 2) # 2 == os.SEEK_END, for python 2.4 compat (#172)
-            self.tail = fobj.read().decode()
+            self.tail = fobj.read()
         except Exception:
             e = sys.exc_info()[1]
             printWarning(pkg, 'binaryinfo-tail-failed %s: %s' % (file, e))
@@ -296,7 +296,7 @@
         multi_pkg = False
         srpm = pkg[rpm.RPMTAG_SOURCERPM]
         if srpm:
-            res = srcname_regex.search(srpm.decode())
+            res = srcname_regex.search(srpm)
             if res:
                 multi_pkg = (pkg.name != res.group(1))
 
diff -ruN rpmlint-1.5/DocFilesCheck.py rpmlint-1.5.new/DocFilesCheck.py
--- rpmlint-1.5/DocFilesCheck.py	2014-02-27 12:06:24.826161897 +0100
+++ rpmlint-1.5.new/DocFilesCheck.py	2014-02-27 12:04:29.681234928 +0100
@@ -44,7 +44,7 @@
 
         # register things which are provided by the package
         for i in pkg.header[rpm.RPMTAG_PROVIDES]:
-            core_reqs[i.decode()] = []
+            core_reqs[i] = []
         for i in files:
             core_reqs[i] = []
 
diff -ruN rpmlint-1.5/FilesCheck.py rpmlint-1.5.new/FilesCheck.py
--- rpmlint-1.5/FilesCheck.py	2014-02-27 12:06:25.012163393 +0100
+++ rpmlint-1.5.new/FilesCheck.py	2014-02-27 12:04:41.277328352 +0100
@@ -957,11 +957,11 @@
 
                 # Prefetch scriptlets, strip quotes from them (#169)
                 postin = (pkg[rpm.RPMTAG_POSTIN] or \
-                    pkg.scriptprog(rpm.RPMTAG_POSTINPROG)).decode()
+                    pkg.scriptprog(rpm.RPMTAG_POSTINPROG))
                 if postin:
                     postin = quotes_regex.sub('', postin)
                 postun = (pkg[rpm.RPMTAG_POSTUN] or \
-                    pkg.scriptprog(rpm.RPMTAG_POSTUNPROG)).decode()
+                    pkg.scriptprog(rpm.RPMTAG_POSTUNPROG))
                 if postun:
                     postun = quotes_regex.sub('', postun)
 
diff -ruN rpmlint-1.5/LSBCheck.py rpmlint-1.5.new/LSBCheck.py
--- rpmlint-1.5/LSBCheck.py	2014-02-27 12:06:24.827161905 +0100
+++ rpmlint-1.5.new/LSBCheck.py	2014-02-27 12:04:52.612419655 +0100
@@ -32,13 +32,11 @@
 
         version = pkg[rpm.RPMTAG_VERSION]
         if version:
-            version = version.decode()
             if not version_regex.search(version):
                 printError(pkg, 'non-lsb-compliant-version', version)
 
         release = pkg[rpm.RPMTAG_RELEASE]
         if release:
-            release = release.decode()
             if not version_regex.search(release):
                 printError(pkg, 'non-lsb-compliant-release', release)
 
diff -ruN rpmlint-1.5/Pkg.py rpmlint-1.5.new/Pkg.py
--- rpmlint-1.5/Pkg.py	2014-02-27 12:06:25.041163626 +0100
+++ rpmlint-1.5.new/Pkg.py	2014-02-27 12:03:33.599782891 +0100
@@ -448,7 +448,7 @@
                 os.close(fd)
             self.is_source = not self.header[rpm.RPMTAG_SOURCERPM]
 
-        self.name = self.header[rpm.RPMTAG_NAME].decode()
+        self.name = self.header[rpm.RPMTAG_NAME]
         if self.isNoSource():
             self.arch = 'nosrc'
         elif self.isSource():
@@ -534,7 +534,7 @@
         # LANGUAGE trumps other env vars per GNU gettext docs, see also #166
         orig = os.environ.get('LANGUAGE')
         os.environ['LANGUAGE'] = lang
-        ret = self[tag].decode()
+        ret = self[tag]
         if orig is not None:
             os.environ['LANGUAGE'] = orig
         return ret
@@ -599,17 +599,17 @@
         modes = self.header[rpm.RPMTAG_FILEMODES]
         users = self.header[rpm.RPMTAG_FILEUSERNAME]
         groups = self.header[rpm.RPMTAG_FILEGROUPNAME]
-        links = [x.decode() for x in self.header[rpm.RPMTAG_FILELINKTOS]]
+        links = self.header[rpm.RPMTAG_FILELINKTOS]
         sizes = self.header[rpm.RPMTAG_FILESIZES]
         md5s = self.header[rpm.RPMTAG_FILEMD5S]
         mtimes = self.header[rpm.RPMTAG_FILEMTIMES]
         rdevs = self.header[rpm.RPMTAG_FILERDEVS]
         langs = self.header[rpm.RPMTAG_FILELANGS]
         inodes = self.header[rpm.RPMTAG_FILEINODES]
-        requires = [x.decode() for x in self.header[rpm.RPMTAG_FILEREQUIRE]]
-        provides = [x.decode() for x in self.header[rpm.RPMTAG_FILEPROVIDE]]
-        files = [x.decode() for x in self.header[rpm.RPMTAG_FILENAMES]]
-        magics = [x.decode() for x in self.header[rpm.RPMTAG_FILECLASS]]
+        requires = self.header[rpm.RPMTAG_FILEREQUIRE]
+        provides = self.header[rpm.RPMTAG_FILEPROVIDE]
+        files = self.header[rpm.RPMTAG_FILENAMES]
+        magics = self.header[rpm.RPMTAG_FILECLASS]
         try: # rpm >= 4.7.0
             filecaps = self.header[rpm.RPMTAG_FILECAPS]
         except:
@@ -736,8 +736,8 @@
 
         if versions:
             for loop in range(len(versions)):
-                name = names[loop].decode()
-                evr = stringToVersion(versions[loop].decode())
+                name = names[loop]
+                evr = stringToVersion(versions[loop])
                 if prereq is not None and flags[loop] & PREREQ_FLAG:
                     prereq.append((name, flags[loop] & (~PREREQ_FLAG), evr))
                 elif strong_only and flags[loop] & rpm.RPMSENSE_STRONG:
diff -ruN rpmlint-1.5/rpmdiff rpmlint-1.5.new/rpmdiff
--- rpmlint-1.5/rpmdiff	2014-02-27 12:06:24.826161897 +0100
+++ rpmlint-1.5.new/rpmdiff	2014-02-27 12:03:50.387918248 +0100
@@ -228,16 +228,16 @@
                 if namestr == 'REQUIRES':
                     namestr = self.req2str(oldentry[1])
                 self.__add(self.DEPFORMAT,
-                           (self.REMOVED, namestr, oldentry[0].decode(),
-                            self.sense2str(oldentry[1]), oldentry[2].decode()))
+                           (self.REMOVED, namestr, oldentry[0],
+                            self.sense2str(oldentry[1]), oldentry[2]))
         for newentry in n:
             if not newentry in o:
                 namestr = name
                 if namestr == 'REQUIRES':
                     namestr = self.req2str(newentry[1])
                 self.__add(self.DEPFORMAT,
-                           (self.ADDED, namestr, newentry[0].decode(),
-                            self.sense2str(newentry[1]), newentry[2].decode()))
+                           (self.ADDED, namestr, newentry[0],
+                            self.sense2str(newentry[1]), newentry[2]))
 
     def __fileIteratorToDict(self, fi):
         result = {}
diff -ruN rpmlint-1.5/TagsCheck.py rpmlint-1.5.new/TagsCheck.py
--- rpmlint-1.5/TagsCheck.py	2014-02-27 12:06:25.036163586 +0100
+++ rpmlint-1.5.new/TagsCheck.py	2014-02-27 12:05:51.742895726 +0100
@@ -536,7 +536,6 @@
 
         packager = pkg[rpm.RPMTAG_PACKAGER]
         if packager:
-            packager = packager.decode()
             self._unexpanded_macros(pkg, 'Packager', packager)
             if Config.getOption('Packager') and \
                not packager_regex.search(packager):
@@ -546,7 +545,6 @@
 
         version = pkg[rpm.RPMTAG_VERSION]
         if version:
-            version = version.decode()
             self._unexpanded_macros(pkg, 'Version', version)
             res = invalid_version_regex.search(version)
             if res:
@@ -556,7 +554,6 @@
 
         release = pkg[rpm.RPMTAG_RELEASE]
         if release:
-            release = release.decode()
             self._unexpanded_macros(pkg, 'Release', release)
             if release_ext and not extension_regex.search(release):
                 printWarning(pkg, 'not-standard-release-extension', release)
@@ -688,12 +685,9 @@
         ignored_words.update((x[0] for x in pkg.obsoletes()))
 
         langs = pkg[rpm.RPMTAG_HEADERI18NTABLE]
-        if langs:
-            langs = [x.decode() for x in langs]
 
         summary = pkg[rpm.RPMTAG_SUMMARY]
         if summary:
-            summary = summary.decode()
             if not langs:
                 self._unexpanded_macros(pkg, 'Summary', summary)
             else:
@@ -704,7 +698,6 @@
 
         description = pkg[rpm.RPMTAG_DESCRIPTION]
         if description:
-            description = description.decode()
             if not langs:
                 self._unexpanded_macros(pkg, '%description', description)
             else: