The "I hope I did not break anything" commit.
Move the control file generation to a separate script (debian/bin/gencontrol), unuglifying it along the way (hi, dilinger :-). This is a first step towards the solution for 319896. svn path=/trunk/kernel/source/linux-2.6/; revision=3637
This commit is contained in:
parent
f763f717a3
commit
1de4d541ce
|
@ -0,0 +1,82 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# This is created by the debian/makevars target in the rules file.
|
||||||
|
#
|
||||||
|
. debian/makevars
|
||||||
|
|
||||||
|
list_arches() {
|
||||||
|
find debian/arch -mindepth 1 -maxdepth 1 \
|
||||||
|
! -name '*.svn*' -type d -printf '%f\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# ${1} - architecture to list the subarches for
|
||||||
|
#
|
||||||
|
list_subarches() {
|
||||||
|
echo "none"
|
||||||
|
find debian/arch/${1} -mindepth 1 -maxdepth 1 \
|
||||||
|
! -name '*.svn*' -type d -printf '%f\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# ${1} - architecture
|
||||||
|
# ${2} - subarchitecture ('none' if there are no subarches)
|
||||||
|
#
|
||||||
|
list_flavours() {
|
||||||
|
find debian/arch/${1}/${2#none} -name 'config.*' \
|
||||||
|
! -name '*.svn*' -printf '%f\n' | sed 's/^config\.//'
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Parameters:
|
||||||
|
# ${1} - filename to use as a template
|
||||||
|
# ${2} - arch
|
||||||
|
# ${3} - subarch ('none', if the subarch is empty)
|
||||||
|
# ${4} - flavour
|
||||||
|
#
|
||||||
|
substitute() {
|
||||||
|
if [ "${3}" = "none" ]; then
|
||||||
|
sa=""
|
||||||
|
sdir="debian/arch/${2}"
|
||||||
|
else
|
||||||
|
sa="${3}-"
|
||||||
|
sdir="debian/arch/${2}/${3}"
|
||||||
|
fi
|
||||||
|
class="${4}-class"
|
||||||
|
longclass=""
|
||||||
|
desc=""
|
||||||
|
[ -f "${sdir}/desc.${4}" ] && . "${sdir}/desc.${4}"
|
||||||
|
[ -z "${longclass}" ] && longclass="${class}"
|
||||||
|
cat debian/templates/control.${1} | \
|
||||||
|
sed -e "s#@version@#${version}#g" \
|
||||||
|
-e "s#@major@#${major}#g" \
|
||||||
|
-e "s#@arch@#${2}#g" \
|
||||||
|
-e "s#@subarch@#${sa}#g" \
|
||||||
|
-e "s#@flavour@#${4}#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"
|
||||||
|
[ -z "${5}" ] || printf "${desc}\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
rm -f control.tmp 2>/dev/null
|
||||||
|
substitute source.in "" "none" >> control.tmp
|
||||||
|
substitute main.in "" "none" >> control.tmp
|
||||||
|
substitute headers.in "" "none" >> control.tmp
|
||||||
|
for a in $(list_arches); do
|
||||||
|
for s in $(list_subarches ${a}); 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
|
||||||
|
sed -e '/^[[:space:]]*$/d' control.tmp | \
|
||||||
|
sed -e 's/^Package:/\n&/g' > debian/control
|
||||||
|
rm -rf control.tmp
|
|
@ -22,6 +22,7 @@ uver := $(subst .,_,$(version))
|
||||||
lt_depends += $(shell seq -f 'linux-source-$(version) (= $(version)-%g)' \
|
lt_depends += $(shell seq -f 'linux-source-$(version) (= $(version)-%g)' \
|
||||||
-s ' | ' 1 $(ltver))
|
-s ' | ' 1 $(ltver))
|
||||||
lt_provides := $(shell seq -f 'linux-tree-$(version)-%g' -s ', ' 1 $(ltver))
|
lt_provides := $(shell seq -f 'linux-tree-$(version)-%g' -s ', ' 1 $(ltver))
|
||||||
|
lt_provides := $(strip $(lt_provides))
|
||||||
#
|
#
|
||||||
# If we are not passed a subarchs variable, we obtain the complete
|
# If we are not passed a subarchs variable, we obtain the complete
|
||||||
# subarch list as a list of subdirectories in arch/$(karch). We
|
# subarch list as a list of subdirectories in arch/$(karch). We
|
||||||
|
@ -231,66 +232,17 @@ binary: binary-indep binary-arch
|
||||||
# Makes the master debian/control file by substituting
|
# Makes the master debian/control file by substituting
|
||||||
# variable values into the template.
|
# variable values into the template.
|
||||||
#
|
#
|
||||||
# I truly apologize for what I've created.. -dil
|
debian/control: $(wildcard debian/templates/control.*.in) debian/makevars
|
||||||
#
|
debian/bin/gencontrol
|
||||||
archs := $(shell find debian/arch/ -mindepth 1 -maxdepth 1 -type d ! -name '.svn' -printf '%f\n')
|
|
||||||
debian/control: $(wildcard debian/templates/control.*.in)
|
debian/makevars:
|
||||||
rm -f control.tmp 2>/dev/null
|
echo 'version='\''$(version)'\' > debian/makevars
|
||||||
list_flavours() { \
|
echo 'major='\''$(major)'\' >> debian/makevars
|
||||||
find debian/arch/$$1/ -name 'config.*' \
|
echo 'srcver='\''$(srcver)'\' >> debian/makevars
|
||||||
! -name '*.svn*' -printf '%f\n' | \
|
echo 'ltver='\''$(ltver)'\' >> debian/makevars
|
||||||
sed 's/^config\.//'; \
|
echo 'lt_depends='\''$(srcver)'\' >> debian/makevars
|
||||||
}; \
|
echo 'lt_depends='\''$(lt_depends)'\' >> debian/makevars
|
||||||
get_all_headers_pkgs() { \
|
echo 'lt_provides='\''$(lt_provides)'\' >> debian/makevars
|
||||||
result=""; \
|
echo 'abiname='\''$(abiname)'\' >> debian/makevars
|
||||||
for flavour in `list_flavours $$1`; do \
|
|
||||||
if [ -z "$$result" ]; then \
|
|
||||||
comma=""; \
|
|
||||||
else \
|
|
||||||
comma=", "; \
|
|
||||||
fi; \
|
|
||||||
result="$${result}$${comma}linux-headers-$$2$(version)-$(abiname)-$$flavour"; \
|
|
||||||
done; \
|
|
||||||
echo $$result; \
|
|
||||||
}; \
|
|
||||||
all_headers_pkgs=`get_all_headers_pkgs`; \
|
|
||||||
substitute() { \
|
|
||||||
sa_tmp="debian/arch/$$2/*/config.$$3"; \
|
|
||||||
sa=""; \
|
|
||||||
[ -f $$sa_tmp ] && sa=$$(basename $$(dirname $$sa_tmp))-; \
|
|
||||||
all_headers_pkgs=`get_all_headers_pkgs $$2 $$sa`; \
|
|
||||||
class="$$3-class"; \
|
|
||||||
longclass=""; \
|
|
||||||
desc=""; \
|
|
||||||
[ -f "debian/arch/$$2/$$sa/desc.$$3" ] && . "debian/arch/$$2/$$sa/desc.$$3"; \
|
|
||||||
[ -z "$$longclass" ] && longclass="$$class"; \
|
|
||||||
cat debian/templates/control.$$1 | \
|
|
||||||
sed -e 's/@version@/$(version)/g' \
|
|
||||||
-e 's/@major@/$(major)/g' \
|
|
||||||
-e "s/@arch@/$$2/g" \
|
|
||||||
-e "s/@subarch@/$$sa/g" \
|
|
||||||
-e "s/@flavour@/$$3/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' \
|
|
||||||
-e "s/@allheaders@/$$all_headers_pkgs/g" | \
|
|
||||||
sed '/^[[:space:]]*$$/d' | \
|
|
||||||
sed 's/^Package:/\n&/g'; \
|
|
||||||
[ -z "$$4" ] || printf "$$desc\n"; \
|
|
||||||
}; \
|
|
||||||
substitute source.in "" "" >> control.tmp; \
|
|
||||||
substitute main.in "" "" >> control.tmp; \
|
|
||||||
substitute headers.in "" "" >> control.tmp; \
|
|
||||||
for a in $(archs); do \
|
|
||||||
for f in $$(list_flavours $$a); do \
|
|
||||||
substitute headers.flavour.in $$a $$f >> control.tmp; \
|
|
||||||
substitute image.in $$a $$f "1" >> control.tmp; \
|
|
||||||
done; \
|
|
||||||
done
|
|
||||||
mv control.tmp debian/control
|
|
||||||
|
|
||||||
.PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source tree
|
.PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source tree
|
||||||
|
|
Loading…
Reference in New Issue