Parse list of standard users and groups from the setup package's uidgid

file.
This commit is contained in:
Ville Skyttä 2009-05-19 19:49:43 +00:00
parent 9542aca479
commit 49f105abf9
2 changed files with 37 additions and 9 deletions

View File

@ -3,7 +3,12 @@
# System wide rpmlint default configuration. Do not modify, override/add # System wide rpmlint default configuration. Do not modify, override/add
# options in /etc/rpmlint/config and/or ~/.rpmlintrc as needed. # options in /etc/rpmlint/config and/or ~/.rpmlintrc as needed.
import os.path
import re
from Config import * from Config import *
import Pkg
setOption("ReleaseExtension", '\.(fc|rhe?l|el)\d+(?=\.|$)') setOption("ReleaseExtension", '\.(fc|rhe?l|el)\d+(?=\.|$)')
setOption("UseVersionInChangeLog", 1) setOption("UseVersionInChangeLog", 1)
@ -234,15 +239,35 @@ setOption("ValidLicenses", (
'Freely redistributable without restriction', 'Freely redistributable without restriction',
)) ))
# Standard users & groups from the setup package: # Get standard users and groups from the setup package's uidgid file
setOption("StandardUsers", setOption('StandardUsers', [])
("root", "bin", "daemon", "adm", "lp", "sync", "shutdown", "halt", setOption('StandardGroups', [])
"mail", "news", "uucp", "operator", "games", "gopher", "ftp", setup_pkg = None
"nobody")) try:
setOption("StandardGroups", setup_pkg = Pkg.InstalledPkg('setup')
("root", "bin", "daemon", "sys", "adm", "tty", "disk", "lp", "mem", except:
"kmem", "wheel", "mail", "news", "uucp", "man", "games", "gopher", pass
"dip", "ftp", "lock", "nobody", "users")) 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 # Output filters
addFilter("source-or-patch-not-[bg]zipped") addFilter("source-or-patch-not-[bg]zipped")

View File

@ -68,6 +68,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog %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> * Mon May 18 2009 Ville Skyttä <ville.skytta at iki.fi>
- Sync Fedora license list with Wiki revision 1.43. - Sync Fedora license list with Wiki revision 1.43.
- Filter out warning about .k5login man page hiddenness (#496735). - Filter out warning about .k5login man page hiddenness (#496735).