The following commit has been merged in the master branch:
commit 464391e7fbe6eef58aa36ea98e2f4dabb136404c
Author: Niels Thykier <[email protected]>
Date:   Wed Jun 8 22:55:22 2011 +0200

    Added --no-cfg option to lintian to skip reading lintianrc

diff --git a/debian/changelog b/debian/changelog
index 14137a9..3084436 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -81,6 +81,8 @@ lintian (2.5.1) UNRELEASED; urgency=low
   * frontend/lintian:
     + [NT] Allow some options to be put into the lintianrc file.
       (Closes: #460350)
+    + [NT] Added --no-cfg option that can be specified if no config
+      file should be read.
 
   * lib/Lintian/Tags.pm:
     + [NT] Fixed a flaw in logic that gave incorrect results for
diff --git a/frontend/lintian b/frontend/lintian
index 9e085da..9034733 100755
--- a/frontend/lintian
+++ b/frontend/lintian
@@ -60,6 +60,7 @@ our $OPT_LINTIAN_AREA = '';   #string for the --area option
 # These options can also be used via default or environment variables
 our $LINTIAN_CFG = '';         #config file to use
 our $LINTIAN_ROOT;             #location of the lintian modules
+my $no_conf = 0;                #flag for --no-cfg
 my %opt;                        #hash of some flags from cmd or cfg
 my %conf_opt;                   #names of options set in the cfg file
 
@@ -173,6 +174,7 @@ Configuration options:
     --area AREA               scan packages in this archive area (e.g. main)
     --archivedir ARCHIVEDIR   location of Debian archive to scan for packages
     --cfg CONFIGFILE          read CONFIGFILE for configuration
+    --no-cfg CONFIGFILE       do not read any CONFIGFILE
     --dist DIST               scan packages in this distribution (e.g. sid)
     --lab LABDIR              use LABDIR as permanent laboratory
     --root ROOTDIR            use ROOTDIR instead of /usr/share/lintian
@@ -424,6 +426,7 @@ my %opthash = (                     # ------------------ 
actions
 
               # ------------------ configuration options
               'cfg=s' => \$LINTIAN_CFG,
+              'no-cfg' => \$no_conf,
               'lab=s' => \$OPT_LINTIAN_LAB,
               'archivedir=s' => \$OPT_LINTIAN_ARCHIVEDIR,
               'dist=s' => \$OPT_LINTIAN_DIST,
@@ -504,15 +507,17 @@ if ($> == 0 and not $allow_root) {
 
 # search for configuration file if it was not set with --cfg
 # do not search the default locations if it was set.
-if ($LINTIAN_CFG) {
-} elsif (exists $ENV{'LINTIAN_CFG'} &&
-        -f ($LINTIAN_CFG = $ENV{'LINTIAN_CFG'})) {
-} elsif (-f ($LINTIAN_CFG = $LINTIAN_ROOT . '/lintianrc')) {
-} elsif (exists $ENV{'HOME'} &&
-        -f ($LINTIAN_CFG = $ENV{'HOME'} . '/.lintianrc')) {
-} elsif (-f ($LINTIAN_CFG = '/etc/lintianrc')) {
-} else {
-    undef $LINTIAN_CFG;
+unless ($no_conf) {
+    if ($LINTIAN_CFG) {
+    } elsif (exists $ENV{'LINTIAN_CFG'} &&
+            -f ($LINTIAN_CFG = $ENV{'LINTIAN_CFG'})) {
+    } elsif (-f ($LINTIAN_CFG = $LINTIAN_ROOT . '/lintianrc')) {
+    } elsif (exists $ENV{'HOME'} &&
+            -f ($LINTIAN_CFG = $ENV{'HOME'} . '/.lintianrc')) {
+    } elsif (-f ($LINTIAN_CFG = '/etc/lintianrc')) {
+    } else {
+       undef $LINTIAN_CFG;
+    }
 }
 
 use constant VARS => qw(LAB ARCHIVEDIR DIST AREA ARCH);
diff --git a/man/lintian.pod.in b/man/lintian.pod.in
index 9d71650..f63890c 100644
--- a/man/lintian.pod.in
+++ b/man/lintian.pod.in
@@ -332,6 +332,11 @@ Read the configuration from configfile rather than the 
default
 locations.  This option overrides the B<LINTIAN_CFG> environment
 variable.
 
+=item B<--no-cfg>
+
+Do not read any configuration file.  This option overrides the
+B<--cfg> above.
+
 =item B<--dist> distdir
 
 Scan for packages in the I<distdir> directory.  (See the L</FILES>
diff --git a/t/runtests b/t/runtests
index 9993ac7..22768dc 100755
--- a/t/runtests
+++ b/t/runtests
@@ -554,7 +554,7 @@ sub test_package {
     msg_print "testing... ";
     my $opts = { err => "$rundir/tags.$pkg", fail => 'never' };
     my $status;
-    unshift(@options, '--allow-root');
+    unshift(@options, '--allow-root', '--no-cfg');
     if ($testdata->{sort}) {
        $status = spawn($opts, [ $LINTIAN, @options, $file ], '|', [ 'sort' ]);
     } else {
@@ -674,7 +674,7 @@ sub test_changes {
     my $testdir = "$TESTSET/changes";
 
     msg_print "testing... ";
-    runsystem_ok("$LINTIAN --allow-root -I -E $testdir/$test.changes 2>&1"
+    runsystem_ok("$LINTIAN --allow-root --no-cfg -I -E $testdir/$test.changes 
2>&1"
                 . " | sort > $RUNDIR/tags.changes-$test");
 
     # Compare the output to the expected tags.
@@ -739,7 +739,7 @@ sub test_deb {
     runsystem("cd $targetdir && fakeroot make >../build.$test 2>&1");
 
     msg_print "testing... ";
-    runsystem_ok("$LINTIAN --allow-root -I -E $targetdir/$test.deb 2>&1"
+    runsystem_ok("$LINTIAN --allow-root --no-cfg -I -E $targetdir/$test.deb 
2>&1"
                 . " | sort > $RUNDIR/tags.$test");
 
     # Compare the output to the expected tags.
@@ -803,7 +803,7 @@ sub test_source {
     runsystem("cd $targetdir && make >../build.$test 2>&1");
 
     msg_print "testing... ";
-    runsystem_ok("$LINTIAN --allow-root -I -E $targetdir/*.dsc 2>&1"
+    runsystem_ok("$LINTIAN --allow-root --no-cfg -I -E $targetdir/*.dsc 2>&1"
                 . " | sort > $RUNDIR/tags.$test");
 
     # Compare the output to the expected tags.
diff --git a/testset/runtests b/testset/runtests
index 9402746..b3a8f88 100755
--- a/testset/runtests
+++ b/testset/runtests
@@ -207,8 +207,8 @@ for (@tests) {
     runsystem("cd $rundir/$pkgdir && dpkg-buildpackage 
$dpkg_buildpackage_options >../build.$pkg 2>&1");
 
     print "testing... ";
-    print "Running lintian --allow-root $lintian_options on 
$rundir/$pkg\_$ver*.changes...\n" if $debug;
-    runsystem_ok("$lintian_path --allow-root $lintian_options 
$rundir/$pkg\_$ver*.changes".
+    print "Running lintian --allow-root --no-cfg $lintian_options on 
$rundir/$pkg\_$ver*.changes...\n" if $debug;
+    runsystem_ok("$lintian_path --allow-root --no-cfg $lintian_options 
$rundir/$pkg\_$ver*.changes".
        " 2>&1 | sort > $rundir/tags.$pkg");
 
     # Run a sed-script if it exists, for tests that have slightly variable

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to