public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCHv4 3/9] meta: move debianization code into a class and into dpkg-base
Date: Thu, 31 Jan 2019 17:42:38 +0100	[thread overview]
Message-ID: <20190131164244.9169-4-henning.schild@siemens.com> (raw)
In-Reply-To: <20190131164244.9169-1-henning.schild@siemens.com>

From: Henning Schild <henning.schild@siemens.com>

This is pure restructuring. Move the code into its own class and include
that in dpkg-base, it was available only in dpkg-raw before.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/debianize.bbclass | 87 ++++++++++++++++++++++++++++++++++
 meta/classes/dpkg-base.bbclass |  1 +
 meta/classes/dpkg-raw.bbclass  | 87 ++--------------------------------
 3 files changed, 91 insertions(+), 84 deletions(-)
 create mode 100644 meta/classes/debianize.bbclass

diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
new file mode 100644
index 0000000..c1a2f18
--- /dev/null
+++ b/meta/classes/debianize.bbclass
@@ -0,0 +1,87 @@
+# This software is a part of ISAR.
+# Copyright (C) 2017-2019 Siemens AG
+#
+# SPDX-License-Identifier: MIT
+
+deb_add_changelog() {
+	date=$( LANG=C date -R )
+	cat <<EOF > ${S}/debian/changelog
+${PN} (${PV}) UNRELEASED; urgency=low
+
+  * generated by Isar
+
+ -- ${MAINTAINER}  ${date}
+EOF
+	if [ -f ${WORKDIR}/changelog ]; then
+		echo >> ${S}/debian/changelog
+		cat ${WORKDIR}/changelog >> ${S}/debian/changelog
+	fi
+}
+
+deb_create_compat() {
+	echo 9 > ${S}/debian/compat
+}
+
+deb_create_control() {
+	compat=$( cat ${S}/debian/compat )
+	cat << EOF > ${S}/debian/control
+Source: ${PN}
+Section: misc
+Priority: optional
+Standards-Version: 3.9.6
+Maintainer: ${MAINTAINER}
+Build-Depends: debhelper (>= ${compat})
+
+Package: ${PN}
+Architecture: any
+Depends: ${DEBIAN_DEPENDS}
+Description: ${DESCRIPTION}
+EOF
+}
+
+DH_FIXPERM_EXCLUSIONS = \
+    "${@' '.join(['-X ' + x for x in \
+                  (d.getVar('PRESERVE_PERMS', False) or '').split()])}"
+
+deb_create_rules() {
+	cat << EOF > ${S}/debian/rules
+#!/usr/bin/make -f
+
+override_dh_fixperms:
+	dh_fixperms ${DH_FIXPERM_EXCLUSIONS}
+
+%:
+	dh \$@
+EOF
+	chmod +x ${S}/debian/rules
+}
+
+deb_debianize() {
+	if [ -f ${WORKDIR}/compat ]; then
+		install -v -m 644 ${WORKDIR}/compat ${S}/debian/compat
+	else
+		deb_create_compat
+	fi
+	if [ -f ${WORKDIR}/control ]; then
+		install -v -m 644 ${WORKDIR}/control ${S}/debian/control
+	else
+		deb_create_control
+	fi
+	if [ -f ${WORKDIR}/rules ]; then
+		install -v -m 755 ${WORKDIR}/rules ${S}/debian/rules
+	else
+		deb_create_rules
+	fi
+	deb_add_changelog
+
+	for t in pre post
+	do
+		for a in inst rm
+		do
+			if [ -f ${WORKDIR}/${t}${a} ]; then
+				install -v -m 755 ${WORKDIR}/${t}${a} \
+					${S}/debian/${t}${a}
+			fi
+		done
+	done
+}
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 2f324f9..175dc80 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier: MIT
 
 inherit buildchroot
+inherit debianize
 
 DEPENDS ?= ""
 
diff --git a/meta/classes/dpkg-raw.bbclass b/meta/classes/dpkg-raw.bbclass
index a9143e9..ea03ea4 100644
--- a/meta/classes/dpkg-raw.bbclass
+++ b/meta/classes/dpkg-raw.bbclass
@@ -1,5 +1,7 @@
 # This software is a part of ISAR.
-# Copyright (C) 2017-2018 Siemens AG
+# Copyright (C) 2017-2019 Siemens AG
+#
+# SPDX-License-Identifier: MIT
 
 inherit dpkg
 
@@ -17,89 +19,6 @@ do_install[cleandirs] = "${D}"
 do_install[stamp-extra-info] = "${DISTRO}-${DISTRO_ARCH}"
 addtask install after do_unpack before do_prepare_build
 
