/[d-i]/trunk/kernel/linux-kernel-di/copy-modules
ViewVC logotype

Contents of /trunk/kernel/linux-kernel-di/copy-modules

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8027 - (show annotations) (download)
Wed Jan 21 20:00:43 2004 UTC (9 years, 4 months ago) by joeyh
File size: 3304 byte(s)
  * Fix naming of powerpc's nic-extra-modules and nic-shared-modules.
  * Rename powerpc small kernels to have "powerpc-small" in the flavour,
    for consistency. Patch from Jeremie Koenig.
1 #!/bin/sh
2 #
3 # Copy modules into the right directories in preparation for building udebs.
4 # This script is named after the its counterpart in the original
5 # kernel-image-di package by Joey Hess <joeyh@debian.org>.
6 #
7 # Copyright (c) 2001-2002 Herbert Xu <herbert@debian.org>
8 #
9 # Usage: copy-modules version flavour installedname
10
11 set -e
12
13 deplist() {
14 deps=$1
15 list=$2
16 cp $list $tmpdir/work
17
18 # recursively append external dependencies to $list
19 while :; do
20
21 # list external dependencies of $work
22 join -o 2.2 $tmpdir/work $deps | sort -u | comm -23 - $list \
23 > $tmpdir/work.new
24 mv $tmpdir/work.new $tmpdir/work
25
26 # exit if work is empty
27 [ -s $tmpdir/work ] || break
28
29 # append work to $list
30 sort -um -o $list $list $tmpdir/work
31 done
32 }
33
34 version=$1-$2
35 flavour=$2
36 installedname=$3
37 arch=$(dpkg-architecture -qDEB_HOST_ARCH)
38 home=$PWD
39
40 trap 'rm -rf $tmpdir' EXIT
41 tmpdir=$(tempfile)
42 rm $tmpdir
43 mkdir $tmpdir
44
45 # SOURCEDIR may be set externally to control where to copy from.
46 if [ -n "$SOURCEDIR" ]; then
47 moddir=$SOURCEDIR/lib/modules/$installedname
48 else
49 moddir=/lib/modules/$installedname
50 fi
51
52 # The directory of modules lists to use.
53 if [ -d modules/$arch-$flavour ]; then
54 modlistdir=modules/$arch-$flavour
55 elif [ -d modules/$flavour ]; then
56 modlistdir=modules/$flavour
57 else
58 modlistdir=modules/$arch
59 fi
60
61 # get module dependencies from modules.dep
62 # sort it by field 2
63 perl -lne '
64 @words=split(" ");
65 s!.*/kernel/!! foreach (@words);
66 if ($words[0] =~ /:$/) {
67 $words[0]=~s/:$//;
68 $module=$words[0];
69 if ($words[1]) {
70 print "$module\t$words[1]";
71 }
72 }
73 elsif ($words[0]) { # continuation
74 print "$module\t$words[0]";
75 }
76 ' $moddir/modules.dep | sort -k 2,2 > $tmpdir/deps
77 unset moddir_awk
78
79 mkdir $tmpdir/module-deps $tmpdir/module-list
80
81 # generate module interealationships from package-list file
82 ./gen-deps $flavour > $tmpdir/module-deps.packages
83
84 # loop over all udebs, sort that all dependent modules are processed first
85 for i in $(
86 {
87 find $modlistdir -maxdepth 1 \( -type f -or -type l \) -not -name '*.lnk' -printf "%f\t%f\n"
88 cat $tmpdir/module-deps.packages
89 } | tsort | tac
90 ); do
91 # write dependent (direct and indirect) udebs to exclude
92 # write dependencies to module-deps/$i
93 echo $i | join -o 2.2 - $tmpdir/module-deps.packages | { # dependent modules
94 cd $tmpdir/module-deps
95 xargs -r sh -c 'printf "%s\n" "$@"; cat "$@"' sh # direct and indirect deps
96 } | sort -u | tee $tmpdir/module-deps/$i | { # write deps
97 cd $tmpdir/module-list
98 xargs -r cat
99 } | sort -u > $tmpdir/exclude # modules to exclude
100 # Sort so that the joins work, no matter what the order of the
101 # input file.
102 sort $home/$modlistdir/$i > $tmpdir/module-list/$i
103
104 # exclude modules in exclude from dependency list
105 join -2 2 -v 2 $tmpdir/exclude $tmpdir/deps |
106 sort -k 1,1 > $tmpdir/tmpdeps
107
108 # include dependent modules which are not in a
109 # dependent udeb into module-list/$i
110 deplist $tmpdir/tmpdeps $tmpdir/module-list/$i
111
112 # copy kernel modules to package build dir
113 cd $moddir/kernel
114 ret=$( ( (
115 set +e
116 tar cfT - $tmpdir/module-list/$i
117 printf $? >&3
118 ) | (
119 set +e
120 dir=$home/debian/$i-$version-di/lib/modules/$installedname/kernel
121 mkdir -p $dir
122 cd $dir
123 tar xf -
124 printf $? >&3
125 ) ) 3>&1)
126 if [ "$ret" != "00" ]; then
127 echo "tar failed" >&2
128 exit $ret
129 fi
130 done

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.5