OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Ralf S. Engelschall
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-re Date: 23-Jul-2003 17:37:36
Branch: HEAD Handle: 2003072316373500
Modified files:
openpkg-re rpmlint.pl
Log:
more checks for the binary RPMs (not all packages are pass this at
this time)
Summary:
Revision Changes Path
1.9 +45 -10 openpkg-re/rpmlint.pl
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-re/rpmlint.pl
============================================================================
$ cvs diff -u -r1.8 -r1.9 rpmlint.pl
--- openpkg-re/rpmlint.pl 22 Jul 2003 14:46:59 -0000 1.8
+++ openpkg-re/rpmlint.pl 23 Jul 2003 15:37:35 -0000 1.9
@@ -172,6 +172,10 @@
my ($filename, $checks) = @_;
my $info = {};
+ # query package name
+ &msg_verbose("++ querying RPM package name");
+ $info->{name} = `$rpm -qp --qf '%{NAME}' $filename`;
+
# query prefix
&msg_verbose("++ querying RPM package installation prefix");
$info->{prefix} = `$rpm -qp --qf '%{PREFIXES}' $filename`;
@@ -368,11 +372,42 @@
sub check_attrib {
my ($rpm, $info) = @_;
+
+ # check for empty files
+ foreach my $path (keys(%{$info->{ls}})) {
+ if ($info->{ls}->{$path}->{'size'} == 0) {
+ &lint_warning($rpm, "empty file \"$path\" found (expected no empty
files)");
+ }
+ }
+
+ # check for %config flagged files
+ my $prefix = quotemeta($info->{'prefix'});
+ my $name = quotemeta($info->{'name'});
+ foreach my $path (keys(%{$info->{ls}})) {
+ my $config = $info->{ls}->{$path}->{'config'};
+ my $path = $info->{ls}->{$path}->{'path'};
+ if ($config and $path !~ m/^$prefix\/etc\/($name\d*|fsl)\/.+/) {
+ &lint_warning($rpm, "non-config file \"$path\" flagged as \%config
(expected only \"$prefix/etc/$name/*\" files to be \%config files)");
+ }
+ if ($config and $path =~ m/^$prefix\/s?bin\/[^\/]+$/) {
+ &lint_error($rpm, "executable file \"$path\" flagged as \%config");
+ }
+ if ($config and $path =~ m/^$prefix\/etc\/rc\.d\/rc\.$name$/) {
+ &lint_error($rpm, "run-command file \"$path\" flagged as \%config");
+ }
+ }
+
+ # check for permissions
+ foreach my $path (keys(%{$info->{ls}})) {
+ my $perm = $info->{ls}->{$path}->{'perm'};
+ if ($path =~ m/^$prefix\/(bin|sbin)\/[^\/]+$/) {
+ if ($perm !~ m|^[^d]..[xs]..[xs]..[xs]$|) {
+ &lint_warning($rpm, "executable file \"$path\" has permissions
\"$perm\" only (expected it to be executable by everyone)");
+ }
+ }
+ }
- # permissions
- # user/group
- # size
- # %config flag
+ # TODO: user/group?
}
## _________________________________________________________________
@@ -384,11 +419,11 @@
sub check_content {
my ($rpm, $info) = @_;
- # stripped (file)
- # syslibs (ldd)
- # hard-coded paths pointing outside instance
- # sanity check for shebang-lines
- # contained temporary path
- # bad-files: .po
+ # TODO: stripped (file)
+ # TODO: syslibs (ldd)
+ # TODO: hard-coded paths pointing outside instance
+ # TODO: sanity check for shebang-lines
+ # TODO: contained temporary path
+ # TODO: bad-files: .po
}
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]