In this case, the kernel will be installed in a package directory under debian/ and the source package's only additional build- dependency is kernel-wedge itself. check: We should only check the package directories that we generated. Allow the package names to be specified as arguments, but if no arguments are given then continue to check all packages. copy-modules: For Linux kernel packages, depmod is run on installation and modules.dep does not exist in the package directory. Generate modules.dep (etc.) in the temporary directory if necessary. gen-control: If the configuration file specifies all build- dependencies as '-', do not generate a source package stanza. install-files: If the configuration file specifies build-dependencies as '-', use the appropriate package directory as the source directory. --- commands/check | 7 ++++++- commands/copy-modules | 10 ++++++---- commands/gen-control | 23 ++++++++++++++--------- commands/install-files | 22 ++++++++++++++++++---- debian/changelog | 3 +++ 5 files changed, 47 insertions(+), 18 deletions(-) diff --git a/commands/check b/commands/check index 8c07359..9fe7470 100755 --- a/commands/check +++ b/commands/check @@ -1,6 +1,11 @@ #!/bin/sh -e empty= -for pkg in $(dh_listpackages -s); do +if [ $# -ge 1 ]; then + packages="$*" +else + packages="$(dh_listpackages -s)" +fi +for pkg in $packages; do if [ -z "$(find debian/$pkg -type f)" ]; then echo "$pkg will be empty" >&2 empty=1 diff --git a/commands/copy-modules b/commands/copy-modules index 75c4208..974347d 100755 --- a/commands/copy-modules +++ b/commands/copy-modules @@ -111,9 +111,11 @@ else fi if [ "$os" = "linux" ] ; then - if [ ! -e "$moddir/modules.dep" ]; then - echo "no $moddir/modules.dep. This file is required by kernel-wedge" >&2 - exit 1 + if [ -e "$moddir/modules.dep" ]; then + modulesdep=$moddir/modules.dep + else + modulesdep=$tmpdir/modules.dep + depmod ${SOURCEDIR:+-b $SOURCEDIR} $installedname -n >$modulesdep fi # get module dependencies from modules.dep @@ -128,7 +130,7 @@ if [ "$os" = "linux" ] ; then foreach (@words) { print "$module\t$_" unless $_ eq "\\"; } - ' $moddir/modules.dep | sort -k 2,2 > $tmpdir/deps + ' $modulesdep | sort -k 2,2 > $tmpdir/deps if [ ! -s $tmpdir/deps ] && [ ! -e $home/no-modules ]; then echo "No module interdependencies found. This probably means your modules.dep is broken." >&2 diff --git a/commands/gen-control b/commands/gen-control index ed3f612..f1b742d 100755 --- a/commands/gen-control +++ b/commands/gen-control @@ -29,21 +29,26 @@ while (<KVERS>) { die "parse error"; } push @versions, [ $arch, $kernelversion, $flavour ]; - foreach my $pkg (split(", ", $builddep)) { - push @builddeps, "$pkg [$arch]"; + if ($builddep ne "-") { + foreach my $pkg (split(", ", $builddep)) { + push @builddeps, "$pkg [$arch]"; + } } } close KVERS; -open(STUB, "debian/control.stub") || die "debian/control.stub: $!"; -while (<STUB>) { - chomp; - if (/^Build-Depends:/) { - $_=join(", ", $_, @builddeps); +# Building with installed kernel package, or as part of a package? +if (@builddeps) { + open(STUB, "debian/control.stub") || die "debian/control.stub: $!"; + while (<STUB>) { + chomp; + if (/^Build-Depends:/) { + $_=join(", ", $_, @builddeps); + } + print $_."\n"; } - print $_."\n"; + close STUB; } -close STUB; sub read_package_list { diff --git a/commands/install-files b/commands/install-files index 9b88b71..482fbeb 100755 --- a/commands/install-files +++ b/commands/install-files @@ -12,10 +12,7 @@ sub doit { my $hostarch=`dpkg-architecture -qDEB_HOST_ARCH`; chomp $hostarch; -my $sourcedir=$ENV{SOURCEDIR}; -if (! defined $sourcedir) { - $sourcedir=""; -} +my $fixsourcedir = $ENV{SOURCEDIR}; open(KVERS, "kernel-versions") || die "kernel-versions: $!"; my $version = 0; @@ -31,6 +28,23 @@ while (<KVERS>) { } next unless $arch eq $hostarch; + my $sourcedir; + if (defined $fixsourcedir) { + $sourcedir = $fixsourcedir; + } else { + # Building with installed kernel package, or as part + # of a package? + if ($builddep ne "-") { + $sourcedir = ""; + } elsif ($arch =~ /^kfreebsd-/) { + $sourcedir = "debian/kfreebsd-image-$installedname"; + } else { + $sourcedir = "debian/linux-image-$installedname"; + } + # Set SOURCEDIR for copy-modules + $ENV{SOURCEDIR} = $sourcedir; + } + my $extraname=""; if ($suffix =~ /^[yY]/) { $extraname="-$kernelversion-$flavour"; diff --git a/debian/changelog b/debian/changelog index 2dcbad0..4cfaab0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,9 @@ kernel-wedge (2.79) UNRELEASED; urgency=low [ Samuel Thibault ] * sound-modules: Update to 3.0. + [ Ben Hutchings ] + * Allow kernel source packages to use kernel-wedge on themselves + -- Samuel Thibault <sthibault@debian.org> Mon, 08 Aug 2011 18:34:12 +0200 kernel-wedge (2.78) unstable; urgency=low -- 1.7.5.4
Attachment:
signature.asc
Description: This is a digitally signed message part