[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Config-Model-Dpkg: support build profiles



On Fri, Jun 27, 2014 at 03:41:57PM +0300, Peter Pentchev wrote:
> On Thu, Jun 26, 2014 at 03:20:28PM +0300, Peter Pentchev wrote:
> > Hi Dominique,
> 
> I sent an e-mail to Dominique Dumont directly, but it's better to have
> this discussion on a public list, so here goes :)

Uhm.  And... of course, it would help if I included the patch.

> > First of all, thanks a lot for all the great work you've been doing on
> > Config-Model, the pkg-perl project, and Debian in general!
> > 
> > What do you think about the attached patch that adds support for the
> > build profile annotations in the debian/control file?  There are two
> > parts of this, as described in the specification -
> > https://wiki.debian.org/BuildProfileSpec - a <profile.*> addition to
> > Build-Depends and Build-Depends-Indep and a Build-Profiles header for
> > the binary package stanzas.  The test included in the patch is an actual
> > control file for a package converted to build profiles as part of my
> > work on this year's "Bootstrappable Debian" GSoC project, as you may see
> > in #751922; that's why I've CC'd Wookey and Johannes, my mentors on this
> > project, who also have some interest in the adoption of the build
> > profiles framework and the adaptations made to all the tools that parse
> > the source control and the binary changes file to support the new
> > fields.
> > 
> > Right now the patch does not try to check that the <profile.*>
> > restrictions may only be present in B-D and B-D-I, and not in any other
> > places that Dpkg::Dependency is used (Build-Conflicts for the source
> > package, Depends and friends for the binary ones).  If you wish, I'll
> > try to implement that, too.  On the other hand, if you like the patch
> > as-is, I could commit it to the pkg-perl repo as the start of my
> > long-overdue pkg-perl comeback :)
> > 
> > Thanks again, and keep up the great work!

G'luck,
Peter

-- 
Peter Pentchev  roam@ringlet.net roam@FreeBSD.org p.penchev@storpool.com
PGP key:        http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115  C354 651E EFB0 2527 DF13
From c7ef378cc7159d19de954cbb1ba698480d71d201 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <roam@ringlet.net>
Date: Thu, 26 Jun 2014 13:11:55 +0300
Subject: [PATCH] Source B-D: <profile.*>, binary Build-Profiles.

Add support for the build profile debian/control annotations as
described at https://wiki.debian.org/BuildProfileSpec
---
 lib/Config/Model/Dpkg/Dependency.pm                |  8 ++++-
 lib/Config/Model/models/Dpkg/Control/Binary.pl     |  7 ++++
 .../dpkg-control-examples/build-profiles           | 37 ++++++++++++++++++++++
 t/model_tests.d/dpkg-control-test-conf.pl          |  8 +++++
 4 files changed, 59 insertions(+), 1 deletion(-)
 create mode 100644 t/model_tests.d/dpkg-control-examples/build-profiles

diff --git a/lib/Config/Model/Dpkg/Dependency.pm b/lib/Config/Model/Dpkg/Dependency.pm
index ca3bc27..04a0d1f 100644
--- a/lib/Config/Model/Dpkg/Dependency.pm
+++ b/lib/Config/Model/Dpkg/Dependency.pm
@@ -171,7 +171,7 @@ depend: pkg_dep | variable
 # For the allowed stuff after ${foo}, see #702792
 variable: /\${[\w:\-]+}[\w\.\-~+]*/
 
-pkg_dep: pkg_name dep_version(?) arch_restriction(?) {
+pkg_dep: pkg_name dep_version(?) arch_restriction(?) profile_restriction(?) {
     my $dv = $item[2] ;
     my $ar = $item[3] ;
     my @ret = ( $item{pkg_name} ) ;
@@ -181,6 +181,12 @@ pkg_dep: pkg_name dep_version(?) arch_restriction(?) {
     $return = \@ret ; ;
    }
 
+profile_restriction: '<' profile(s) '>'
+
+profile: not(?) 'profile.' profile_name
+
+profile_name: /[a-z][a-z0-9-]*/
+
 arch_restriction: '[' osarch(s) ']'
     {
         my $mismatch = 0;
diff --git a/lib/Config/Model/models/Dpkg/Control/Binary.pl b/lib/Config/Model/models/Dpkg/Control/Binary.pl
index aced01a..d8d3cd1 100644
--- a/lib/Config/Model/models/Dpkg/Control/Binary.pl
+++ b/lib/Config/Model/models/Dpkg/Control/Binary.pl
@@ -301,6 +301,13 @@ supported by the library',
             }
           ]
         }
+      },
+      'Build-Profiles',
+      {
+        'description' => 'A space-separated list of optionally negated profile names',
+        'type' => 'leaf',
+        'value_type' => 'uniline',
+	'match' => '[!]?[a-z][a-z0-9-]*(\s+[!]?[a-z][a-z0-9-]*)*'
       }
     ],
     'license' => 'LGPL2',
diff --git a/t/model_tests.d/dpkg-control-examples/build-profiles b/t/model_tests.d/dpkg-control-examples/build-profiles
new file mode 100644
index 0000000..1b43b5d
--- /dev/null
+++ b/t/model_tests.d/dpkg-control-examples/build-profiles
@@ -0,0 +1,37 @@
+Source: pkg-config
+Section: devel
+Priority: optional
+Maintainer: Tollef Fog Heen <tfheen@debian.org>
+Build-Depends: debhelper (>= 9.20140227), dpkg-dev (>= 1.17.2), dh-autoreconf,
+ libglib2.0-dev <!profile.stage1>
+Homepage: http://pkg-config.freedesktop.org
+Standards-Version: 3.8.4
+
+Package: pkg-config
+Architecture: any
+Build-Profiles: !stage1
+Multi-Arch: foreign
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: manage compile and link flags for libraries
+ pkg-config is a system for managing library compile and link flags that 
+ works with automake and autoconf.
+ .
+ Increasingly libraries ship with ".pc" files that allow querying of the
+ compiler and linker flags needed to use them through the pkg-config(1)
+ program.
+
+Package: pkg-config-stage1
+Architecture: any
+Build-Profiles: stage1
+Multi-Arch: foreign
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Provides: pkg-config
+Description: manage compile and link flags for libraries (bootstrap)
+ pkg-config is a system for managing library compile and link flags that 
+ works with automake and autoconf.
+ .
+ Increasingly libraries ship with ".pc" files that allow querying of the
+ compiler and linker flags needed to use them through the pkg-config(1)
+ program.
+ .
+ This is an intermediate package to be used for bootstrap builds.
diff --git a/t/model_tests.d/dpkg-control-test-conf.pl b/t/model_tests.d/dpkg-control-test-conf.pl
index 6f5f519..3e54054 100644
--- a/t/model_tests.d/dpkg-control-test-conf.pl
+++ b/t/model_tests.d/dpkg-control-test-conf.pl
@@ -177,6 +177,14 @@ providing the following file:
             'source Section' => 'gnu-r',
             'binary:gnu-r-view Section' => 'gnu-r',
         ]
+    },
+    {
+        name => 'build-profiles',
+        load_warnings => [ qr/standards version/ ],
+        check => {
+            'binary:pkg-config Build-Profiles' => '!stage1',
+            'binary:pkg-config-stage1 Build-Profiles' => 'stage1',
+        },
     }
 );
 
-- 
2.0.0

Attachment: signature.asc
Description: Digital signature


Reply to: