[SCM] Debian package checker branch, vendor-profile, updated. 2.5.0-32-g53ce854
The following commit has been merged in the vendor-profile branch:
commit 53ce854132f43deb7c1fd0de04dfcb020585ec66
Author: Niels Thykier <niels@thykier.net>
Date: Thu Jun 2 11:34:15 2011 +0200
Use dpkg-vendor to find default profile
diff --git a/.gitignore b/.gitignore
index ce523e5..126c8f2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,5 +6,3 @@
/doc/lintian.txt
/runtests
/debian/test.locale/
-/profiles/debian/main.profile
-/profiles/debian/ftp-master-auto-reject.profile
diff --git a/frontend/lintian b/frontend/lintian
index b5f4369..343714a 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -550,11 +550,6 @@ unless (defined $LINTIAN_ARCH) {
}
}
-# Allow DEB_VENDOR as alternative to LINTIAN_PROFILE
-if (!$LINTIAN_PROFILE && $ENV{'DEB_VENDOR'}){
- $LINTIAN_PROFILE = $ENV{'DEB_VENDOR'};
-}
-
# export current settings for our helper scripts
foreach (('ROOT', 'CFG', VARS)) {
no strict 'refs';
@@ -653,18 +648,38 @@ $TAGS->sources(keys %display_source) if %display_source;
$TAGS->only(split(/,/, $check_tags)) if defined $check_tags;
$TAGS->suppress(keys %suppress_tags) if %suppress_tags;
-unless (defined $check_tags || %suppress_tags){
- if ($LINTIAN_PROFILE) {
- my $profile = Lintian::Profile->new($LINTIAN_PROFILE,
- [PROFILE_PATH, "$LINTIAN_ROOT/profiles"]);
- my @ptags = $profile->tags;
- my @ign_overrides = $profile->ignored_overrides;
- v_msg('Using profile ' . $profile->name . '.');
- $TAGS->only(@ptags) if @ptags;
- $TAGS->ignore_overrides(@ign_overrides) if @ign_overrides;
+if (defined $check_tags || %suppress_tags) {
+ # No profile if we have been given explicit list
+ $LINTIAN_PROFILE = ''
+} else {
+ unless ($LINTIAN_PROFILE){
+ # Time to ask dpkg-vendor for a vendor name
+ my ($vendor, $orig);
+ chomp($orig = `dpkg-vendor --query Vendor`);
+ $vendor = $orig;
+ while ($vendor) {
+ my $p;
+ v_msg("Checking for default profile for $vendor.");
+ $p = Lintian::Profile->find_profile(lc($vendor), PROFILE_PATH, "$LINTIAN_ROOT/profiles");
+ last if $p;
+ chomp($vendor = `dpkg-vendor --vendor "$vendor" --query Parent`);
+ }
+ fail("Could not find a profile for vendor $orig") unless $vendor;
+ $LINTIAN_PROFILE = lc($vendor);
+ v_msg("Found default profile for vendor $orig");
}
}
+if ($LINTIAN_PROFILE) {
+ my $profile = Lintian::Profile->new($LINTIAN_PROFILE,
+ [PROFILE_PATH, "$LINTIAN_ROOT/profiles"]);
+ my @ptags = $profile->tags;
+ my @ign_overrides = $profile->ignored_overrides;
+ v_msg('Using profile ' . $profile->name . '.');
+ $TAGS->only(@ptags) if @ptags;
+ $TAGS->ignore_overrides(@ign_overrides) if @ign_overrides;
+}
+
# Initialize display level settings.
for my $level (@display_level) {
eval { $TAGS->display(@$level) };
diff --git a/lib/Lintian/Profile.pm b/lib/Lintian/Profile.pm
index bbf7abe..363885d 100644
--- a/lib/Lintian/Profile.pm
+++ b/lib/Lintian/Profile.pm
@@ -67,7 +67,7 @@ sub new {
'ignored-overrides' => {},
};
$self = bless $self, $type;
- $profile = $self->_find_profile($name);
+ $profile = $self->find_profile($name);
fail "Cannot find profile $name (in " . join(', ', @$ppath).").\n"
unless $profile;
$self->_read_profile($profile);
@@ -86,14 +86,16 @@ sub ignored_overrides {
return keys %{ $self->{'ignored-overrides'} };
}
-sub _find_profile {
- my ($self, $pname) = @_;
+sub find_profile {
+ my ($self, $pname, @dirs) = @_;
my $pfile;
fail "$pname is not a valid profile name\n" if $pname =~ m/\./o;
+ # Allow @dirs to override the default path for this profile-search
+ push @dirs, @{ $self->{'profile-path'} } if ref $self;
# $vendor is short for $vendor/main
$pname = "$pname/main" unless $pname =~ m,/,o;
$pfile = "$pname.profile";
- foreach my $path (@{ $self->{'profile-path'} }){
+ foreach my $path (@dirs){
return "$path/$pfile" if -e "$path/$pfile";
}
return '';
@@ -124,10 +126,10 @@ sub _read_profile {
unless $parent && $parent !~ m/\./o;
fail "Recursive definition of $parent.\n"
if exists $pmap->{$parent};
- $parentf = $self->_find_profile($parent);
+ $parentf = $self->find_profile($parent);
fail "Cannot find $parent, which $pname extends.\n"
unless $parentf;
- $self->_read_profile($parentf);
+ $self->read_profile($parentf);
push @$plist, $parent;
}
$self->_read_profile_tags($pname, $pheader);
diff --git a/profiles/debian/ftp-master-auto-reject.profile b/profiles/debian/ftp-master-auto-reject.profile
new file mode 100644
index 0000000..cd4c5d2
--- /dev/null
+++ b/profiles/debian/ftp-master-auto-reject.profile
@@ -0,0 +1,69 @@
+# This profile is auto-generated
+Profile: debian/ftp-master-auto-reject
+Enable-Tag: FSSTND-dir-in-usr, FSSTND-dir-in-var, arch-dependent-file-in-usr-share,
+ arch-independent-package-contains-binary-or-object, bad-package-name,
+ bad-relation, bad-version-number, binary-file-compressed-with-upx,
+ binary-in-etc, binary-or-shlib-defines-rpath, binary-with-bad-dynamic-table,
+ build-info-in-binary-control-file-section, control-file-has-bad-owner,
+ control-file-has-bad-permissions, control-interpreter-in-usr-local,
+ control-interpreter-without-depends,
+ copyright-contains-dh_make-todo-boilerplate, copyright-file-compressed,
+ copyright-file-is-symlink, copyright-refers-to-incorrect-directory,
+ copyright-refers-to-old-directory,
+ debian-control-file-uses-obsolete-national-encoding,
+ debian-control-with-duplicate-fields, debian-rules-missing-required-target,
+ debian-rules-not-a-makefile, description-is-dh_make-template,
+ description-synopsis-is-empty, dir-or-file-in-mnt, dir-or-file-in-opt,
+ dir-or-file-in-srv, dir-or-file-in-tmp, dir-or-file-in-var-www,
+ embedded-library, extended-description-is-empty,
+ file-in-etc-not-marked-as-conffile, file-in-usr-marked-as-conffile,
+ forbidden-postrm-interpreter,
+ library-in-debug-or-profile-should-not-be-stripped, magic-arch-in-arch-list,
+ maintainer-address-is-on-localhost, maintainer-address-malformed,
+ maintainer-address-missing, maintainer-name-missing,
+ maintainer-script-removes-device-files, malformed-deb-archive,
+ missing-build-dependency, missing-dependency-on-libc,
+ missing-dependency-on-perlapi, mknod-in-maintainer-script,
+ no-architecture-field, no-copyright-file, no-maintainer-field, no-package-name,
+ no-shlibs-control-file, no-source-field, no-version-field,
+ non-etc-file-marked-as-conffile, not-allowed-control-file,
+ old-style-copyright-file, package-contains-ancient-file,
+ package-contains-info-dir-file, package-has-no-description,
+ package-installs-python-bytecode, package-not-lowercase,
+ package-uses-local-diversion, preinst-interpreter-without-predepends,
+ section-is-dh_make-template, source-field-does-not-match-pkg-name,
+ statically-linked-binary, symlink-has-too-many-up-segments,
+ too-many-architectures, uploader-address-is-on-localhost,
+ uploader-address-malformed, uploader-name-missing,
+ usr-share-doc-symlink-to-foreign-package,
+ usr-share-doc-symlink-without-dependency, wrong-file-owner-uid-or-gid
+
+Tag: FSSTND-dir-in-usr, FSSTND-dir-in-var, bad-package-name, bad-relation, bad-version-number,
+ binary-file-compressed-with-upx, binary-in-etc,
+ build-info-in-binary-control-file-section, control-file-has-bad-owner,
+ control-file-has-bad-permissions, control-interpreter-in-usr-local,
+ copyright-file-compressed, copyright-file-is-symlink,
+ copyright-refers-to-incorrect-directory, copyright-refers-to-old-directory,
+ debian-control-file-uses-obsolete-national-encoding,
+ debian-control-with-duplicate-fields, debian-rules-missing-required-target,
+ debian-rules-not-a-makefile, description-is-dh_make-template,
+ description-synopsis-is-empty, dir-or-file-in-mnt, dir-or-file-in-opt,
+ dir-or-file-in-srv, dir-or-file-in-tmp, extended-description-is-empty,
+ file-in-etc-not-marked-as-conffile, file-in-usr-marked-as-conffile,
+ forbidden-postrm-interpreter,
+ library-in-debug-or-profile-should-not-be-stripped, magic-arch-in-arch-list,
+ maintainer-address-is-on-localhost, maintainer-address-malformed,
+ maintainer-address-missing, maintainer-name-missing,
+ maintainer-script-removes-device-files, malformed-deb-archive,
+ missing-dependency-on-perlapi, no-architecture-field, no-copyright-file,
+ no-maintainer-field, no-package-name, no-source-field, no-version-field,
+ not-allowed-control-file, old-style-copyright-file,
+ package-contains-ancient-file, package-has-no-description,
+ package-installs-python-bytecode, package-not-lowercase,
+ package-uses-local-diversion, section-is-dh_make-template,
+ source-field-does-not-match-pkg-name, symlink-has-too-many-up-segments,
+ too-many-architectures, uploader-address-is-on-localhost,
+ uploader-address-malformed, uploader-name-missing,
+ usr-share-doc-symlink-to-foreign-package
+Overridable: no
+
diff --git a/profiles/debian/main.profile b/profiles/debian/main.profile
new file mode 100644
index 0000000..d46c327
--- /dev/null
+++ b/profiles/debian/main.profile
@@ -0,0 +1,10 @@
+# This profile is auto-generated
+Profile: debian/main
+Enable-Tags-From-Check: binaries, changelog-file, changes-file, circular-deps, conffiles,
+ control-file, control-files, copyright-file, cruft, deb-format, debconf,
+ debhelper, debian-readme, debian-source-dir, description, duplicate-files,
+ etcfiles, fields, files, huge-usr-share, infofiles, init.d, java, lintian,
+ manpages, md5sums, menu-format, menus, nmu, ocaml, patch-systems, po-debconf,
+ rules, scripts, shared-libs, standards-version, symlinks, version-substvars,
+ watch-file
+
--
Debian package checker
Reply to: