forked from mirrors/linux
		
	kbuild: deb-pkg: use dh_listpackages to know enabled packages
Use dh_listpackages to get a list of all binary packages. With this, debian/control lists which binary packages will be produced. Previously, ARCH=um listed linux-libc-dev in debian/control, but it was not generated because each of mkdebian and builddeb independently maintained the if-conditionals. Another motivation is to allow scripts/package/builddeb to get the package name (linux-image-*, etc.) dynamically from debian/control. This will also allow the BuildProfile to control the generation of the binary packages. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
		
							parent
							
								
									b611daae5e
								
							
						
					
					
						commit
						36862e14e3
					
				
					 2 changed files with 37 additions and 27 deletions
				
			
		|  | @ -160,7 +160,7 @@ install_linux_image_dbg () { | ||||||
| 	ln -s lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/vmlinux-${KERNELRELEASE} | 	ln -s lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/vmlinux-${KERNELRELEASE} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| deploy_kernel_headers () { | install_kernel_headers () { | ||||||
| 	pdir=$1 | 	pdir=$1 | ||||||
| 
 | 
 | ||||||
| 	rm -rf $pdir | 	rm -rf $pdir | ||||||
|  | @ -198,7 +198,7 @@ deploy_kernel_headers () { | ||||||
| 	ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build | 	ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| deploy_libc_headers () { | install_libc_headers () { | ||||||
| 	pdir=$1 | 	pdir=$1 | ||||||
| 
 | 
 | ||||||
| 	rm -rf $pdir | 	rm -rf $pdir | ||||||
|  | @ -213,33 +213,38 @@ deploy_libc_headers () { | ||||||
| 	mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/ | 	mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/ | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| version=$KERNELRELEASE |  | ||||||
| packagename=linux-image-$version |  | ||||||
| dbg_packagename=$packagename-dbg |  | ||||||
| 
 |  | ||||||
| if [ "$ARCH" = "um" ] ; then |  | ||||||
| 	packagename=user-mode-linux-$version |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| rm -f debian/files | rm -f debian/files | ||||||
| 
 | 
 | ||||||
| if [ "$ARCH" != "um" ]; then | packages_enabled=$(dh_listpackages) | ||||||
| 	if is_enabled CONFIG_MODULES; then |  | ||||||
| 		deploy_kernel_headers debian/linux-headers |  | ||||||
| 		create_package linux-headers-$version debian/linux-headers |  | ||||||
| 	fi |  | ||||||
| 
 | 
 | ||||||
| 	deploy_libc_headers debian/linux-libc-dev | for package in ${packages_enabled} | ||||||
| 	create_package linux-libc-dev debian/linux-libc-dev | do | ||||||
| fi | 	case ${package} in | ||||||
|  | 	*-dbg) | ||||||
|  | 		# This must be done after linux-image, that is, we expect the | ||||||
|  | 		# debug package appears after linux-image in debian/control. | ||||||
|  | 		install_linux_image_dbg debian/linux-image-dbg debian/linux-image;; | ||||||
|  | 	linux-image-*|user-mode-linux-*) | ||||||
|  | 		install_linux_image debian/linux-image ${package};; | ||||||
|  | 	linux-libc-dev) | ||||||
|  | 		install_libc_headers debian/linux-libc-dev;; | ||||||
|  | 	linux-headers-*) | ||||||
|  | 		install_kernel_headers debian/linux-headers;; | ||||||
|  | 	esac | ||||||
|  | done | ||||||
| 
 | 
 | ||||||
| install_linux_image debian/linux-image "$packagename" | for package in ${packages_enabled} | ||||||
| 
 | do | ||||||
| if is_enabled CONFIG_DEBUG_INFO; then | 	case ${package} in | ||||||
| 	install_linux_image_dbg debian/linux-image-dbg debian/linux-image | 	*-dbg) | ||||||
| 	create_package "$dbg_packagename" debian/linux-image-dbg | 		create_package ${package} debian/linux-image-dbg;; | ||||||
| fi | 	linux-image-*|user-mode-linux-*) | ||||||
| 
 | 		create_package ${package} debian/linux-image;; | ||||||
| create_package "$packagename" debian/linux-image | 	linux-libc-dev) | ||||||
|  | 		create_package ${package} debian/linux-libc-dev;; | ||||||
|  | 	linux-headers-*) | ||||||
|  | 		create_package ${package} debian/linux-headers;; | ||||||
|  | 	esac | ||||||
|  | done | ||||||
| 
 | 
 | ||||||
| exit 0 | exit 0 | ||||||
|  |  | ||||||
|  | @ -192,7 +192,7 @@ Section: kernel | ||||||
| Priority: optional | Priority: optional | ||||||
| Maintainer: $maintainer | Maintainer: $maintainer | ||||||
| Rules-Requires-Root: no | Rules-Requires-Root: no | ||||||
| Build-Depends: bc, rsync, kmod, cpio, bison, flex $extra_build_depends | Build-Depends: bc, debhelper, rsync, kmod, cpio, bison, flex $extra_build_depends | ||||||
| Homepage: https://www.kernel.org/ | Homepage: https://www.kernel.org/ | ||||||
| 
 | 
 | ||||||
| Package: $packagename-$version | Package: $packagename-$version | ||||||
|  | @ -200,6 +200,10 @@ Architecture: $debarch | ||||||
| Description: Linux kernel, version $version | Description: Linux kernel, version $version | ||||||
|  This package contains the Linux kernel, modules and corresponding other |  This package contains the Linux kernel, modules and corresponding other | ||||||
|  files, version: $version. |  files, version: $version. | ||||||
|  | EOF | ||||||
|  | 
 | ||||||
|  | if [ "${SRCARCH}" != um ]; then | ||||||
|  | cat <<EOF >> debian/control | ||||||
| 
 | 
 | ||||||
| Package: linux-libc-dev | Package: linux-libc-dev | ||||||
| Section: devel | Section: devel | ||||||
|  | @ -222,6 +226,7 @@ Description: Linux kernel headers for $version on $debarch | ||||||
|  This is useful for people who need to build external modules |  This is useful for people who need to build external modules | ||||||
| EOF | EOF | ||||||
| fi | fi | ||||||
|  | fi | ||||||
| 
 | 
 | ||||||
| if is_enabled CONFIG_DEBUG_INFO; then | if is_enabled CONFIG_DEBUG_INFO; then | ||||||
| cat <<EOF >> debian/control | cat <<EOF >> debian/control | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Masahiro Yamada
						Masahiro Yamada