summaryrefslogtreecommitdiff
path: root/system/parted
diff options
context:
space:
mode:
Diffstat (limited to 'system/parted')
-rw-r--r--system/parted/APKBUILD60
-rw-r--r--system/parted/disable-two-tests.patch16
-rw-r--r--system/parted/fix-includes.patch10
-rw-r--r--system/parted/fix-libintl-header-s390x.patch58
-rw-r--r--system/parted/tests-call-name-correctly.patch42
-rw-r--r--system/parted/tests-python3.patch68
6 files changed, 254 insertions, 0 deletions
diff --git a/system/parted/APKBUILD b/system/parted/APKBUILD
new file mode 100644
index 000000000..0a4680a60
--- /dev/null
+++ b/system/parted/APKBUILD
@@ -0,0 +1,60 @@
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=parted
+pkgver=3.2
+pkgrel=7
+pkgdesc="Utility to create, destroy, resize, check and copy partitions"
+url="http://www.gnu.org/software/parted/parted.html"
+arch="all"
+license="GPL3"
+subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
+depends=
+makedepends="readline-dev ncurses-dev lvm2-dev bash util-linux-dev gettext-dev autoconf automake"
+checkdepends="check-dev python3"
+options="!checkroot"
+source="ftp://ftp.gnu.org/pub/gnu/$pkgname/$pkgname-$pkgver.tar.xz
+ disable-two-tests.patch
+ fix-includes.patch
+ fix-libintl-header-s390x.patch
+ tests-call-name-correctly.patch
+ tests-python3.patch
+ "
+
+builddir="$srcdir"/$pkgname-$pkgver
+
+prepare() {
+ cd "$builddir"
+ default_prepare
+ autoreconf
+}
+
+build() {
+ cd "$builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --disable-debug \
+ --disable-static \
+ --enable-shared \
+ --enable-device-mapper \
+ --with-readline
+ make
+}
+
+check() {
+ cd "$builddir"
+ make check
+}
+
+package() {
+ cd "$builddir"
+ make DESTDIR="$pkgdir" install
+ rm -rf "$pkgdir"/usr/lib/charset.alias
+ rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
+}
+sha512sums="4e37dbdd6f5032c9ebfec43704f6882379597d038167b9c4d04053efa083c68a705196713864451fa9e11d32777e16c68982877945c5efd9ea5f8252cb20e1c4 parted-3.2.tar.xz
+b49eb0211c405a4ef69e1bb0079621c22fec4adf0309f0a58b5d881540913de01d05ccd3eb521f35c3cf6f4eb8aa0f4c5270ce3dea47270a5c3fe8fae635c6f0 disable-two-tests.patch
+55ee63c218d1867c0f2c596e7c3eec5c42af160181456cc551fe3d432eabed0ac2dd3a3955ff0c375f76aeec8071e7f55a32834b87a0d39b8ef30361f671bfdd fix-includes.patch
+444a7e2fb3235dfd218f6b71fb25adde107d001f638d988ee1fa79686d8efee94a9499e27bdfdd75f9718760b448938b70a90a74285b93a39338d21f4ab4c9dc fix-libintl-header-s390x.patch
+8bd86d2b0401566e7757c43d849b7f913cc4ec1bf50d5641dc72d7e278ca38db2ac746cd8dcc756b245021ea1f9738875b6a831f05185b9217d3f1c287944748 tests-call-name-correctly.patch
+7486f98d535380a9e6598b9ac6153564319d5effa25456dc393cf3540ea47ac5b462be79cbd7d8efbd1fc2d2ef240a00873a2e2b138d4b4b0bb1494893de1eac tests-python3.patch"
diff --git a/system/parted/disable-two-tests.patch b/system/parted/disable-two-tests.patch
new file mode 100644
index 000000000..a6481dde3
--- /dev/null
+++ b/system/parted/disable-two-tests.patch
@@ -0,0 +1,16 @@
+These tests do not appear to work right upstream. Disable for now.
+
+--- parted-3.2/tests/Makefile.am.old 2014-06-15 19:15:54.000000000 +0000
++++ parted-3.2/tests/Makefile.am 2017-08-19 19:44:28.886245388 +0000
+@@ -24,11 +24,9 @@
+ t0209-gpt-pmbr_boot.sh \
+ t0210-gpt-resized-partition-entry-array.sh \
+ t0211-gpt-rewrite-header.sh \
+- t0212-gpt-many-partitions.sh \
+ t0220-gpt-msftres.sh \
+ t0250-gpt.sh \
+ t0251-gpt-unicode.sh \
+- t0280-gpt-corrupt.sh \
+ t0281-gpt-grow.sh \
+ t0282-gpt-move-backup.sh \
+ t0283-overlap-partitions.sh \
diff --git a/system/parted/fix-includes.patch b/system/parted/fix-includes.patch
new file mode 100644
index 000000000..c6eff0eb2
--- /dev/null
+++ b/system/parted/fix-includes.patch
@@ -0,0 +1,10 @@
+--- parted-3.1.orig/libparted/fs/xfs/platform_defs.h
++++ parted-3.1/libparted/fs/xfs/platform_defs.h
+@@ -35,6 +35,7 @@
+ #define __XFS_PLATFORM_DEFS_H__
+
+ #include <stdio.h>
++#include <fcntl.h>
+ #include <stdarg.h>
+ #include <assert.h>
+ #include <endian.h>
diff --git a/system/parted/fix-libintl-header-s390x.patch b/system/parted/fix-libintl-header-s390x.patch
new file mode 100644
index 000000000..68ae7d270
--- /dev/null
+++ b/system/parted/fix-libintl-header-s390x.patch
@@ -0,0 +1,58 @@
+From 4b2a566a3e007184d3ee9ce5b399a63eebbdadc3 Mon Sep 17 00:00:00 2001
+From: "Tuan M. Hoang" <tmhoang@flatglobe.org>
+Date: Thu, 23 Feb 2017 07:53:02 +0000
+Subject: [PATCH] main/parted: disable nls on s390x
+
+Because we build with --disable-nls by default, we need to remove libintl.h in
+these files on s390x. This is specific for DASD devices only on s390x.
+---
+ libparted/labels/dasd.c | 2 +-
+ libparted/labels/fdasd.c | 2 +-
+ libparted/labels/vtoc.c | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c
+index fa9414f..5acf844 100644
+--- a/libparted/labels/dasd.c
++++ b/libparted/labels/dasd.c
+@@ -40,8 +40,8 @@
+ #include <parted/fdasd.h>
+ #include <arch/linux.h>
+
+-#include <libintl.h>
+ #if ENABLE_NLS
++# include <libintl.h>
+ # define _(String) dgettext (PACKAGE, String)
+ #else
+ # define _(String) (String)
+diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
+index 1f87937..e6a9086 100644
+--- a/libparted/labels/fdasd.c
++++ b/libparted/labels/fdasd.c
+@@ -24,8 +24,8 @@
+
+ #include <parted/parted.h>
+
+-#include <libintl.h>
+ #if ENABLE_NLS
++# include <libintl.h>
+ # define _(String) dgettext (PACKAGE, String)
+ #else
+ # define _(String) (String)
+diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c
+index fdfa94f..64ba149 100644
+--- a/libparted/labels/vtoc.c
++++ b/libparted/labels/vtoc.c
+@@ -12,8 +12,8 @@
+
+ #include <parted/parted.h>
+
+-#include <libintl.h>
+ #if ENABLE_NLS
++# include <libintl.h>
+ # define _(String) dgettext (PACKAGE, String)
+ #else
+ # define _(String) (String)
+--
+2.11.1
+
diff --git a/system/parted/tests-call-name-correctly.patch b/system/parted/tests-call-name-correctly.patch
new file mode 100644
index 000000000..27a6287e8
--- /dev/null
+++ b/system/parted/tests-call-name-correctly.patch
@@ -0,0 +1,42 @@
+mkpart syntax recently changed, tests do not reflect that.
+
+--- parted-3.2/tests/t5000-tags.sh.old 2014-06-15 18:17:43.000000000 +0000
++++ parted-3.2/tests/t5000-tags.sh 2017-08-19 18:55:03.207451920 +0000
+@@ -48,7 +48,7 @@
+ compare exp out || fail=1
+
+ # add a partition
+-parted -s $dev u s mkpart name1 ${start_sector} ${end_sector} >out 2>&1 \
++parted -s $dev u s mkpart primary ${start_sector} ${end_sector} name 1 name1 >out 2>&1 \
+ || fail=1
+
+ # print the table before modification
+--- parted-3.2/tests/t0208-mkpart-end-in-IEC.sh.old 2014-06-15 18:17:43.000000000 +0000
++++ parted-3.2/tests/t0208-mkpart-end-in-IEC.sh 2017-08-19 20:05:19.650875813 +0000
+@@ -25,22 +25,22 @@
+
+ dd if=/dev/null of=$dev bs=1M seek=$n_mbs || fail=1
+ # create 1st partition
+-parted --align=none -s $dev mklabel gpt mkpart p1 1MiB 2MiB > err 2>&1 || fail=1
++parted --align=none -s $dev mklabel gpt mkpart primary 1MiB 2MiB name 1 p1 > err 2>&1 || fail=1
+ compare /dev/null err || fail=1 # expect no output
+ #parted -m -s $dev u s p > exp || fail=1
+
+ # create 2nd partition - they should not overlap
+ # this time specify default unit
+-parted --align=none -s $dev unit MiB mkpart p2 2 3 > err 2>&1 || fail=1
++parted --align=none -s $dev unit MiB mkpart primary 2 3 name 2 p2 > err 2>&1 || fail=1
+ compare /dev/null err || fail=1 # expect no output
+
+ # create 3rd partition - expect no overlap
+ # specify default unit, but explicitly override it
+-parted --align=none -s $dev unit TB mkpart p3 3MiB 4MiB > err 2>&1 || fail=1
++parted --align=none -s $dev unit TB mkpart primary 3MiB 4MiB name 3 p3 > err 2>&1 || fail=1
+ compare /dev/null err || fail=1 # expect no output
+
+ # Specify default unit of MiB, yet use explicit ending sector number.
+-parted --align=none -s $dev unit MiB mkpart p4 4MiB 10239s > err 2>&1 || fail=1
++parted --align=none -s $dev unit MiB mkpart primary 4MiB 10239s name 4 p4 > err 2>&1 || fail=1
+ compare /dev/null err || fail=1 # expect no output
+
+ # check boundaries of the partitions
diff --git a/system/parted/tests-python3.patch b/system/parted/tests-python3.patch
new file mode 100644
index 000000000..8811b7237
--- /dev/null
+++ b/system/parted/tests-python3.patch
@@ -0,0 +1,68 @@
+--- parted-3.2/tests/gpt-header-move.old 2014-06-15 18:27:30.000000000 +0000
++++ parted-3.2/tests/gpt-header-move 2017-08-19 20:47:02.443283140 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+
+ # open img file, subtract 33 from altlba address, and move the last 33 sectors
+ # back by 33 sectors
+@@ -11,12 +11,12 @@
+ file.seek(512)
+ gptheader = file.read(512)
+ altlba = unpack_from('<q', gptheader,offset=32)[0]
+-gptheader = array.array('c',gptheader)
++gptheader = array.array('B',gptheader)
+ pack_into('<Q', gptheader, 32, altlba-33)
+ #zero header crc
+ pack_into('<L', gptheader, 16, 0)
+ #compute new crc
+-newcrc = ((crc32(buffer(gptheader,0,92))) & 0xFFFFFFFF)
++newcrc = ((crc32(memoryview(gptheader[0:92]))) & 0xFFFFFFFF)
+ pack_into('<L', gptheader, 16, newcrc)
+ file.seek(512)
+ file.write(gptheader)
+@@ -25,7 +25,7 @@
+ file.seek(512*(altlba-32))
+ backup = file.read(512*32)
+ altlba -= 33
+-gptheader = array.array('c',gptheader)
++gptheader = array.array('B',gptheader)
+ #update mylba
+ pack_into('<Q', gptheader, 24, altlba)
+ #update table lba
+@@ -33,7 +33,7 @@
+ #zero header crc
+ pack_into('<L', gptheader, 16, 0)
+ #compute new crc
+-newcrc = ((crc32(buffer(gptheader,0,92))) & 0xFFFFFFFF)
++newcrc = ((crc32(memoryview(gptheader[0:92]))) & 0xFFFFFFFF)
+ pack_into('<L', gptheader, 16, newcrc)
+ file.seek(512*(altlba-32))
+ file.write(backup)
+@@ -38,4 +38,4 @@
+ file.seek(512*(altlba-32))
+ file.write(backup)
+ file.write(gptheader)
+-file.write("\0" * (512 * 33))
++file.write(b"\0" * (512 * 33))
+--- parted-3.2/tests/msdos-overlap.old 2014-06-15 18:27:30.000000000 +0000
++++ parted-3.2/tests/msdos-overlap 2017-08-19 20:48:16.279847771 +0000
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/env python3
+ """
+ Write an overlapping partition to a msdos disk
+
+@@ -14,10 +14,10 @@
+ OFFSET = 0x1b8
+
+ if len(sys.argv) < 2:
+- print "%s: <image or device>"
++ print("%s: <image or device>")
+ sys.exit(1)
+
+-data = "".join(chr(c) for c in BAD_ENTRY)
++data = bytearray(BAD_ENTRY)
+ with open(sys.argv[1], "rb+") as f:
+ f.seek(OFFSET, 0)
+ f.write(data)