r3637 - in trunk/kernel/source/linux-2.6/debian: . bin

Jurij Smakov jurij-guest at costa.debian.org
Sun Jul 31 00:08:59 UTC 2005


Author: jurij-guest
Date: 2005-07-31 00:08:59 +0000 (Sun, 31 Jul 2005)
New Revision: 3637

Added:
   trunk/kernel/source/linux-2.6/debian/bin/gencontrol
Modified:
   trunk/kernel/source/linux-2.6/debian/rules
Log:
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.


Added: trunk/kernel/source/linux-2.6/debian/bin/gencontrol
===================================================================
--- trunk/kernel/source/linux-2.6/debian/bin/gencontrol	2005-07-29 21:04:50 UTC (rev 3636)
+++ trunk/kernel/source/linux-2.6/debian/bin/gencontrol	2005-07-31 00:08:59 UTC (rev 3637)
@@ -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


Property changes on: trunk/kernel/source/linux-2.6/debian/bin/gencontrol
___________________________________________________________________
Name: svn:executable
   + *

Modified: trunk/kernel/source/linux-2.6/debian/rules
===================================================================
--- trunk/kernel/source/linux-2.6/debian/rules	2005-07-29 21:04:50 UTC (rev 3636)
+++ trunk/kernel/source/linux-2.6/debian/rules	2005-07-31 00:08:59 UTC (rev 3637)
@@ -22,6 +22,7 @@
 lt_depends  += $(shell seq -f 'linux-source-$(version) (= $(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
 # subarch list as a list of subdirectories in arch/$(karch). We
@@ -231,66 +232,17 @@
 # Makes the master debian/control file by substituting
 # variable values into the template.
 #
-# I truly apologize for what I've created..  -dil
-#
-archs := $(shell find debian/arch/ -mindepth 1 -maxdepth 1 -type d ! -name '.svn' -printf '%f\n')
-debian/control: $(wildcard debian/templates/control.*.in)
-	rm -f control.tmp 2>/dev/null
-	list_flavours() {				\
-		find debian/arch/$$1/ -name 'config.*'	\
-			! -name '*.svn*' -printf '%f\n' |  \
-			sed 's/^config\.//';		\
-	};						\
-	get_all_headers_pkgs() {				\
-		result=""; \
-		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
-	
+debian/control: $(wildcard debian/templates/control.*.in) debian/makevars
+	debian/bin/gencontrol
+
+debian/makevars:
+	echo 'version='\''$(version)'\'          > debian/makevars
+	echo 'major='\''$(major)'\'             >> debian/makevars
+	echo 'srcver='\''$(srcver)'\'		>> debian/makevars
+	echo 'ltver='\''$(ltver)'\'             >> debian/makevars
+	echo 'lt_depends='\''$(srcver)'\'       >> debian/makevars
+	echo 'lt_depends='\''$(lt_depends)'\'   >> debian/makevars
+	echo 'lt_provides='\''$(lt_provides)'\' >> debian/makevars
+	echo 'abiname='\''$(abiname)'\'         >> debian/makevars
+
 .PHONY: clean build unpack binary-indep binary-arch binary patch unpatch source tree




More information about the Kernel-svn-changes mailing list