diff --git a/rpmlint.config b/rpmlint.config index 6e06910..fd41755 100644 --- a/rpmlint.config +++ b/rpmlint.config @@ -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") diff --git a/rpmlint.spec b/rpmlint.spec index 787e458..3c3a2dc 100644 --- a/rpmlint.spec +++ b/rpmlint.spec @@ -68,6 +68,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Tue May 19 2009 Ville Skyttä +- Parse list of standard users and groups from the setup package's uidgid file. + * Mon May 18 2009 Ville Skyttä - Sync Fedora license list with Wiki revision 1.43. - Filter out warning about .k5login man page hiddenness (#496735).