Created
July 10, 2015 07:03
-
-
Save scop/c99941d08d7b5f5b60bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: lsbrpmlint | |
=================================================================== | |
--- lsbrpmlint (révision 0) | |
+++ lsbrpmlint (révision 0) | |
@@ -0,0 +1,14 @@ | |
+#!/bin/sh | |
+#--------------------------------------------------------------- | |
+# Project : Mandriva Linux | |
+# Module : rpmlint | |
+# File : lsbrpmlint | |
+# Version : $Id$ | |
+# Author : Frederic Lepied | |
+# Created On : Thu Jul 6 18:04:58 2006 | |
+# Purpose : Check LSB packages. | |
+#--------------------------------------------------------------- | |
+ | |
+exec rpmlint -c LSBCheck "$@" | |
+ | |
+# lsbrpmlint ends here | |
Modification de propriétés sur lsbrpmlint | |
___________________________________________________________________ | |
Nom : svn:executable | |
+ * | |
Index: LSBCheck.py | |
=================================================================== | |
--- LSBCheck.py (révision 1226) | |
+++ LSBCheck.py (copie de travail) | |
@@ -14,7 +14,9 @@ | |
import re | |
version_regex=re.compile('^[a-zA-Z0-9.+]+$') | |
-name_regex=re.compile('^[a-z0-9.+-]+$') | |
+name_regex=re.compile('^lsb-[a-z0-9.+-]+$') | |
+config_regex=re.compile('^/etc/opt/') | |
+file_regex=re.compile('^/opt/') | |
class LSBCheck(AbstractCheck.AbstractCheck): | |
@@ -22,7 +24,10 @@ | |
AbstractCheck.AbstractCheck.__init__(self, "LSBCheck") | |
def check(self, pkg): | |
- | |
+ | |
+ if pkg.isSource(): | |
+ return | |
+ | |
name=pkg.name | |
if name and not name_regex.search(name): | |
printError(pkg, 'non-lsb-compliant-package-name', name) | |
@@ -35,6 +40,44 @@ | |
if release and not version_regex.search(release): | |
printError(pkg, 'non-lsb-compliant-release', release) | |
+ format = pkg[rpm.RPMTAG_PAYLOADFORMAT] | |
+ if format != 'cpio': | |
+ printError(pkg, 'non-lsb-compliant-format', format) | |
+ | |
+ compressor = pkg[rpm.RPMTAG_PAYLOADCOMPRESSOR] | |
+ if compressor != 'gzip': | |
+ printError(pkg, 'non-lsb-compliant-compressor', compressor) | |
+ | |
+ flags = pkg[rpm.RPMTAG_PAYLOADFLAGS] | |
+ if flags != '9': | |
+ printError(pkg, 'non-lsb-compliant-flags', flags) | |
+ | |
+ os = pkg[rpm.RPMTAG_OS] | |
+ if os != 'linux': | |
+ printError(pkg, 'non-lsb-compliant-os', os) | |
+ | |
+ req = map(lambda x: x[0], pkg.requires()) | |
+ if 'lsb' not in req: | |
+ printError(pkg, 'no-dependency-on-lsb') | |
+ | |
+ summary=pkg[rpm.RPMTAG_SUMMARY] | |
+ if not summary: | |
+ printError(pkg, 'no-summary-tag') | |
+ | |
+ description=pkg[rpm.RPMTAG_DESCRIPTION] | |
+ if not description: | |
+ printError(pkg, 'no-description-tag') | |
+ | |
+ cnf=pkg.configFiles() | |
+ | |
+ for c in cnf: | |
+ if not config_regex.match(c): | |
+ printError(pkg, 'invalid-lsb-config-file', c) | |
+ | |
+ for f in pkg.files(): | |
+ if not f in cnf and not file_regex.match(f): | |
+ printError(pkg, 'invalid-lsb-path', f) | |
+ | |
# Create an object to enable the auto registration of the test | |
check=LSBCheck() | |
@@ -42,7 +85,8 @@ | |
addDetails( | |
'non-lsb-compliant-package-name', | |
"""Your package name contains an illegal character. Use only | |
-alphanumeric symbols in your package name.""", | |
+alphanumeric symbols in your package name and start your name | |
+with lsb-.""", | |
'non-lsb-compliant-version', | |
"""Your version number contains an illegal character. Use only | |
@@ -52,6 +96,46 @@ | |
"""Your version number contains an illegal character. Use only | |
lowercase letters and/or numbers.""", | |
+'non-lsb-compliant-format', | |
+'''The rpm payload must in cpio format.''', | |
+ | |
+'non-lsb-compliant-compressor', | |
+'''The rpm payload must be in gzip format. | |
+ | |
+Use the following declaration in your spec file: | |
+ | |
+%define _binary_payload w9.gzdio | |
+''', | |
+ | |
+'non-lsb-compliant-flags', | |
+'''The rpm payload must be compressed at the level 9. | |
+ | |
+Use the following declaration in your spec file: | |
+ | |
+%define _binary_payload w9.gzdio | |
+''', | |
+ | |
+'non-lsb-compliant-os', | |
+'''The os tag must be linux.''', | |
+ | |
+'no-dependency-on-lsb', | |
+'''You must have a dependency on the lsb package.''', | |
+ | |
+'no-summary-tag', | |
+'''There is no Summary tag in your package. You have to describe your package | |
+using this tag. To insert it, just insert a tag 'Summary'.''', | |
+ | |
+'no-description-tag', | |
+'''There is no %description tag in your spec file. To insert it, just insert a | |
+'%description' tag in your spec file, add a textual description of the package | |
+after it, and rebuild the package.''', | |
+ | |
+'invalid-lsb-config-file', | |
+'''LSB config files must be under /etc/opt.''', | |
+ | |
+'invalid-lsb-path', | |
+'''LSB files must be under /opt.''', | |
+ | |
) | |
# LSBCheck.py ends here | |
Index: Makefile | |
=================================================================== | |
--- Makefile (révision 1226) | |
+++ Makefile (copie de travail) | |
@@ -12,7 +12,7 @@ | |
ETCDIR=/etc | |
MANDIR=/usr/share/man | |
-FILES = rpmlint *.py INSTALL README README.devel COPYING \ | |
+FILES = rpmlint lsbrpmlint *.py INSTALL README README.devel COPYING \ | |
Makefile config rpmdiff rpmlint.bash-completion rpmlint.1 | |
GENERATED = AUTHORS ChangeLog | |
@@ -43,7 +43,7 @@ | |
else \ | |
sed -e 's/@VERSION@/$(VERSION)/' -e 's/policy=None/policy="$(POLICY)"/' < rpmlint.py > $(DESTDIR)$(LIBDIR)/rpmlint.py; \ | |
fi | |
- cp -p rpmlint rpmdiff $(DESTDIR)$(BINDIR) | |
+ cp -p lsbrpmlint rpmlint rpmdiff $(DESTDIR)$(BINDIR) | |
cp -p config $(DESTDIR)$(ETCDIR)/$(PACKAGE) | |
cp -p rpmlint.bash-completion $(DESTDIR)$(ETCDIR)/bash_completion.d/rpmlint | |
cp -p rpmlint.1 $(DESTDIR)$(MANDIR)/man1/rpmlint.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment