From 0e7fef247acaf65fb254ff2af80ec23ea3287288 Mon Sep 17 00:00:00 2001 From: Takamasa Takenaka Date: Mon, 18 Oct 2021 10:18:11 -0300 Subject: [PATCH] Add debian package for parted - Copied 1 patch from CentOS. Another patch is already applied in 3.4. - Copied the resizepart.sh file from CentOS. - Suppress to apply debian/patches in debian source package because they are already applied. Test: - Create debian package for parted - Create ISO with parted package included Story: 2009101 Task: 43526 Signed-off-by: Takamasa Takenaka Change-Id: I9a2c0781c07a7e53e7a61800813dc634ed9d5beb --- debian_pkg_dirs | 1 + .../0001-suppress-debian-patch-in-tar.patch | 35 ++++++++++++ .../0002-install-resizepart.sh-script.patch | 46 ++++++++++++++++ filesystem/parted/debian/deb_patches/series | 2 + filesystem/parted/debian/meta_data.yaml | 9 +++ .../parted/debian/patches/0001-syscalls.patch | 55 +++++++++++++++++++ .../patches/0002-add-resizepart.sh.patch | 47 ++++++++++++++++ filesystem/parted/debian/patches/series | 2 + 8 files changed, 197 insertions(+) create mode 100644 filesystem/parted/debian/deb_patches/0001-suppress-debian-patch-in-tar.patch create mode 100644 filesystem/parted/debian/deb_patches/0002-install-resizepart.sh-script.patch create mode 100644 filesystem/parted/debian/deb_patches/series create mode 100644 filesystem/parted/debian/meta_data.yaml create mode 100644 filesystem/parted/debian/patches/0001-syscalls.patch create mode 100644 filesystem/parted/debian/patches/0002-add-resizepart.sh.patch create mode 100644 filesystem/parted/debian/patches/series diff --git a/debian_pkg_dirs b/debian_pkg_dirs index 464cd46e5..e04493a08 100644 --- a/debian_pkg_dirs +++ b/debian_pkg_dirs @@ -5,3 +5,4 @@ config/puppet-modules/puppet-rabbitmq-8.5.0 config/puppet-modules/puppet-staging storage-drivers/trident-installer config/puppet-5.5.22 +filesystem/parted diff --git a/filesystem/parted/debian/deb_patches/0001-suppress-debian-patch-in-tar.patch b/filesystem/parted/debian/deb_patches/0001-suppress-debian-patch-in-tar.patch new file mode 100644 index 000000000..c8a3934db --- /dev/null +++ b/filesystem/parted/debian/deb_patches/0001-suppress-debian-patch-in-tar.patch @@ -0,0 +1,35 @@ +From ec1370a0a0e16b02f75d0d6c99fd2af258098b00 Mon Sep 17 00:00:00 2001 +From: Takamasa Takenaka +Date: Tue, 5 Oct 2021 11:47:19 -0300 +Subject: [PATCH 1/2] suppress debian patch in tar + +Remove patch entries in series because parted 3.4 debian +source tar includes code with these patches applied. + +Signed-off-by: Takamasa Takenaka +--- + debian/patches/series | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/debian/patches/series b/debian/patches/series +index da8a1ac..e69de29 100644 +--- a/debian/patches/series ++++ b/debian/patches/series +@@ -1,14 +0,0 @@ +-doc-package.patch +-preserve-hidden-parts.patch +-kfreebsd-gnu.patch +-freebsd-ufs.patch +-zfs.patch +-freebsd-zvol.patch +-freebsd-geli.patch +-kfreebsd_lvm.patch +-hurd-partition-path.patch +-hurd-reread.patch +-gptsync.patch +-udevadm-settle.patch +-align-new-partitions-on-fresh-disks.patch +-probe-lvs-again.patch +-- +2.25.1 + diff --git a/filesystem/parted/debian/deb_patches/0002-install-resizepart.sh-script.patch b/filesystem/parted/debian/deb_patches/0002-install-resizepart.sh-script.patch new file mode 100644 index 000000000..90e741d7d --- /dev/null +++ b/filesystem/parted/debian/deb_patches/0002-install-resizepart.sh-script.patch @@ -0,0 +1,46 @@ +From 6077588e8e9a9d59ca4e9d133605b778760fca71 Mon Sep 17 00:00:00 2001 +From: Takamasa Takenaka +Date: Tue, 5 Oct 2021 11:52:18 -0300 +Subject: [PATCH 2/2] install resizepart.sh script + +- resizepart.sh is a script without needing to handle command + prompts interactively (clean copied from CentOS) +- Disable device-mapper for configure + +Signed-off-by: Takamasa Takenaka +--- + debian/parted.install | 1 + + debian/rules | 8 ++------ + 2 files changed, 3 insertions(+), 6 deletions(-) + +diff --git a/debian/parted.install b/debian/parted.install +index 88efc46..4c4dccb 100644 +--- a/debian/parted.install ++++ b/debian/parted.install +@@ -1,3 +1,4 @@ + sbin + usr/share/man/man8/parted.8 + usr/share/man/man8/partprobe.8 ++resizepart.sh usr/sbin +diff --git a/debian/rules b/debian/rules +index 590d032..f6ca9a0 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -15,12 +15,8 @@ export DEB_BUILD_MAINT_OPTIONS := hardening=+all + CONFFLAGS := --sbindir=/sbin --enable-mtrace --enable-shared + CONFFLAGS += --disable-gcc-warnings + +-# Enable device-mapper only on Linux +-ifeq (linux, $(DEB_HOST_ARCH_OS)) +- CONFFLAGS += --enable-device-mapper +-else +- CONFFLAGS += --disable-device-mapper +-endif ++# Disable device-mappaer ++CONFFLAGS += --disable-device-mapper + + # Everything above here is common to the deb and udeb builds. + CONFFLAGS_UDEB := $(CONFFLAGS) +-- +2.25.1 + diff --git a/filesystem/parted/debian/deb_patches/series b/filesystem/parted/debian/deb_patches/series new file mode 100644 index 000000000..f12d4002d --- /dev/null +++ b/filesystem/parted/debian/deb_patches/series @@ -0,0 +1,2 @@ +0001-suppress-debian-patch-in-tar.patch +0002-install-resizepart.sh-script.patch diff --git a/filesystem/parted/debian/meta_data.yaml b/filesystem/parted/debian/meta_data.yaml new file mode 100644 index 000000000..ae7577b70 --- /dev/null +++ b/filesystem/parted/debian/meta_data.yaml @@ -0,0 +1,9 @@ +debname: parted +debver: 3.4-1 +dl_path: + name: parted-3.4-1.tar.gz + url: https://salsa.debian.org/parted-team/parted/-/archive/debian/3.4-1/parted-debian-3.4-1.tar.gz + md5sum: c2666a4dd24907de44c56cc54b35c569 +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true diff --git a/filesystem/parted/debian/patches/0001-syscalls.patch b/filesystem/parted/debian/patches/0001-syscalls.patch new file mode 100644 index 000000000..16894d607 --- /dev/null +++ b/filesystem/parted/debian/patches/0001-syscalls.patch @@ -0,0 +1,55 @@ +From 0d22ac37ddcdacfd97e95563c7f6a51a1f50f5da Mon Sep 17 00:00:00 2001 +From: Takamasa Takenaka +Date: Tue, 5 Oct 2021 11:57:57 -0300 +Subject: [PATCH 1/2] syscalls + +Copy of syscalls.patch from CentOS. + +Signed-off-by: Takamasa Takenaka +--- + libparted/arch/linux.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 9bae57f..7b8b670 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -1798,12 +1798,14 @@ _device_close (PedDevice* dev) + + #if SIZEOF_OFF_T < 8 + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + static _syscall5(int,_llseek, + unsigned int, fd, + unsigned long, offset_high, + unsigned long, offset_low, + loff_t*, result, + unsigned int, origin) ++#endif + + loff_t + llseek (unsigned int fd, loff_t offset, unsigned int whence) +@@ -1811,11 +1813,20 @@ llseek (unsigned int fd, loff_t offset, unsigned int whence) + loff_t result; + int retval; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) + retval = _llseek(fd, + ((unsigned long long)offset) >> 32, + ((unsigned long long)offset) & 0xffffffff, + &result, + whence); ++#else ++ retval = syscall(__NR__llseek, fd, ++ ((unsigned long long)offset) >> 32, ++ ((unsigned long long)offset) & 0xffffffff, ++ &result, ++ whence); ++#endif ++ + return (retval==-1 ? (loff_t) retval : result); + } + +-- +2.25.1 + diff --git a/filesystem/parted/debian/patches/0002-add-resizepart.sh.patch b/filesystem/parted/debian/patches/0002-add-resizepart.sh.patch new file mode 100644 index 000000000..6ce7a41ee --- /dev/null +++ b/filesystem/parted/debian/patches/0002-add-resizepart.sh.patch @@ -0,0 +1,47 @@ +From 1af84a759edaf5029fd8531363538e7dee970d34 Mon Sep 17 00:00:00 2001 +From: Takamasa Takenaka +Date: Tue, 5 Oct 2021 12:00:52 -0300 +Subject: [PATCH 2/2] add resizepart.sh + +resizepart.sh is a script without needing to handle command +prompts interactively (clean copied from CentOS) + +Signed-off-by: Takamasa Takenaka +--- + resizepart.sh | 24 ++++++++++++++++++++++++ + 1 file changed, 24 insertions(+) + create mode 100644 resizepart.sh + +diff --git a/resizepart.sh b/resizepart.sh +new file mode 100644 +index 0000000..29be2a0 +--- /dev/null ++++ b/resizepart.sh +@@ -0,0 +1,24 @@ ++#!/bin/bash ++ ++################################################################################ ++# Copyright (c) 2015 Wind River Systems, Inc. ++# ++# SPDX-License-Identifier: Apache-2.0 ++# ++################################################################################ ++ ++DEVICE=$1 ++PARTITION=$2 ++SIZE=$(blockdev --getsize64 ${DEVICE}) ++SIZE_MB=$((SIZE / (1024*1024))) ++ ++## This is a workaround to allow cloud-init to invoke parted without needing to ++## handle command prompts interactively. Support for non-interactive parted ++## commands are not supported on mounted partitions. ++## ++/usr/sbin/parted ---pretend-input-tty ${DEVICE} resizepart ${PARTITION} << EOF ++yes ++${SIZE_MB} ++EOF ++ ++exit $? +-- +2.25.1 + diff --git a/filesystem/parted/debian/patches/series b/filesystem/parted/debian/patches/series new file mode 100644 index 000000000..081f0b98e --- /dev/null +++ b/filesystem/parted/debian/patches/series @@ -0,0 +1,2 @@ +0001-syscalls.patch +0002-add-resizepart.sh.patch