-deb_add_changelog() {
-	date=$( LANG=C date -R )
-	cat <<EOF > ${D}/debian/changelog
-${PN} (${PV}) UNRELEASED; urgency=low
-
-  * generated by Isar
-
- -- ${MAINTAINER}  ${date}
-EOF
-	if [ -f ${WORKDIR}/changelog ]; then
-		echo >> ${D}/debian/changelog
-		cat ${WORKDIR}/changelog >> ${D}/debian/changelog
-	fi
-}
-
-deb_create_compat() {
-	echo 9 > ${D}/debian/compat
-}
-
-deb_create_control() {
-	compat=$( cat ${D}/debian/compat )
-	cat << EOF > ${D}/debian/control
-Source: ${PN}
-Section: misc
-Priority: optional
-Standards-Version: 3.9.6
-Maintainer: ${MAINTAINER}
-Build-Depends: debhelper (>= ${compat})
-
-Package: ${PN}
-Architecture: any
-Depends: ${DEBIAN_DEPENDS}
-Description: ${DESCRIPTION}
-EOF
-}
-
-DH_FIXPERM_EXCLUSIONS = \
-    "${@' '.join(['-X ' + x for x in \
-                  (d.getVar('PRESERVE_PERMS', False) or '').split()])}"
-
-deb_create_rules() {
-	cat << EOF > ${S}/debian/rules
-#!/usr/bin/make -f
-
-override_dh_fixperms:
-	dh_fixperms ${DH_FIXPERM_EXCLUSIONS}
-
-%:
-	dh \$@
-EOF
-	chmod +x ${S}/debian/rules
-}
-
-deb_debianize() {
-	if [ -f ${WORKDIR}/compat ]; then
-		install -v -m 644 ${WORKDIR}/compat ${D}/debian/compat
-	else
-		deb_create_compat
-	fi
-	if [ -f ${WORKDIR}/control ]; then
-		install -v -m 644 ${WORKDIR}/control ${D}/debian/control
-	else
-		deb_create_control
-	fi
-	if [ -f ${WORKDIR}/rules ]; then
-		install -v -m 755 ${WORKDIR}/rules ${D}/debian/rules
-	else
-		deb_create_rules
-	fi
-	deb_add_changelog
-
-	for t in pre post
-	do
-		for a in inst rm
-		do
-			if [ -f ${WORKDIR}/${t}${a} ]; then
-				install -v -m 755 ${WORKDIR}/${t}${a} \
-					${D}/debian/${t}${a}
-			fi
-		done
-	done
-}
-
 do_prepare_build[cleandirs] += "${D}/debian"
 do_prepare_build() {
 	cd ${D}
-- 
2.19.2


  parent reply	other threads:[~2019-01-31 16:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-31 16:42 [PATCHv4 0/9] apt-get source support Henning Schild
2019-01-31 16:42 ` [PATCHv4 1/9] conf: add deb-src entries to all our distro configs Henning Schild
2019-01-31 16:42 ` [PATCHv4 2/9] dpkg-base: introduce an "apt-get source" fetch/unpack step Henning Schild
2019-01-31 16:42 ` Henning Schild [this message]
2019-01-31 16:42 ` [PATCHv4 4/9] debianize: allow changlog version change Henning Schild
2019-01-31 16:42 ` [PATCHv4 5/9] meta-isar/recipes-app: add upstream hello rebuild example Henning Schild
2019-01-31 16:42 ` [PATCHv4 6/9] local.conf: enable rebuilding "hello" for all distros Henning Schild
2019-01-31 16:42 ` [PATCHv4 7/9] meta: change apt source fetcher to hook into SRC_URI Henning Schild
2019-01-31 16:42 ` [PATCHv4 8/9] doc: document "apt://" fetch/unpack feature Henning Schild
2019-01-31 16:42 ` [PATCHv4 9/9] ci: remove "hello" from the offline build, it fails Henning Schild
2019-02-04 17:33   ` Maxim Yu. Osipov
2019-02-04 17:37     ` Jan Kiszka
2019-02-05  9:49       ` Maxim Yu. Osipov
2019-02-05 18:18         ` Henning Schild
2019-01-31 16:46 ` [PATCHv4 0/9] apt-get source support Henning Schild
2019-02-05 10:42 ` Maxim Yu. Osipov
2019-02-06  9:24   ` Henning Schild
2019-02-06  9:46     ` Maxim Yu. Osipov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190131164244.9169-4-henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox