FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 09-21-2011, 03:30 AM
Ben Hutchings
 
Default Allow configuration files to be placed in a subdirectory

In a kernel source package, which will be non-native, the kernel-wedge
configuration should be placed under the debian/ directory.

copy-modules, gen-control, gen-deps, install-files: Allow the
configuration directory to be specified as a command-line argument.
---
commands/copy-modules | 19 ++++++++++---------
commands/gen-control | 17 +++++++++--------
commands/gen-deps | 11 ++++++-----
commands/install-files | 15 ++++++++-------
debian/changelog | 1 +
5 files changed, 34 insertions(+), 29 deletions(-)

diff --git a/commands/copy-modules b/commands/copy-modules
index 974347d..ad8fac8 100755
--- a/commands/copy-modules
+++ b/commands/copy-modules
@@ -81,6 +81,7 @@ processmodules() {
version=$1-$2
flavour=$2
installedname=$3
+configdir=$(readlink -f ${4:-.})
arch=$(dpkg-architecture -qDEB_HOST_ARCH)
os=$(dpkg-architecture -qDEB_HOST_ARCH_OS)
home=$PWD
@@ -102,12 +103,12 @@ if [ ! -d $moddir ]; then
fi

# The directory of modules lists to use.
-if [ -d modules/$arch-$flavour ]; then
- modlistdir=modules/$arch-$flavour
-elif [ -d modules/$flavour ]; then
- modlistdir=modules/$flavour
+if [ -d $configdir/modules/$arch-$flavour ]; then
+ modlistdir=$configdir/modules/$arch-$flavour
+elif [ -d $configdir/modules/$flavour ]; then
+ modlistdir=$configdir/modules/$flavour
else
- modlistdir=modules/$arch
+ modlistdir=$configdir/modules/$arch
fi

if [ "$os" = "linux" ] ; then
@@ -132,9 +133,9 @@ if [ "$os" = "linux" ] ; then
}
' $modulesdep | sort -k 2,2 > $tmpdir/deps

- if [ ! -s $tmpdir/deps ] && [ ! -e $home/no-modules ]; then
+ if [ ! -s $tmpdir/deps ] && [ ! -e $configdir/no-modules ]; then
echo "No module interdependencies found. This probably means your modules.dep is broken." >&2
- echo "If this is intentional, touch $home/no-modules" >&2
+ echo "If this is intentional, touch $configdir/no-modules" >&2
exit 1
fi
else
@@ -144,7 +145,7 @@ fi
mkdir $tmpdir/module-deps $tmpdir/module-list

# generate module interrelationships from package-list file
-kernel-wedge gen-deps $flavour > $tmpdir/module-deps.packages
+kernel-wedge gen-deps $flavour $configdir > $tmpdir/module-deps.packages

