Followup-For: Bug #304688
Package: dh-make
Version: 0.46
Tags: patch

Hi,

I create patch to kernel patch package to dh-make.
When the -n /--kpatch option is used, the model of the
kernel patch package is made for dh_make, when this
patch is applied.

Best regards,
 Nobuhiro

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-2-686 (SMP w/2 CPU cores)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages dh-make depends on:
ii  debhelper                     7.0.15     helper programs for debian/rules
ii  dpkg-dev                      1.14.20    Debian package development tools
ii  make                          3.81-5     The GNU version of the "make" util
ii  perl                          5.10.0-11  Larry Wall's Practical Extraction

dh-make recommends no packages.

-- no debconf information
diff --git a/dh_make b/dh_make
index 957dbd3..f62cb24 100755
--- a/dh_make
+++ b/dh_make
@@ -84,7 +84,6 @@ sub process_file(@)
       $line =~ s/#PATCH_CLEAN#/$main::PATCH_CLEAN/g;
       $line =~ s/#PATCH_STAMP#/$main::PATCH_STAMP/g;
       $line =~ s/#BUILD_DEPS#/$main::BUILD_DEPS/g;
-
       print OUT $line;
     }
     close IN;
@@ -114,6 +113,7 @@ sub show_help
   -m, --multi               set package class to multiple binary
   -l, --library             set package class to library
   -k, --kmod                set package class to kernel module
+  -n, --kpatch              set package class to kernel patch
   -b, --cdbs                set package class to cdbs
   -a, --addmissing          reprocess package and add missing files
   -t, --templates <dir>      apply customizing templates in <dir>
@@ -131,7 +131,7 @@ EOF
 
 sub parse_args
 {
-  my ($dohelp,$doversion, $single,$multi,$library, $kmod,$cdbs );
+  my ($dohelp,$doversion, $single,$multi,$library,$kmod,$kpatch,$cdbs );
   if (GetOptions('copyright|c=s' => \$main::license,
               'dpatch' => \$dpatch,
               'email|e=s' => \$main::email,
@@ -144,6 +144,7 @@ sub parse_args
 	      'multi|m' => \$multi,
 	      'library|l' => \$library,
 	      'kmod|k' => \$kmod,
+	      'kpatch|n' => \$kpatch,
 	      'cdbs|b' => \$cdbs,
 	      'addmissing|a' => \$main::add_missing,
 	      'templates|t=s' => \$main::custom,
@@ -188,6 +189,10 @@ sub parse_args
   {
     $main::package_type = 'k';
   }
+  if ($kpatch)
+  {
+    $main::package_type = 'n';
+  }
   if ($cdbs)
   {
     $main::package_type = 'b';
@@ -396,7 +401,7 @@ if ( ! $no_defaults )
 {
   while ($package_type eq "")
   {
-    print "\nType of package: single binary, multiple binary, library, kernel module or cdbs?\n [s/m/l/k/b] ";
+    print "\nType of package: single binary, multiple binary, library, kernel module, kernel patch or cdbs?\n [s/m/l/k/n/b] ";
     my $type = <STDIN>;
     chomp($type);
     print "\n";
@@ -405,6 +410,7 @@ if ( ! $no_defaults )
     $main::package_type = 'm' if $type eq 'm';
     $main::package_type = 'l' if $type eq 'l';
     $main::package_type = 'k' if $type eq 'k';
+    $main::package_type = 'n' if $type eq 'n';
     $main::package_type = 'b' if $type eq 'b';
   }
 }
@@ -572,6 +578,10 @@ if ($package_type eq "k") {
   $BUILD_DEPS .= ', bzip2';
 }
 
+if ($package_type eq "n") {
+  $BUILD_DEPS .= ', dh-kpatches';
+}
+
 # Customize files
 if ( $add_missing )
 {
@@ -646,6 +656,10 @@ if ( $custom ne "" )
   }
 }
 
+# kernel-patch kpatch file name
+if ($package_type eq "n") {
+  rename "kpatches", "$package_name.kpatches";
+}
 
 if ( -f "docs" )
 {
diff --git a/lib/debiann/README.Debian b/lib/debiann/README.Debian
new file mode 100644
index 0000000..23fb63e
--- /dev/null
+++ b/lib/debiann/README.Debian
@@ -0,0 +1,6 @@
+#PACKAGE# for Debian
+#DASHLINE#
+
+<possible notes regarding this package - if none, delete this file>
+
+ -- #USERNAME# <#EMAIL#>  #DATE#
diff --git a/lib/debiann/control b/lib/debiann/control
new file mode 100644
index 0000000..c3cc5f1
--- /dev/null
+++ b/lib/debiann/control
@@ -0,0 +1,15 @@
+Source: #PACKAGE#
+Section: unknown
+Priority: extra
+Maintainer: #USERNAME# <#EMAIL#>
+Build-Depends: #BUILD_DEPS#
+Standards-Version: #POLICY#
+Homepage: <insert the upstream URL, if relevant>
+
+Package: #PACKAGE#
+Architecture: all
+Depends: ${kpatch:Depends}
+Recommends: linux-source
+Suggests: kernel-package
+Description:  <insert up to 60 chars description>
+ <insert long description, indented with spaces>
diff --git a/lib/debiann/kpatches b/lib/debiann/kpatches
new file mode 100644
index 0000000..0c5aa4c
--- /dev/null
+++ b/lib/debiann/kpatches
@@ -0,0 +1,7 @@
+Patch-name:
+Patch-id:
+Architecture: all
+Path-strip-level: 0
+
+Patch-file:
+Kernel-version:
diff --git a/lib/debiann/rules b/lib/debiann/rules
new file mode 100755
index 0000000..393eb82
--- /dev/null
+++ b/lib/debiann/rules
@@ -0,0 +1,37 @@
+#!/usr/bin/make -f
+
+build: build-stamp
+build-stamp:
+    dh_testdir
+    touch build-stamp
+
+clean:
+    dh_testdir
+    dh_testroot
+    rm -f build-stamp
+    dh_clean
+
+install: build
+    dh_testdir
+    dh_testroot
+    dh_clean -k
+    dh_installdirs
+    dh_installkpatches
+
+# Build architecture-independent files here.
+binary-indep: build install
+    dh_testdir
+    dh_testroot
+    dh_installdocs
+    dh_installchangelogs
+    dh_compress
+    dh_fixperms
+    dh_installdeb
+    dh_gencontrol
+    dh_md5sums
+    dh_builddeb
+
+binary-arch: binary-indep
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
\ No newline at end of file

Reply via email to