Made gencontrol general enough to generate

both the master control file and the control
file used for building a specific kernel image.

svn path=/trunk/kernel/source/linux-2.6/; revision=3640
This commit is contained in:
Jurij Smakov 2005-07-31 02:55:53 +00:00
parent b4bef78582
commit 292c8bde8a
3 changed files with 48 additions and 48 deletions

30
debian/Makefile vendored
View File

@ -183,35 +183,7 @@ $(kdir): post-install-$(subarch) $(wildcard templates/control.*.in)
mkdir -p $(tkdir)/debian
cp changelog $(tkdir)/debian
cp copyright $(tkdir)/debian
substitute() { \
class="$$2-class"; \
longclass=""; \
desc=""; \
[ -f "debian/arch/$(karch)/$(append)/desc.$$2" ] && . "debian/arch/$(karch)/$(append)/desc.$$2"; \
[ -z "$$longclass" ] && longclass="$$class"; \
cat templates/control.$$1 | \
sed -e 's/@version@/$(version)/g' \
-e 's/@major@/$(major)/g' \
-e "s/@arch@/$(karch)/g" \
-e "s/@subarch@/$(append)/g" \
-e "s/@flavour@/$$2/g" \
-e "s#@class@#$$class#g" \
-e "s#@longclass@#$$longclass#g" \
-e 's/@ltver@/$(ltver)/g' \
-e 's/@srcver@/$(srcver)/g' \
-e 's/@lt_depends@/$(lt_depends)/g' \
-e 's/@lt_provides@/$(lt_provides)/g' \
-e 's/@abiname@/$(abiname)/g' | \
sed '/^[[:space:]]*$$/d' | \
sed 's/^Package:/\n&/g'; \
[ -z "$$3" ] || printf "$$desc\n"; \
}; \
substitute source.in "" >> $(tkdir)/debian/control; \
substitute headers.in "" >> $(tkdir)/debian/control; \
for f in $(flavours); do \
substitute headers.flavour.in $$f >> $(tkdir)/debian/control; \
substitute image.in $$f "1" >> $(tkdir)/debian/control; \
done
arch=$(karch) subarch=$(subarch) bin/gencontrol > $(tkdir)/debian/control
touch $(tkdir)/debian/official
if [ -n '$(patches)' ]; then \
cd $(tkdir); \

56
debian/bin/gencontrol vendored
View File

@ -1,8 +1,19 @@
#!/bin/sh
#
# If the arch/subarch environment variables are set by the caller,
# we assume that we are called to generate the control file for the
# particular image build. Otherwise we'll generate master control
# file, including all arch/subarch/flavour combinations.
#
if [ -d debian ]; then
basedir='debian'
else
basedir='.'
fi
#
# This is created by the debian/makevars target in the rules file.
#
. debian/makevars
. ${basedir}/makevars
#
# Various arch-specific substitutions to kludge around the fact
# that we cannot have the arch-specific Depends, Suggests and
@ -28,18 +39,23 @@ arch_suggests_sparc='silo'
arch_recommends_i386='irqbalance'
list_arches() {
find debian/arch -mindepth 1 -maxdepth 1 \
find ${basedir}/arch -mindepth 1 -maxdepth 1 \
! -name '*.svn*' -type d -printf '%f\n'
}
#
# Parameters:
# ${1} - architecture to list the subarches for
# ${2} - if non-zero, the value of this argument is returned
#
list_subarches() {
echo "none"
find debian/arch/${1} -mindepth 1 -maxdepth 1 \
! -name '*.svn*' -type d -printf '%f\n'
if [ -n "${2}" ]; then
echo "${2}"
else
echo "none"
find ${basedir}/arch/${1} -mindepth 1 -maxdepth 1 \
! -name '*.svn*' -type d -printf '%f\n'
fi
}
#
@ -48,7 +64,7 @@ list_subarches() {
# ${2} - subarchitecture ('none' if there are no subarches)
#
list_flavours() {
find debian/arch/${1}/${2#none} -name 'config.*' \
find ${basedir}/arch/${1}/${2#none} -name 'config.*' \
! -name '*.svn*' -printf '%f\n' | sed 's/^config\.//'
}
@ -62,10 +78,10 @@ list_flavours() {
substitute() {
if [ "${3}" = "none" ]; then
sa=""
sdir="debian/arch/${2}"
sdir="${basedir}/arch/${2}"
else
sa="${3}-"
sdir="debian/arch/${2}/${3}"
sdir="${basedir}/arch/${2}/${3}"
fi
class="${4}-class"
longclass=""
@ -86,7 +102,7 @@ substitute() {
arch_recommends="Recommends: ${arch_recommends}"
fi
cat debian/templates/control.${1} | \
cat ${basedir}/templates/control.${1} | \
sed -e "s#@version@#${version}#g" \
-e "s#@major@#${major}#g" \
-e "s#@arch@#${2}#g" \
@ -104,19 +120,31 @@ substitute() {
-e "s#@arch_recommends@#${arch_recommends}#g"
[ -z "${5}" ] || printf "${desc}\n"
}
#
# Main routine
#
rm -f control.tmp 2>/dev/null
substitute source.in "" "none" >> control.tmp
substitute main.in "" "none" >> control.tmp
if [ -n "${arch}" ]; then
test -z "${subarch}" && subarch='none'
else
substitute main.in "" "none" >> control.tmp
arch="$(list_arches)"
fi
substitute headers.in "" "none" >> control.tmp
for a in $(list_arches); do
for s in $(list_subarches ${a}); do
for a in ${arch}; do
for s in $(list_subarches ${a} ${subarch}); do
for f in $(list_flavours ${a} ${s}); do
substitute headers.flavour.in ${a} ${s} ${f} >> control.tmp
substitute image.in ${a} ${s} ${f} "1" >> control.tmp
done
done
done
#
# Output it all to the stdout
#
sed -e '/^[[:space:]]*$/d' control.tmp | \
sed -e 's/^Package:/\n&/g' | grep -v '^#' > debian/control
sed -e 's/^Package:/\n&/g' | grep -v '^#'
rm -rf control.tmp

10
debian/rules vendored
View File

@ -178,7 +178,7 @@ debian/doc-stamp: debian/patch-stamp
touch debian/doc-stamp
unpack: debian/unpack-stamp
debian/unpack-stamp: debian/patch-stamp
debian/unpack-stamp: debian/patch-stamp debian/makevars
dh_testdir
cd debian; \
for i in $(subarchs); do \
@ -188,7 +188,7 @@ debian/unpack-stamp: debian/patch-stamp
touch debian/unpack-stamp
build: debian/build-stamp
debian/build-stamp: debian/unpack-stamp
debian/build-stamp: debian/unpack-stamp debian/makevars
dh_testdir
cd debian; \
for i in $(subarchs); do \
@ -215,11 +215,11 @@ clean: unpatch
cd debian; \
rm -f *-stamp-* *-stamp config.* *.kpatches.arch; \
rm -f header-install-* post-install-* bin/touch.orig; \
rm -rf linux-source-* build-* install-*
rm -rf linux-source-* build-* install-* makevars
dh_clean
binary-indep: source tree patch-debian doc
binary-arch: build
binary-arch: build debian/makevars
dh_testdir
cd debian; \
for i in $(subarchs); do \
@ -233,7 +233,7 @@ binary: binary-indep binary-arch
# variable values into the template.
#
debian/control: $(wildcard debian/templates/control.*.in) debian/makevars
debian/bin/gencontrol
debian/bin/gencontrol > debian/control
debian/makevars:
echo 'version='\''$(version)'\' > debian/makevars