code=0
# loop over all udebs, sort that all dependent modules are processed first
@@ -166,7 +167,7 @@ for i in $(

# preprocess file, handle includes and excludes and sort so that
# the joins work, no matter what the order of the input.
- kernel-wedge preprocess $home/$modlistdir/$i | sort > $tmpdir/module-list/$i
+ kernel-wedge preprocess $modlistdir/$i | sort > $tmpdir/module-list/$i

# exclude modules in exclude from dependency list
join -2 2 -v 2 $tmpdir/exclude $tmpdir/deps |
diff --git a/commands/gen-control b/commands/gen-control
index 764144d..3f75211 100755
--- a/commands/gen-control
+++ b/commands/gen-control
@@ -12,8 +12,9 @@ my @builddeps;
my %excluded;

my $fixkernelversion = $ARGV[0];
+my $configdir = ($ARGV[1] || '.');

-if (open(EXCLUDED, "exclude-packages")) {
+if (open(EXCLUDED, "$configdir/exclude-packages")) {
while (<EXCLUDED>) {
chomp;
$excluded{$_}=1;
@@ -21,7 +22,7 @@ if (open(EXCLUDED, "exclude-packages")) {
close EXCLUDED;
}

-open(KVERS, "kernel-versions") || die "kernel-versions: $!";
+open(KVERS, "$configdir/kernel-versions") || die "kernel-versions: $!";
while (<KVERS>) {
chomp;
next if /^#/ || ! length;
@@ -108,7 +109,7 @@ sub read_package_list
close LIST;
}
read_package_list("/usr/share/kernel-wedge/package-list");
-read_package_list("package-list");
+read_package_list("$configdir/package-list");

foreach my $ver (@versions) {
my ($arch, $kernelversion, $flavour) = @$ver;
@@ -133,14 +134,14 @@ foreach my $ver (@versions) {
# Check for a modules list file for this architecture and
# package.
my $modlistdir="";
- if (-d "modules/$arch-$flavour") {
- $modlistdir="modules/$arch-$flavour";
+ if (-d "$configdir/modules/$arch-$flavour") {
+ $modlistdir = "$configdir/modules/$arch-$flavour";
}
- elsif (-d "modules/$flavour") {
- $modlistdir="modules/$flavour";
+ elsif (-d "$configdir/modules/$flavour") {
+ $modlistdir = "$configdir/modules/$flavour";
}
else {
- $modlistdir="modules/$arch";
+ $modlistdir = "$configdir/modules/$arch";
}

next unless -e "$modlistdir/".$package->("Package");
diff --git a/commands/gen-deps b/commands/gen-deps
index 94e77be..9dfd610 100755
--- a/commands/gen-deps
+++ b/commands/gen-deps
@@ -7,6 +7,7 @@ my $arch=`dpkg-architecture -qDEB_HOST_ARCH`;
chomp $arch;

my $flavour=$ARGV[0];
+my $configdir = ($ARGV[1] || '.');

my @out;

@@ -26,14 +27,14 @@ sub read_package_list
my @depends=split(", ", $1);
# Skip packages that are not built for this architecture.
my $modlistdir="";
- if (-d "modules/$arch-$flavour") {
- $modlistdir="modules/$arch-$flavour";
+ if (-d "$configdir/modules/$arch-$flavour") {
+ $modlistdir = "$configdir/modules/$arch-$flavour";
}
elsif (-d "modules/$flavour") {
- $modlistdir="modules/$flavour";
+ $modlistdir = "$configdir/modules/$flavour";
}
else {
- $modlistdir="modules/$arch";
+ $modlistdir = "$configdir/modules/$arch";
}
next unless -e "$modlistdir/$package";
foreach my $dep (@depends) {
@@ -48,5 +49,5 @@ sub read_package_list
}

read_package_list("/usr/share/kernel-wedge/package-list");
-read_package_list("package-list");
+read_package_list("$configdir/package-list");
print sort @out;
diff --git a/commands/install-files b/commands/install-files
index 3cabf86..1be880a 100755
--- a/commands/install-files
+++ b/commands/install-files
@@ -15,8 +15,9 @@ chomp $hostarch;
my $fixsourcedir = $ENV{SOURCEDIR};

my $fixkernelversion = $ARGV[0];
+my $configdir = ($ARGV[1] || '.');

-open(KVERS, "kernel-versions") || die "kernel-versions: $!";
+open(KVERS, "$configdir/kernel-versions") || die "kernel-versions: $!";
my $version = 0;
while (<KVERS>) {
chomp;
@@ -66,14 +67,14 @@ while (<KVERS>) {
}

my $modlistdir;
- if (-d "modules/$arch-$flavour") {
- $modlistdir="modules/$arch-$flavour";
+ if (-d "$configdir/modules/$arch-$flavour") {
+ $modlistdir = "$configdir/modules/$arch-$flavour";
}
- elsif (-d "modules/$flavour") {
- $modlistdir="modules/$flavour";
+ elsif (-d "$configdir/modules/$flavour") {
+ $modlistdir = "$configdir/modules/$flavour";
}
else {
- $modlistdir="modules/$arch";
+ $modlistdir = "$configdir/modules/$arch";
}

if (! -e "$modlistdir/kernel-image") {
@@ -126,7 +127,7 @@ while (<KVERS>) {
"debian/kernel-image-$kernelversion-$flavour-di/usr/lib/$libdir-$installedname");
}

- doit("kernel-wedge", "copy-modules", $kernelversion, $flavour, $installedname);
+ doit("kernel-wedge", "copy-modules", $kernelversion, $flavour, $installedname, $configdir);
doit("kernel-wedge", "find-dups", "$kernelversion-$flavour");
doit("kernel-wedge", "strip-modules", "$kernelversion-$flavour");
}
diff --git a/debian/changelog b/debian/changelog
index 9cc2682..a19ae2d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ kernel-wedge (2.79) UNRELEASED; urgency=low
[ Ben Hutchings ]
* Allow kernel source packages to use kernel-wedge on themselves
* Allow kernel ABI version to be specified as command-line argument
+ * Allow configuration files to be placed in a subdirectory

-- Samuel Thibault <sthibault@debian.org> Mon, 08 Aug 2011 18:34:12 +0200

--
1.7.5.4
 
Old 09-21-2011, 02:41 PM
Joey Hess
 
Default Allow configuration files to be placed in a subdirectory

Other patches applied.

Ben Hutchings wrote:
> In a kernel source package, which will be non-native, the kernel-wedge
> configuration should be placed under the debian/ directory.
>
> copy-modules, gen-control, gen-deps, install-files: Allow the
> configuration directory to be specified as a command-line argument.

I can think of two better ways to do this. An environment variable would
avoid cluttering the parameters of the subcommands with this (and note
that your patch passes it in different parameter positions to different
subcommands), and would make it easily available to any subcommand that
needs it in the future.

Or, it could just parse debian/changelog to see if the package is native
and have a special mode for native packages. While a bit DWIM, that
seems perhaps nicer even.

--
see shy jo
 
Old 09-22-2011, 01:46 PM
Ben Hutchings
 
Default Allow configuration files to be placed in a subdirectory

In a kernel source package, which will be non-native, the kernel-wedge
configuration should be placed under the debian/ directory.

copy-modules, gen-control, gen-deps, install-files: If the environment
variable $KW_CONFIG_DIR is set, look for configuration files in the
specified directory (which may be relative).
---
This adds an environment variable instead of additional parameters, as
requested. I even remembered to update the documentation for this one.

Please apply and then upload a new version of kernel-wedge.

Ben.

README | 5 +++++
commands/copy-modules | 17 +++++++++--------
commands/gen-control | 18 ++++++++++--------
commands/gen-deps | 12 +++++++-----
commands/install-files | 13 +++++++------
debian/changelog | 1 +
6 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/README b/README
index 06f061e..6bf5b87 100644
--- a/README
+++ b/README
@@ -9,11 +9,16 @@ looking something like this:
debian/changelog
debian/rules
debian/control.stub
+
kernel-versions
modules/<arch>/*
exclude-packages
package-list

+The second group of files may be placed in a subdirectory, in which
+case the environment variable $KW_CONFIG_DIR must be set to the
+subdirectory name.
+
Let's get the easy files out of the way. The changelog is a changelog, like
any other, as is the copyright. The debian/rules can be something as simple
as this:
diff --git a/commands/copy-modules b/commands/copy-modules
index 974347d..f20ac3c 100755
--- a/commands/copy-modules
+++ b/commands/copy-modules
@@ -81,6 +81,7 @@ processmodules() {
version=$1-$2
flavour=$2
installedname=$3
+configdir=$(readlink -f ${KW_CONFIG_DIR:-.})
arch=$(dpkg-architecture -qDEB_HOST_ARCH)
os=$(dpkg-architecture -qDEB_HOST_ARCH_OS)
home=$PWD
@@ -102,12 +103,12 @@ if [ ! -d $moddir ]; then
fi

# The directory of modules lists to use.
-if [ -d modules/$arch-$flavour ]; then
- modlistdir=modules/$arch-$flavour
-elif [ -d modules/$flavour ]; then
- modlistdir=modules/$flavour
+if [ -d $configdir/modules/$arch-$flavour ]; then
+ modlistdir=$configdir/modules/$arch-$flavour
+elif [ -d $configdir/modules/$flavour ]; then
+ modlistdir=$configdir/modules/$flavour
else
- modlistdir=modules/$arch
+ modlistdir=$configdir/modules/$arch
fi

if [ "$os" = "linux" ] ; then
@@ -132,9 +133,9 @@ if [ "$os" = "linux" ] ; then
}
' $modulesdep | sort -k 2,2 > $tmpdir/deps

- if [ ! -s $tmpdir/deps ] && [ ! -e $home/no-modules ]; then
+ if [ ! -s $tmpdir/deps ] && [ ! -e $configdir/no-modules ]; then
echo "No module interdependencies found. This probably means your modules.dep is broken." >&2
- echo "If this is intentional, touch $home/no-modules" >&2
+ echo "If this is intentional, touch $configdir/no-modules" >&2
exit 1
fi
else
@@ -166,7 +167,7 @@ for i in $(

# preprocess file, handle includes and excludes and sort so that
# the joins work, no matter what the order of the input.
- kernel-wedge preprocess $home/$modlistdir/$i | sort > $tmpdir/module-list/$i
+ kernel-wedge preprocess $modlistdir/$i | sort > $tmpdir/module-list/$i

# exclude modules in exclude from dependency list
join -2 2 -v 2 $tmpdir/exclude $tmpdir/deps |
diff --git a/commands/gen-control b/commands/gen-control
index 9845a74..5ec7bbf 100755
--- a/commands/gen-control
+++ b/commands/gen-control
@@ -11,9 +11,11 @@ my %packages;
my @builddeps;
my %excluded;

+my $configdir = ($ENV{KW_CONFIG_DIR} || '.');
+
my $fixkernelversion = $ARGV[0];

-if (open(EXCLUDED, "exclude-packages")) {
+if (open(EXCLUDED, "$configdir/exclude-packages")) {
while (<EXCLUDED>) {
chomp;
$excluded{$_}=1;
@@ -21,7 +23,7 @@ if (open(EXCLUDED, "exclude-packages")) {
close EXCLUDED;
}

-open(KVERS, "kernel-versions") || die "kernel-versions: $!";
+open(KVERS, "$configdir/kernel-versions") || die "kernel-versions: $!";
while (<KVERS>) {
chomp;
next if /^#/ || ! length;
@@ -109,7 +111,7 @@ sub read_package_list
close LIST;
}
read_package_list("/usr/share/kernel-wedge/package-list");
-read_package_list("package-list");
+read_package_list("$configdir/package-list");

foreach my $ver (@versions) {
my ($arch, $kernelversion, $flavour) = @$ver;
@@ -134,14 +136,14 @@ foreach my $ver (@versions) {
# Check for a modules list file for this architecture and
# package.
my $modlistdir="";
- if (-d "modules/$arch-$flavour") {
- $modlistdir="modules/$arch-$flavour";
+ if (-d "$configdir/modules/$arch-$flavour") {
+ $modlistdir = "$configdir/modules/$arch-$flavour";
}
- elsif (-d "modules/$flavour") {
- $modlistdir="modules/$flavour";
+ elsif (-d "$configdir/modules/$flavour") {
+ $modlistdir = "$configdir/modules/$flavour";
}
else {
- $modlistdir="modules/$arch";
+ $modlistdir = "$configdir/modules/$arch";
}

next unless -e "$modlistdir/".$package->("Package");
diff --git a/commands/gen-deps b/commands/gen-deps
index 94e77be..4509cc5 100755
--- a/commands/gen-deps
+++ b/commands/gen-deps
@@ -6,6 +6,8 @@
my $arch=`dpkg-architecture -qDEB_HOST_ARCH`;
chomp $arch;

+my $configdir = ($ENV{KW_CONFIG_DIR} || '.');
+
my $flavour=$ARGV[0];

my @out;
@@ -26,14 +28,14 @@ sub read_package_list
my @depends=split(", ", $1);
# Skip packages that are not built for this architecture.
my $modlistdir="";
- if (-d "modules/$arch-$flavour") {
- $modlistdir="modules/$arch-$flavour";
+ if (-d "$configdir/modules/$arch-$flavour") {
+ $modlistdir = "$configdir/modules/$arch-$flavour";
}
elsif (-d "modules/$flavour") {
- $modlistdir="modules/$flavour";
+ $modlistdir = "$configdir/modules/$flavour";
}
else {
- $modlistdir="modules/$arch";
+ $modlistdir = "$configdir/modules/$arch";
}
next unless -e "$modlistdir/$package";
foreach my $dep (@depends) {
@@ -48,5 +50,5 @@ sub read_package_list
}

read_package_list("/usr/share/kernel-wedge/package-list");
-read_package_list("package-list");
+read_package_list("$configdir/package-list");
print sort @out;
diff --git a/commands/install-files b/commands/install-files
index 999cc2d..5478f1f 100755
--- a/commands/install-files
+++ b/commands/install-files
@@ -12,11 +12,12 @@ sub doit {
my $hostarch=`dpkg-architecture -qDEB_HOST_ARCH`;
chomp $hostarch;

+my $configdir = ($ENV{KW_CONFIG_DIR} || '.');
my $fixsourcedir = $ENV{SOURCEDIR};

my $fixkernelversion = $ARGV[0];

-open(KVERS, "kernel-versions") || die "kernel-versions: $!";
+open(KVERS, "$configdir/kernel-versions") || die "kernel-versions: $!";
my $version = 0;
while (<KVERS>) {
chomp;
@@ -70,14 +71,14 @@ while (<KVERS>) {
}

my $modlistdir;
- if (-d "modules/$arch-$flavour") {
- $modlistdir="modules/$arch-$flavour";
+ if (-d "$configdir/modules/$arch-$flavour") {
+ $modlistdir = "$configdir/modules/$arch-$flavour";
}
- elsif (-d "modules/$flavour") {
- $modlistdir="modules/$flavour";
+ elsif (-d "$configdir/modules/$flavour") {
+ $modlistdir = "$configdir/modules/$flavour";
}
else {
- $modlistdir="modules/$arch";
+ $modlistdir = "$configdir/modules/$arch";
}

if (! -e "$modlistdir/kernel-image") {
diff --git a/debian/changelog b/debian/changelog
index 9cc2682..a19ae2d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ kernel-wedge (2.79) UNRELEASED; urgency=low
[ Ben Hutchings ]
* Allow kernel source packages to use kernel-wedge on themselves
* Allow kernel ABI version to be specified as command-line argument
+ * Allow configuration files to be placed in a subdirectory

-- Samuel Thibault <sthibault@debian.org> Mon, 08 Aug 2011 18:34:12 +0200

--
1.7.5.4
 

Thread Tools




All times are GMT. The time now is 10:03 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org