Package: xdeb
Version: 0.6.5
Severity: wishlist

Dear Maintainer,

Attached is a patch to add support to --stage1 option, which considers the 
Build-Depends-Stage1 field of control file instead of Build-Depends.

This addition enables the use of xdeb while working with staged build. 

Please, see [1] for more informations about bootstrap in debian.

This is my second bugreport. Sorry for any mistakes.

[1] http://wiki.debian.org/DebianBootstrap

Cheers, 

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages xdeb depends on:
ii  apt-utils        0.8.15.10
ii  build-essential  11.5
ii  devscripts       2.11.6
ii  dpkg-cross       2.6.6
ii  dpkg-dev         1.16.2
ii  lintian          2.5.6
ii  python           2.7.2-10
ii  python-apt       0.8.3+nmu1
ii  python-debian    0.1.21
ii  sudo             1.8.3p2-1
ii  wget             1.13.4-2

Versions of packages xdeb recommends:
ii  fakeroot  1.18.2-1
ii  gcc       4:4.6.3-4

xdeb suggests no packages.

-- no debconf information
diff -Nur xdeb-0.6.5.orig/debian/changelog xdeb-0.6.5/debian/changelog
--- xdeb-0.6.5.orig/debian/changelog	2011-09-30 11:49:54.000000000 +0000
+++ xdeb-0.6.5/debian/changelog	2012-04-18 12:21:55.858809074 +0000
@@ -1,5 +1,9 @@
 xdeb (0.6.5) unstable; urgency=low
 
+  [ Gustavo Alkmim ]
+  * Add support to --stage1 option, which considers the Build-Depends-Stage1
+    field of control file instead of Build-Depends.
+
   [ Steve Langasek ]
   * If a package is Multi-Arch: foreign, we don't need to build it unless we
     also want to install it in its own right.
diff -Nur xdeb-0.6.5.orig/xdeb.py xdeb-0.6.5/xdeb.py
--- xdeb-0.6.5.orig/xdeb.py	2011-09-30 09:25:31.000000000 +0000
+++ xdeb-0.6.5/xdeb.py	2012-04-18 12:22:04.366809385 +0000
@@ -301,7 +301,12 @@
         # that we can native-import them, but we don't want to go further
         # down transitive build-dependencies.
         if not options.only_explicit or not builddep_depth:
-            builddeps = src_record.relations['build-depends']
+            if options.stage1:
+                builddeps = src_record.relations['build-depends-stage1']
+                if builddeps == []:
+                    builddeps = src_record.relations['build-depends']
+            else:
+                builddeps = src_record.relations['build-depends']
             if options.architecture == build_arch:
                 builddeps.extend(src_record.relations['build-depends-indep'])
             builddeps = filter_arch(builddeps, options.architecture)
@@ -428,7 +433,13 @@
         src_record = get_src_record(options, src)
         if src_record is None:
             continue
-        builddeps = src_record.relations['build-depends']
+        if options.stage1:
+            builddeps = src_record.relations['build-depends-stage1']
+            if builddeps == []:
+                builddeps = src_record.relations['build-depends']
+
+        else:
+            builddeps = src_record.relations['build-depends']
         builddeps.extend(src_record.relations['build-depends-indep'])
         for builddep in builddeps:
             if [d for d in builddep if d['name'] == 'linux-gnu']:
@@ -631,9 +642,20 @@
     print "===== Building %s_%s =====" % (src, ver)
     print
 
-    utils.spawn(['dpkg-checkbuilddeps'], cwd=srcdir)
+    if options.stage1:
+        utils.spawn(['dpkg-checkbuilddeps', '--stage=1'], cwd=srcdir)
+    else:
+        utils.spawn(['dpkg-checkbuilddeps'], cwd=srcdir)
 
     buildpackage = ['debuild', '--no-lintian', '-eUSER']
+
+    if 'DEB_BUILD_OPTIONS' in os.environ:
+        build_options = '%s' % os.environ['DEB_BUILD_OPTIONS']
+    else:
+        build_options = '"'
+    if options.stage1:
+        build_options += 'stage=1 '
+
     global target_config
     if options.parallel and src not in target_config.parallel_blacklist:
         cpu_count = multiprocessing.cpu_count()
@@ -644,11 +666,8 @@
     if options.architecture != build_arch:
         buildpackage.append('-eCONFIG_SITE=/etc/dpkg-cross/cross-config.%s' %
                             options.architecture)
-        if 'DEB_BUILD_OPTIONS' in os.environ:
-            buildpackage.append('-eDEB_BUILD_OPTIONS=%s nocheck' %
-                                os.environ['DEB_BUILD_OPTIONS'])
-        else:
-            buildpackage.append('-eDEB_BUILD_OPTIONS=nocheck')
+
+        build_options += 'nocheck '
         deb_host_gnu_type = utils.get_output(
             ['dpkg-architecture', '-a%s' % options.architecture,
              '-qDEB_HOST_GNU_TYPE']).rstrip('\n')
@@ -667,6 +686,8 @@
         if options.debug:
             buildpackage.append('-eDH_VERBOSE=1')
         buildpackage.append('-a%s' % options.architecture)
+    build_options += '"'
+    buildpackage.append('-eDEB_BUILD_OPTIONS=%s' % build_options)
     buildpackage.extend(['-b', '-uc', '-us'])
     if options.clean_after:
         buildpackage.append('-tc')
@@ -789,6 +810,12 @@
                       action='store_true', default=False,
                       help='draw a simplified graph omitting binary package '
                            'links')
+    parser.add_option('--stage1',
+                      dest='stage1', 
+                      action='store_true', default=False,
+                      help='generate the dependencies of packages based on '
+                           'the Build-Depends-Stage1 field of the control '
+                           'file instead of the Build-Depends field')
     options, args = parser.parse_args()
     return parser, options, args
 

Reply via email to