From 0bdfcddf380206af912d88bb04ac448ec405d597 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 31 May 2013 11:18:35 -0400 Subject: Adapt groups and added more filters - sync with latest domain list - add non-domains super groups - add util to print groups - filter out url warning - cleanup standard users/groups - add more filters Change-Id: I6ee843bd7a843a1326c22b7ec1e444bb3e63a1a5 Signed-off-by: Anas Nashif --- packaging/Config.py | 209 +++++++++++++++++++++++++++++++++++++++++++++ packaging/config | 182 ++------------------------------------- packaging/print-groups.py | 26 ++++++ packaging/rpmgroups.config | 37 ++++---- packaging/rpmlint.changes | 11 +++ packaging/rpmlint.spec | 48 +++++------ 6 files changed, 294 insertions(+), 219 deletions(-) create mode 100644 packaging/Config.py create mode 100644 packaging/print-groups.py diff --git a/packaging/Config.py b/packaging/Config.py new file mode 100644 index 0000000..ada06f8 --- /dev/null +++ b/packaging/Config.py @@ -0,0 +1,209 @@ +# -*- coding: utf-8 -*- +############################################################################# +# File : Config.py +# Package : rpmlint +# Author : Frederic Lepied +# Created on : Fri Oct 15 20:04:25 1999 +# Version : $Id: Config.py 1871 2011-06-18 09:40:52Z scop $ +# Purpose : handle configuration options. To be used from config files. +############################################################################# + +import locale +import os.path +import re + +try: + from __version__ import __version__ +except ImportError: + __version__ = 'devel' + +DEFAULT_CHECKS = ( + "TagsCheck", + "BinariesCheck", + "ConfigCheck", + "FilesCheck", + "DocFilesCheck", + "FHSCheck", + "I18NCheck", + "MenuCheck", + "PostCheck", + "InitScriptCheck", + "SourceCheck", + "SpecCheck", + "NamingPolicyCheck", + "ZipCheck", + "PamCheck", + "RpmFileCheck", + "MenuXDGCheck", + ) + +USEUTF8_DEFAULT = False +try: + if locale.getpreferredencoding() == 'UTF-8': + USEUTF8_DEFAULT = True +except: + try: + if re.match('utf', locale.getdefaultlocale()[1], re.I): + USEUTF8_DEFAULT = True + except: + pass + +info = False +no_exception = False + +# handle the list of checks to load +_checks = [] +_checks.extend(DEFAULT_CHECKS) + +def addCheck(check): + check = re.sub('\.py[co]?$', '', check) + if check not in _checks: + _checks.append(check) + +def allChecks(): + if _checks == []: + defaultChecks() + return _checks + +def defaultChecks(): + resetChecks() + _checks.extend(DEFAULT_CHECKS) + +def resetChecks(): + global _checks + + _checks = [] + +# handle the list of directories to look for checks + +_dirs = ["/usr/share/rpmlint"] + +def addCheckDir(dir): + d = os.path.expanduser(dir) + if d not in _dirs: + _dirs.insert(0, d) + +def checkDirs(): + return _dirs + +# handle options + +_options = {} + +def setOption(name, value): + _options[name] = value + +def getOption(name, default = ""): + try: + return _options[name] + except: + return default + +# List of filters +_filters = [] +_filters_re = None + +_filters_non_except = [] +_filters_non_except_re = None + +_filters_except = [] +_filters_except_re = None + +def addFilter(s): + global _filters_re + global _filters_except + + if len(_filters_except): + _filters.append(s) + _filters_re = None + else: + _filters_non_except.append(s) + _filters_non_except_re = None + + +def removeFilter(s): + global _filters_re + + try: + _filters.remove(s) + except: + pass + else: + _filters_re = None + +_scoring = {} + +def setBadness(s, score): + global _scoring + _scoring[s] = score + +def setFilterException(s): + global _filters_except + + _filters_except.append(s) + +def badness(s): + return _scoring.get(s, 0) + +_non_named_group_re = re.compile('[^\\](\()[^:]') +def isFiltered(s): + global _filters_re + global _filters_except + global _filters_except_re + global _filters_non_except + global _filters_non_except_re + + if _filters_non_except_re == None and len(_filters_non_except): + _filters_non_except_re = '(?:' + _filters_non_except[0] + ')' + + for idx in range(1, len(_filters_non_except)): + # to prevent named group overflow that happen when there is too + # many () in a single regexp: AssertionError: sorry, but this + # version only supports 100 named groups + if '(' in _filters_non_except[idx]: + _non_named_group_re.subn('(:?', _filters_non_except[idx]) + _filters_non_except_re = _filters_non_except_re + '|(?:' + _filters_non_except[idx] +')' + _filters_non_except_re = re.compile(_filters_non_except_re) + + if _filters_re == None and len(_filters): + _filters_re = '(?:' + _filters[0] + ')' + + for idx in range(1, len(_filters)): + # to prevent named group overflow that happen when there is too + # many () in a single regexp: AssertionError: sorry, but this + # version only supports 100 named groups + if '(' in _filters[idx]: + _non_named_group_re.subn('(:?', _filters[idx]) + _filters_re = _filters_re + '|(?:' + _filters[idx] +')' + _filters_re = re.compile(_filters_re) + + if _filters_except_re == None and len(_filters_except): + _filters_except_re = '(?:' + _filters_except[0] + ')' + + for idx in range(1, len(_filters_except)): + # to prevent named group overflow that happen when there is too + # many () in a single regexp: AssertionError: sorry, but this + # version only supports 100 named groups + if '(' in _filters_except[idx]: + _non_named_group_re.subn('(:?', _filters_except[idx]) + _filters_except_re = _filters_except_re + '|(?:' + _filters_except[idx] +')' + _filters_except_re = re.compile(_filters_except_re) + + if not no_exception: + + if _filters_non_except_re and _filters_non_except_re.search(s): + return True + if _filters_except_re and _filters_except_re.search(s): + return False + if _filters_re and _filters_re.search(s): + return True + + return False + +# Config.py ends here + +# Local variables: +# indent-tabs-mode: nil +# py-indent-offset: 4 +# End: +# ex: ts=4 sw=4 et diff --git a/packaging/config b/packaging/config index ab2f48a..3a6b32c 100644 --- a/packaging/config +++ b/packaging/config @@ -44,6 +44,9 @@ addCheck("CheckPAMModules") # stuff autobuild takes care about addFilter(".*no-%clean-section.*") +addFilter(".*unstripped-binary-or-object.*") +addFilter(".*devel-package-with-non-devel-group.*") +addFilter(".*no-url-tag.*") addFilter(".*tizen-filelist-forbidden-opt.*") addFilter(".*shlib-policy-missing-lib.*") addFilter(".*shlib-policy-missing-suffix.*") @@ -94,254 +97,83 @@ setOption("CompressExtension", None) setOption('UseVarLockSubsys', False) setOption('StandardGroups', ( - 'aegis', - 'antivir', 'at', 'audio', 'avahi', - 'beagleindex', - 'bigsister', 'bin', - 'casaauth', 'cdrom', - 'citadel', 'console', - 'cwbconv', 'daemon', 'dba', 'dialout', 'disk', 'distcc', - 'dosemu', - 'dovecot', - 'festival', - 'ffums', - 'firebird', 'floppy', 'ftp', 'games', - 'geronimo', - 'haclient', - 'haldaemon', - 'hsqldb', - 'icecast', - 'icecream', - 'icinga', - 'icingacmd', - 'ifdrwww', - 'intermezzo', - 'jboss', - 'jenkins', - 'jetty5', - 'jonas', 'kmem', 'kvm', 'ldap', - 'lightdm', - 'lighttpd', - 'localham', 'lp', - 'lxdm', 'mail', 'maildrop', 'mailman', 'man', - 'mdom', - 'memcached', 'messagebus', 'mktex', 'modem', - 'mumble-server', - 'nagcmd', - 'nagios', - 'named', - 'news', - 'nginx', 'nobody', 'nogroup', - 'novell_nogroup', - 'novlxtier', - 'ntadmin', 'ntop', 'ntp', - 'oinstall', - 'openstack-glance', - 'openstack-keystone', - 'openstack-nova' - 'openstack-quantum', - 'openstack-swift', - 'otrs', - 'pdns', - 'pegasus', - 'pkcs11', - 'polkituser', - 'postfix', - 'postgres', - 'pound', - 'powersave', - 'privoxy', - 'public', 'pulse', - 'pulse-access', - 'pulse-rt', - 'puppet', 'qemu', - 'quagga', - 'quasselcore', - 'radiusd', 'root', - 'sabayon-admin', - 'sapdb', 'shadow', - 'snort', 'sshd', - 'suse-ncc', 'sys', 'tftp', - 'tomcat', - 'tomcat4', - 'tor', - 'trusted', - 'tss', 'tty', 'users', 'utmp', 'uucp', 'uuidd', - 'vacation', - 'varnish', 'video', - 'vscan', 'wheel', 'www', - 'xok', - 'zeroinst', - 'znc', - 'zope', +# Tizen + 'app', )) setOption('StandardUsers', ( - 'aegis', - 'amanda', - 'asterisk', 'at', 'avahi', - 'beagleindex', - 'bigsister', 'bin', - 'bitlbee', - 'casaatsd', - 'casaatvd', - 'casaauth', - 'citadel', - 'cntlm', - 'cop', - 'cyrus', 'daemon', 'dhcpd', 'distcc', - 'dovecot', - 'dpbox', - 'dvbdaemon', - 'fax', - 'festival', - 'fetchmail', - 'ffums', - 'firebird', 'ftp', 'games', 'gdm', - 'geronimo', - 'gnats', - 'gnump3d', - 'hacluster', - 'haldaemon', - 'hsqldb', - 'icecast', - 'icecream', - 'icinga', - 'intermezzo', - 'irc', - 'jabber', - 'jboss', - 'jetty5', - 'jenkins', - 'jonas', - 'ldap', - 'lightdm', - 'lighttpd', 'lp', - 'lxdm', 'mail', 'mailman', 'man', - 'mdnsd', 'mdom', - 'memcached', 'messagebus', - 'mumble-server', - 'mysql', - 'nagios', - 'named', - 'news', - 'nginx', - 'novell_nobody', - 'novlifdr', - 'novlxregd', - 'novlxsrvd', - 'ntop', 'ntp', - 'openstack-glance', - 'openstack-keystone', - 'openstack-nova' - 'openstack-quantum', - 'openstack-swift', - 'oracle', - 'otrs', - 'partimag', - 'pdns', - 'pegasus', - 'polkituser', 'pop', 'postfix', - 'postgres', 'postgrey', 'pound', - 'privoxy', 'pulse', - 'puppet', 'qemu', - 'quagga', - 'quasselcore', - 'radiusd', - 'radvd', 'root', - 'sabayon-admin', - 'sapdb', - 'snort', - 'squid', 'sshd', - 'statd', - 'suse-ncc', 'tftp', - 'tomcat', - 'tomcat4', - 'tor', - 'tss', - 'ulogd', - 'upsd', - 'uucp', - 'uuidd', - 'vacation', - 'varnish', - 'vdr', - 'vscan', - 'wnn', 'wwwrun', - 'yastws', - 'zeroinst', - 'znc', - 'zope', +# Tizen + 'app', )) addDetails('non-standard-uid', diff --git a/packaging/print-groups.py b/packaging/print-groups.py new file mode 100644 index 0000000..d73e31a --- /dev/null +++ b/packaging/print-groups.py @@ -0,0 +1,26 @@ + +import Config +execfile("rpmgroups.config") + + +VALID_GROUPS = Config.getOption('ValidGroups', None) +VALID_DOMAINS = Config.getOption('ValidDomains', None) +VALID_SUBDOMAINS = Config.getOption('ValidSubDomains', None) +VALID_NONE_DOMAINS = Config.getOption('ValidNoneDomains', None) + +if VALID_GROUPS is None: # get defaults from rpm package only if it's not set + VALID_GROUPS = Pkg.get_default_valid_rpmgroups() +valid_groups = VALID_GROUPS +app_groups = () +for d in VALID_DOMAINS: + if d == 'Applications': + for dd in ['Multimedia', 'Social', 'Web', 'Telephony', 'Messaging', 'PIM', 'Network', 'Navigation', 'Other', 'Game', 'Tasks', 'Music', 'Photo', 'Video']: + app_groups = app_groups + ("%s/%s" %(d,dd), ) + continue + for sd in VALID_SUBDOMAINS: + valid_groups = valid_groups + ("%s/%s" %(d,sd), ) + +valid_groups = valid_groups + app_groups +valid_groups = valid_groups + VALID_NONE_DOMAINS +for g in sorted(valid_groups): + print g diff --git a/packaging/rpmgroups.config b/packaging/rpmgroups.config index fbebb31..2e26d61 100644 --- a/packaging/rpmgroups.config +++ b/packaging/rpmgroups.config @@ -65,24 +65,24 @@ setOption("ValidGroups", ( "Base/Startup" ,\ "Base/Toolchain" ,\ "Base/Hardware Adaptation", \ - "Connectivity/Bluetooth" ,\ - "Connectivity/Connection Management" ,\ - "Connectivity/DNS" ,\ - "Connectivity/HTTP" ,\ - "Connectivity/NFC" ,\ - "Connectivity/Wireless" ,\ - "Connectivity/Hardware Adaptation", \ + "Network & Connectivity/Bluetooth" ,\ + "Network & Connectivity/Connection Management" ,\ + "Network & Connectivity/DNS" ,\ + "Network & Connectivity/HTTP" ,\ + "Network & Connectivity/NFC" ,\ + "Network & Connectivity/Wireless" ,\ + "Network & Connectivity/Hardware Adaptation", \ "Development/Languages", \ "Development/Toolchain" ,\ "Development/Testing" ,\ - "Graphics/Fonts" ,\ - "Graphics/Hardware Adaptation", \ - "Graphics/Input" ,\ - "Graphics/Input Service Framework" ,\ - "Graphics/Voice Framework" ,\ - "Graphics/Wayland Window System" ,\ - "Graphics/Window Management" ,\ - "Graphics/X Window System" ,\ + "Graphics & UI Framework/Fonts" ,\ + "Graphics & UI Framework/Hardware Adaptation", \ + "Graphics & UI Framework/Input" ,\ + "Graphics & UI Framework/Input Service Framework" ,\ + "Graphics & UI Framework/Voice Framework" ,\ + "Graphics & UI Framework/Wayland Window System" ,\ + "Graphics & UI Framework/Window Management" ,\ + "Graphics & UI Framework/X Window System" ,\ "Location/Geolocation" ,\ "Messaging/Email" ,\ "Messaging/SMS" ,\ @@ -115,9 +115,6 @@ setOption("ValidGroups", ( "SDK/Hardware Adaptation", \ "Telephony/Cellular" ,\ "Telephony/Hardware Adaptation", \ - "UI Framework/Automotive" ,\ - "UI Framework/Mobile" ,\ - "UI Framework/PC" ,\ - "Web/Web Engine" ,\ - "Web/Web Run Time" ,\ + "Web Framework/Web Engine" ,\ + "Web Framework/Web Run Time" ,\ )) diff --git a/packaging/rpmlint.changes b/packaging/rpmlint.changes index 58ed3fc..51a462c 100644 --- a/packaging/rpmlint.changes +++ b/packaging/rpmlint.changes @@ -1,3 +1,14 @@ +* Thu Jul 11 2013 Anas Nashif accepted/tizen/20130710.214739@66cd3a3 +- Fixed manifest source location in the spec + +* Fri Jul 05 2013 Anas Nashif accepted/tizen/20130531.223702@3667cab +- add more filters +- cleanup standard users/groups +- filter out url warning +- util to print groups +- add non-domains super groups +- sync with latest domain list + * Fri May 31 2013 Anas Nashif submit/tizen/20130530.185839@b37d032 - Use Development/ diff --git a/packaging/rpmlint.spec b/packaging/rpmlint.spec index b8345df..3ab5e9d 100644 --- a/packaging/rpmlint.spec +++ b/packaging/rpmlint.spec @@ -1,11 +1,10 @@ Name: rpmlint -BuildRequires: python-rpm -BuildRequires: xz -Summary: Rpm correctness checker -License: GPL-2.0+ -Group: Development/Packaging Version: 1.4 Release: 0 +License: GPL-2.0+ +Summary: Rpm correctness checker +Url: http://rpmlint.zarb.org/ +Group: Development/Packaging Source0: http://rpmlint.zarb.org/download/rpmlint-%{version}.tar.bz2 Source1: rpmlint-checks-master.tar.gz Source2: config @@ -13,7 +12,9 @@ Source10: rpmgroups.config Source11: pie.config Source12: licenses.config Source100: syntax-validator.py -Url: http://rpmlint.zarb.org/ +Source1001: rpmlint.manifest +BuildRequires: python-rpm +BuildRequires: xz Requires: /usr/bin/readelf Requires: bash Requires: cpio @@ -28,13 +29,12 @@ BuildArch: noarch %description Rpmlint is a tool to check common errors on rpm packages. Binary and source packages can be checked. -Source1001: rpmlint.manifest %prep %setup -q -n rpmlint-%{version} -a1 cp %{SOURCE1001} . -cp %{S:2} . -# Only move top-level python files +cp %{SOURCE2} . +# Only move top-level python files chmod 0755 rpmlint-checks-master/*.py mv rpmlint-checks-master/*.py . @@ -42,28 +42,28 @@ mv rpmlint-checks-master/*.py . make %{?_smp_mflags} %install -make install DESTDIR=$RPM_BUILD_ROOT +%make_install # the provided bash-completion does not work and only prints bash errors -rm -rf $RPM_BUILD_ROOT/etc/bash_completion.d -mv $RPM_BUILD_ROOT/etc/rpmlint/config $RPM_BUILD_ROOT/usr/share/rpmlint/config -head -n 8 $RPM_BUILD_ROOT/usr/share/rpmlint/config > $RPM_BUILD_ROOT/etc/rpmlint/config +rm -rf %{buildroot}%{_sysconfdir}/bash_completion.d +mv %{buildroot}%{_sysconfdir}/rpmlint/config %{buildroot}%{_datadir}/rpmlint/config +head -n 8 %{buildroot}%{_datadir}/rpmlint/config > %{buildroot}%{_sysconfdir}/rpmlint/config # make sure that the package is sane -python -tt %{SOURCE100} $RPM_BUILD_ROOT/usr/share/rpmlint/*.py $RPM_BUILD_ROOT/usr/share/rpmlint/config -%__install -m 644 %{SOURCE10} %{buildroot}/%{_sysconfdir}/rpmlint/ -%__install -m 644 %{SOURCE11} %{buildroot}/%{_sysconfdir}/rpmlint/ -%__install -m 644 %{SOURCE12} %{buildroot}/%{_sysconfdir}/rpmlint/ +python -tt %{SOURCE100} %{buildroot}%{_datadir}/rpmlint/*.py %{buildroot}%{_datadir}/rpmlint/config +install -m 644 %{SOURCE10} %{buildroot}/%{_sysconfdir}/rpmlint/ +install -m 644 %{SOURCE11} %{buildroot}/%{_sysconfdir}/rpmlint/ +install -m 644 %{SOURCE12} %{buildroot}/%{_sysconfdir}/rpmlint/ %files %manifest %{name}.manifest %defattr(-,root,root,0755) -%license COPYING -%{_prefix}/bin/* -%{_prefix}/share/rpmlint -%config(noreplace) /etc/rpmlint/config -%config(noreplace) /etc/rpmlint/licenses.config +%license COPYING +%{_bindir}/* +%{_datadir}/rpmlint +%config(noreplace) %{_sysconfdir}/rpmlint/config +%config(noreplace) %{_sysconfdir}/rpmlint/licenses.config %config %{_sysconfdir}/rpmlint/rpmgroups.config %config %{_sysconfdir}/rpmlint/pie.config -%dir /etc/rpmlint -%doc /usr/share/man/man1/rpmlint.1.gz +%dir %{_sysconfdir}/rpmlint +%doc %{_mandir}/man1/rpmlint.1.gz -- cgit v1.2.3