rpms/rpmlint/devel rpmlint.spec,1.63,1.64 rpmlint.config,1.34,1.35

Ville Skyttä scop at fedoraproject.org
Tue May 19 19:50:13 UTC 2009


Author: scop

Update of /cvs/pkgs/rpms/rpmlint/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv8550

Modified Files:
	rpmlint.spec rpmlint.config 
Log Message:
Parse list of standard users and groups from the setup package's uidgid file.


Index: rpmlint.spec
===================================================================
RCS file: /cvs/pkgs/rpms/rpmlint/devel/rpmlint.spec,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -p -r1.63 -r1.64
--- rpmlint.spec	18 May 2009 19:42:14 -0000	1.63
+++ rpmlint.spec	19 May 2009 19:49:43 -0000	1.64
@@ -68,6 +68,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Tue May 19 2009 Ville Skyttä <ville.skytta at iki.fi>
+- Parse list of standard users and groups from the setup package's uidgid file.
+
 * Mon May 18 2009 Ville Skyttä <ville.skytta at iki.fi>
 - Sync Fedora license list with Wiki revision 1.43.
 - Filter out warning about .k5login man page hiddenness (#496735).


Index: rpmlint.config
===================================================================
RCS file: /cvs/pkgs/rpms/rpmlint/devel/rpmlint.config,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -p -r1.34 -r1.35
--- rpmlint.config	18 May 2009 19:42:14 -0000	1.34
+++ rpmlint.config	19 May 2009 19:49:43 -0000	1.35
@@ -3,7 +3,12 @@
 # System wide rpmlint default configuration.  Do not modify, override/add
 # options in /etc/rpmlint/config and/or ~/.rpmlintrc as needed.
 
+import os.path
+import re
+
 from Config import *
+import Pkg
+
 
 setOption("ReleaseExtension", '\.(fc|rhe?l|el)\d+(?=\.|$)')
 setOption("UseVersionInChangeLog", 1)
@@ -234,15 +239,35 @@ setOption("ValidLicenses", (
     'Freely redistributable without restriction',
 ))
 
-# Standard users & groups from the setup package:
-setOption("StandardUsers",
-          ("root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt",
-           "mail", "news", "uucp", "operator", "games", "gopher", "ftp",
-           "nobody"))
-setOption("StandardGroups",
-          ("root", "bin", "daemon", "sys", "adm", "tty", "disk", "lp", "mem",
-           "kmem", "wheel", "mail", "news", "uucp", "man", "games", "gopher",
-           "dip", "ftp", "lock", "nobody", "users"))
+# Get standard users and groups from the setup package's uidgid file
+setOption('StandardUsers', [])
+setOption('StandardGroups', [])
+setup_pkg = None
+try:
+    setup_pkg = Pkg.InstalledPkg('setup')
+except:
+    pass
+if setup_pkg:
+    uidgid_regex = re.compile('^\s*(\S+)\s+(-|\d+)\s+(-|\d+)\s')
+    for uidgid_file in [x for x in setup_pkg.files() if x.endswith('/uidgid')]:
+        if os.path.exists(uidgid_file):
+            fobj = open(uidgid_file)
+            try:
+                for line in fobj.read().strip().splitlines():
+                    res = uidgid_regex.search(line)
+                    if res:
+                        name = res.group(1)
+                        if res.group(2) != '-':
+                            getOption('StandardUsers').append(name)
+                        if res.group(3) != '-':
+                            getOption('StandardGroups').append(name)
+                    del res
+                del line
+            finally:
+                fobj.close()
+            del fobj
+    del uidgid_regex, uidgid_file
+del setup_pkg
 
 # Output filters
 addFilter("source-or-patch-not-[bg]zipped")




More information about the scm-commits mailing list