Преглед изворни кода

dpkg-buildflags: Add a new qa feature area

This will allow to add various Quality Assurance features that can be
used to avoid common errors.
Guillem Jover пре 12 година
родитељ
комит
14904c35f0
3 измењених фајлова са 26 додато и 3 уклоњено
  1. 1 0
      debian/changelog
  2. 8 3
      man/dpkg-buildflags.1
  3. 17 0
      scripts/Dpkg/Vendor/Debian.pm

+ 1 - 0
debian/changelog

@@ -38,6 +38,7 @@ dpkg (1.17.14) UNRELEASED; urgency=low
     Based on a patch by Dima Kogan <dima@secretsauce.net>.
     Based on a patch by Dima Kogan <dima@secretsauce.net>.
   * Add support for relative symlinks to dpkg-maintscript-helper symlink_to_dir
   * Add support for relative symlinks to dpkg-maintscript-helper symlink_to_dir
     command. Suggested by Don Armstrong <don@debian.org>.
     command. Suggested by Don Armstrong <don@debian.org>.
+  * Add a new dpkg-buildflags qa feature area:
 
 
   [ Raphaël Hertzog ]
   [ Raphaël Hertzog ]
   * Explain better in deb-triggers(5) why interest/activate-noawait should be
   * Explain better in deb-triggers(5) why interest/activate-noawait should be

+ 8 - 3
man/dpkg-buildflags.1

@@ -2,7 +2,7 @@
 .\"
 .\"
 .\" Copyright © 2010-2011 Raphaël Hertzog <hertzog@debian.org>
 .\" Copyright © 2010-2011 Raphaël Hertzog <hertzog@debian.org>
 .\" Copyright © 2011 Kees Cook <kees@debian.org>
 .\" Copyright © 2011 Kees Cook <kees@debian.org>
-.\" Copyright © 2011-2013 Guillem Jover <guillem@debian.org>
+.\" Copyright © 2011-2014 Guillem Jover <guillem@debian.org>
 .\"
 .\"
 .\" This is free software; you can redistribute it and/or modify
 .\" This is free software; you can redistribute it and/or modify
 .\" it under the terms of the GNU General Public License as published by
 .\" it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
 .\" You should have received a copy of the GNU General Public License
 .\" You should have received a copy of the GNU General Public License
 .\" along with this program.  If not, see <https://www.gnu.org/licenses/>.
 .\" along with this program.  If not, see <https://www.gnu.org/licenses/>.
 .
 .
-.TH dpkg\-buildflags 1 "2013-10-20" "Debian Project" "dpkg suite"
+.TH dpkg\-buildflags 1 "2014-09-04" "Debian Project" "dpkg suite"
 .SH NAME
 .SH NAME
 dpkg\-buildflags \- returns build flags to use during package build
 dpkg\-buildflags \- returns build flags to use during package build
 .
 .
@@ -135,7 +135,8 @@ the flag is set/modified by an environment-specific configuration.
 .TP
 .TP
 .BI \-\-query\-features " area"
 .BI \-\-query\-features " area"
 Print the features enabled for a given area. The only currently recognized
 Print the features enabled for a given area. The only currently recognized
-area is \fBhardening\fP, see the \fBFEATURE AREAS\fP section for more details.
+areas are \fBqa\fP and \fBhardening\fP, see the \fBFEATURE AREAS\fP section
+for more details.
 Exits with 0 if the area is known otherwise exits with 1.
 Exits with 0 if the area is known otherwise exits with 1.
 .IP
 .IP
 The output is in RFC822 format, with one section per feature.
 The output is in RFC822 format, with one section per feature.
@@ -212,6 +213,10 @@ Thus disabling everything in the \fBhardening\fP area and enabling only
 .P
 .P
   export DEB_BUILD_MAINT_OPTIONS=hardening=\-all,+format,+fortify
   export DEB_BUILD_MAINT_OPTIONS=hardening=\-all,+format,+fortify
 .
 .
+.SS Quality Assurance (QA)
+Several compile-time options (detailed below) can be used to help detect
+problems in the source code or build system.
+.
 .SS Hardening
 .SS Hardening
 Several compile-time options (detailed below) can be used to help harden
 Several compile-time options (detailed below) can be used to help harden
 a resulting binary against memory corruption attacks, or provide
 a resulting binary against memory corruption attacks, or provide

+ 17 - 0
scripts/Dpkg/Vendor/Debian.pm

@@ -67,6 +67,7 @@ sub run_hook {
 	    $$textref .= "Bug-Ubuntu: https://bugs.launchpad.net/bugs/$bug\n";
 	    $$textref .= "Bug-Ubuntu: https://bugs.launchpad.net/bugs/$bug\n";
 	}
 	}
     } elsif ($hook eq 'update-buildflags') {
     } elsif ($hook eq 'update-buildflags') {
+	$self->_add_qa_flags(@params);
 	$self->_add_hardening_flags(@params);
 	$self->_add_hardening_flags(@params);
     } else {
     } else {
         return $self->SUPER::run_hook($hook, @params);
         return $self->SUPER::run_hook($hook, @params);
@@ -98,6 +99,22 @@ sub _parse_feature_area {
     }
     }
 }
 }
 
 
+sub _add_qa_flags {
+    my ($self, $flags) = @_;
+
+    # Default feature states.
+    my %use_feature = (
+    );
+
+    # Adjust features based on Maintainer's desires.
+    $self->_parse_feature_area('qa', \%use_feature);
+
+    # Store the feature usage.
+    while (my ($feature, $enabled) = each %use_feature) {
+        $flags->set_feature('qa', $feature, $enabled);
+    }
+}
+
 sub _add_hardening_flags {
 sub _add_hardening_flags {
     my ($self, $flags) = @_;
     my ($self, $flags) = @_;
     my $arch = get_host_arch();
     my $arch = get_host_arch();