diff mbox series

[precise/lts-trusty,v2,1/2] UBUNTU: Packaging: Introduce copy-files and local-mangle

Message ID 20190226145958.19872-2-cascardo@canonical.com
State New
Headers show
Series Split copy-files from update-from-*master | expand

Commit Message

Thadeu Lima de Souza Cascardo Feb. 26, 2019, 2:59 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1817734

Two new scripts are introduced in order to do some of the copying and mangling
of copies that update-from-*master does.

One of the changes on copy-files compared to update-from-*master is that the -c
option is given to rsync, so it compares checksums of files in order to decide
whether they are different and need an update. That's necessary because
sometimes files will have the same size and their modified time will be whithin
one second or the original file will be older because git checked it out
earlier.

The script is split in two so the copy-files may be shared between different
kernel tress and the very specific changes are done on the local-mangle file,
which is different between trees.

Also, in order to make the copy-files the same one for all trees, some of the
copies and updates are dependent on a local.conf file, which is present only on
those trees where it's needed. The contents of those files are not so easily
generated, so they are not part of update.conf.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 debian.trusty/etc/local.conf               |  2 +
 debian.trusty/scripts/helpers/copy-files   | 67 ++++++++++++++++++++++
 debian.trusty/scripts/helpers/local-mangle | 36 ++++++++++++
 3 files changed, 105 insertions(+)
 create mode 100644 debian.trusty/etc/local.conf
 create mode 100755 debian.trusty/scripts/helpers/copy-files
 create mode 100755 debian.trusty/scripts/helpers/local-mangle
diff mbox series

Patch

diff --git a/debian.trusty/etc/local.conf b/debian.trusty/etc/local.conf
new file mode 100644
index 000000000000..81ef3a7f79cf
--- /dev/null
+++ b/debian.trusty/etc/local.conf
@@ -0,0 +1,2 @@ 
+SKIP_RULES_D=1
+FOREIGN_ARCHES="x32 arm64 powerpc ppc64el"
diff --git a/debian.trusty/scripts/helpers/copy-files b/debian.trusty/scripts/helpers/copy-files
new file mode 100755
index 000000000000..0ce0afe84578
--- /dev/null
+++ b/debian.trusty/scripts/helpers/copy-files
@@ -0,0 +1,67 @@ 
+#!/bin/bash -eu
+
+if [ -f debian/debian.env ]; then
+	# shellcheck disable=SC1091
+	. debian/debian.env
+fi
+
+if [ ! -d "${DEBIAN}" ]; then
+	echo You must run this script from the top directory of this repository.
+	exit 1
+fi
+
+CONF="${DEBIAN}"/etc/update.conf
+if [ -f "${CONF}" ]; then
+	# shellcheck disable=SC1090
+	. "${CONF}"
+fi
+
+FOREIGN_ARCHES=""
+LOCAL_CONF="${DEBIAN}/etc/local.conf"
+if [ -f "${LOCAL_CONF}" ]; then
+	# shellcheck disable=SC1090
+	. "${LOCAL_CONF}"
+fi
+
+SKIP_RULES_D=${SKIP_RULES_D:-}
+
+#
+# Pick up any master branch changes to udeb modules or firmware.
+#
+rsync -avc --delete "${DEBIAN_MASTER}/d-i/" "${DEBIAN}/d-i"
+
+#
+# Update configs from master
+#
+rsync -avc --delete "${DEBIAN_MASTER}/config/" "${DEBIAN}/config"
+
+#
+# Update package and DTB settings from master.
+#
+if [ -z "${SKIP_RULES_D}" ] ; then
+	rsync -avc "${DEBIAN_MASTER}/rules.d/"*.mk "${DEBIAN}/rules.d/"
+fi
+
+# Remove the .mk files from the arch's that are not supported
+for i in ${FOREIGN_ARCHES}
+do
+	rm -f "${DEBIAN}/rules.d/${i}.mk"
+	git rm -f --ignore-unmatch "${DEBIAN}/rules.d/${i}.mk" || true
+done
+
+#
+# Update modprobe.d from master
+#
+# Some releases (trusty) don't have this directory, and rsync would fail
+# without this check.
+if [ -d "${DEBIAN}/modprobe.d/" ]; then
+	rsync -avc --delete "${DEBIAN_MASTER}/modprobe.d/" "${DEBIAN}/modprobe.d"
+fi
+
+cp -p "${DEBIAN_MASTER}/control.d/"*.inclusion-list "${DEBIAN}/control.d"
+
+cp -p "${DEBIAN_MASTER}/reconstruct" "${DEBIAN}/reconstruct"
+
+if [ -x "${DEBIAN}/scripts/helpers/local-mangle" ]; then
+	"./${DEBIAN}/scripts/helpers/local-mangle"
+fi
diff --git a/debian.trusty/scripts/helpers/local-mangle b/debian.trusty/scripts/helpers/local-mangle
new file mode 100755
index 000000000000..d9b9c80b1fda
--- /dev/null
+++ b/debian.trusty/scripts/helpers/local-mangle
@@ -0,0 +1,36 @@ 
+#!/bin/bash -eu
+
+# shellcheck disable=SC1091
+. debian/debian.env
+
+#
+# Make sure signed module enforcement stays off until user space is ready.
+#
+sed -i 's/CONFIG_EFI_SECURE_BOOT_SIG_ENFORCE=y/CONFIG_EFI_SECURE_BOOT_SIG_ENFORCE=n/' "${DEBIAN}/config/config.common.ubuntu"
+
+#
+# Build in these 2 modules for arm in order to avoid
+# a missing __aeabi_uldivmod symbol.
+#
+for i in CONFIG_MEGARAID_LEGACY CONFIG_MEGARAID_MAILBOX CONFIG_MEGARAID_MM CONFIG_MEGARAID_NEWGEN CONFIG_MEGARAID_SAS
+do
+	echo "$i=n" >> "${DEBIAN}/config/armhf/config.common.armhf"
+done
+# Drop lowlatency
+sed -i 's/lowlatency//g' "${DEBIAN}/rules.d/"*.mk
+# shellcheck disable=SC2043
+for i in lowlatency
+do
+	find "${DEBIAN}/config" | grep "$i" | xargs rm -f
+	find "${DEBIAN}/control.d" | grep "$i" | xargs rm -f
+done
+# Make sure CONFIG_SECURITY_APPARMOR_AA3_SEMANTICS=n
+sed -i 's/CONFIG_SECURITY_APPARMOR_AA3_SEMANTICS=y/CONFIG_SECURITY_APPARMOR_AA3_SEMANTICS=n/' "${DEBIAN}/config/config."* "${DEBIAN}/config/"*/config.*
+
+# Original update-from-trusty-master did not copy inclusion list files.
+# Now that the new script does, we should remove it, otherwise we start
+# generating linux-modules-extra package, which might break users of a very
+# stable distribution.
+rm -f "${DEBIAN}/control.d/"*.inclusion-list
+
+rm -f "${DEBIAN}/d-i/kernel-versions"