From cfa912e8e861d45a3e13d9ed412c288a33e626b8 Mon Sep 17 00:00:00 2001 From: Liwei Ge Date: Fri, 9 Oct 2020 16:15:27 +0800 Subject: [PATCH] Add missing header for gcc10 build this change has given better compatible with both gcc8 and gcc10 toolchain, should be maintained util upstream fixes Some C++ Standard Library headers have been changed to no longer include the header. As such, C++ programs that used components defined in or without explicitly including the right headers will no longer compile. Previously components such as std::runtime_error, std::string and std::allocator were implicitly defined after including unrelated headers such as and . Correct code should include the appropriate headers for the classes being used. this change has given better compatible with gcc10 toolchain, should be maintained util upstream fixes refer url: https://gcc.gnu.org/gcc-10/porting_to.html Signed-off-by: Liwei Ge Signed-off-by: weitao zhou --- 1001-pyparted-gcc10.patch | 101 ++++++++++++++++++++++++++++++++++++++ pyparted.spec | 12 ++++- 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 1001-pyparted-gcc10.patch diff --git a/1001-pyparted-gcc10.patch b/1001-pyparted-gcc10.patch new file mode 100644 index 0000000..3cc25b6 --- /dev/null +++ b/1001-pyparted-gcc10.patch @@ -0,0 +1,101 @@ +From 104ca13567c08c1188b126a395c4602841aae2c6 Mon Sep 17 00:00:00 2001 +From: David Cantrell +Date: Tue, 11 Feb 2020 11:24:08 -0500 +Subject: [PATCH] Move exception declarations to _pedmodule.c + +Change the definitions in exceptions.h to extern declarations. This +is correct and what I was doing was just lazy. gcc 10 defaults to +-fno-common now. +--- + include/exceptions.h | 32 ++++++++++++++++---------------- + src/_pedmodule.c | 20 +++++++++++++++++++- + 2 files changed, 35 insertions(+), 17 deletions(-) + +diff --git a/include/exceptions.h b/include/exceptions.h +index 2a3e1f5..b548214 100644 +--- a/include/exceptions.h ++++ b/include/exceptions.h +@@ -1,7 +1,7 @@ + /* + * exceptions.h + * +- * Copyright (C) 2007-2013 Red Hat, Inc. ++ * Copyright (C) 2007-2020 Red Hat, Inc. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions of +@@ -27,21 +27,21 @@ + #include + + /* custom exceptions for _ped */ +-PyObject *AlignmentException; +-PyObject *CreateException; +-PyObject *ConstraintException; +-PyObject *DeviceException; +-PyObject *DiskException; +-PyObject *DiskLabelException; +-PyObject *FileSystemException; +-PyObject *GeometryException; +-PyObject *IOException; +-PyObject *NotNeededException; +-PyObject *PartedException; +-PyObject *PartitionException; +-PyObject *TimerException; +-PyObject *UnknownDeviceException; +-PyObject *UnknownTypeException; ++extern PyObject *AlignmentException; ++extern PyObject *CreateException; ++extern PyObject *ConstraintException; ++extern PyObject *DeviceException; ++extern PyObject *DiskException; ++extern PyObject *DiskLabelException; ++extern PyObject *FileSystemException; ++extern PyObject *GeometryException; ++extern PyObject *IOException; ++extern PyObject *NotNeededException; ++extern PyObject *PartedException; ++extern PyObject *PartitionException; ++extern PyObject *TimerException; ++extern PyObject *UnknownDeviceException; ++extern PyObject *UnknownTypeException; + + extern unsigned int partedExnRaised; + extern char *partedExnMessage; +diff --git a/src/_pedmodule.c b/src/_pedmodule.c +index 3e98788..6c26747 100644 +--- a/src/_pedmodule.c ++++ b/src/_pedmodule.c +@@ -5,7 +5,7 @@ + * Python module that implements the libparted functionality via Python + * classes and other high level language features. + * +- * Copyright (C) 2007-2015 Red Hat, Inc. ++ * Copyright (C) 2007-2020 Red Hat, Inc. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions of +@@ -59,6 +59,24 @@ unsigned int partedExnRaised = 0; + + PyObject *exn_handler = NULL; + ++/* custom exceptions for _ped */ ++/* These are declared in exceptions.h for use elsewhere. */ ++PyObject *AlignmentException; ++PyObject *CreateException; ++PyObject *ConstraintException; ++PyObject *DeviceException; ++PyObject *DiskException; ++PyObject *DiskLabelException; ++PyObject *FileSystemException; ++PyObject *GeometryException; ++PyObject *IOException; ++PyObject *NotNeededException; ++PyObject *PartedException; ++PyObject *PartitionException; ++PyObject *TimerException; ++PyObject *UnknownDeviceException; ++PyObject *UnknownTypeException; ++ + /* Docs strings are broken out of the module structure here to be at least a + * little bit readable. + */ diff --git a/pyparted.spec b/pyparted.spec index 78fc081..02ebd98 100644 --- a/pyparted.spec +++ b/pyparted.spec @@ -1,3 +1,4 @@ +%define anolis_release .0.1 %if 0%{?rhel} %if %{rhel} <= 7 # disable python3 by default @@ -36,7 +37,7 @@ Summary: Python module for GNU parted Name: pyparted Epoch: 1 Version: 3.11.7 -Release: 4%{?dist} +Release: 4%{anolis_release}%{?dist} License: GPLv2+ Group: System Environment/Libraries URL: https://github.com/rhinstaller/pyparted @@ -45,6 +46,11 @@ Source0: https://github.com/rhinstaller/pyparted/archive/%{name}-%{version}.tar. Patch0: pyparted-3.11.7-covscan.patch +# Begin: Anolis customized patches +# backport patch from upstream +Patch1001: 1001-pyparted-gcc10.patch +# End: Anolis customized patches + BuildRequires: gcc BuildRequires: parted-devel >= 3.2-18 BuildRequires: pkgconfig @@ -94,6 +100,7 @@ partition tables. This package provides Python 3 bindings for parted. %prep %setup -q %patch0 -p1 +%patch1001 -p1 %if %{with python2} rm -rf ../%{py2dir} @@ -152,6 +159,9 @@ popd %endif %changelog +* Thu Jan 20 2022 Weitao Zhou - 1:3.11.7-4.0.1 +- add missing header for compatible gcc10 build + * Mon Jul 12 2021 David Cantrell - 1:3.11.7-4 - Rebuild for gating Related: rhbz#1927379 -- Gitee