#4 Drop python2
Closed 4 years ago by plautrba. Opened 4 years ago by plautrba.
rpms/ plautrba/libsemanage master-drop-python2  into  master

@@ -0,0 +1,66 @@ 

+ From dc105dcb5e34e256bcbcf547fea590cfcee06933 Mon Sep 17 00:00:00 2001

+ From: Petr Lautrbach <plautrba@redhat.com>

+ Date: Wed, 7 Nov 2018 18:17:34 +0100

+ Subject: [PATCH] libsemanage: Fix RESOURCE_LEAK and USE_AFTER_FREE coverity

+  scan defects

+ 

+ ---

+  libsemanage/src/direct_api.c | 21 ++++++++-------------

+  1 file changed, 8 insertions(+), 13 deletions(-)

+ 

+ diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c

+ index c58961be..8e4d116d 100644

+ --- a/libsemanage/src/direct_api.c

+ +++ b/libsemanage/src/direct_api.c

+ @@ -1028,7 +1028,7 @@ static int semanage_direct_write_langext(semanage_handle_t *sh,

+  

+  	fp = NULL;

+  

+ -	ret = 0;

+ +	return 0;

+  

+  cleanup:

+  	if (fp != NULL) fclose(fp);

+ @@ -2177,7 +2177,6 @@ cleanup:

+  	semanage_module_info_destroy(sh, modinfo);

+  	free(modinfo);

+  

+ -	if (fp != NULL) fclose(fp);

+  	return status;

+  }

+  

+ @@ -2342,16 +2341,6 @@ static int semanage_direct_get_module_info(semanage_handle_t *sh,

+  	free(tmp);

+  	tmp = NULL;

+  

+ -	if (fclose(fp) != 0) {

+ -		ERR(sh,

+ -		    "Unable to close %s module lang ext file.",

+ -		    (*modinfo)->name);

+ -		status = -1;

+ -		goto cleanup;

+ -	}

+ -

+ -	fp = NULL;

+ -

+  	/* lookup enabled/disabled status */

+  	ret = semanage_module_get_path(sh,

+  				       *modinfo,

+ @@ -2395,7 +2384,13 @@ cleanup:

+  		free(modinfos);

+  	}

+  

+ -	if (fp != NULL) fclose(fp);

+ +	if (fp != NULL && fclose(fp) != 0) {

+ +		ERR(sh,

+ +		    "Unable to close %s module lang ext file.",

+ +		    (*modinfo)->name);

+ +		status = -1;

+ +	}

+ +

+  	return status;

+  }

+  

+ -- 

+ 2.23.0.rc1

+ 

file modified
+13 -36
@@ -4,14 +4,12 @@ 

  Summary: SELinux binary policy manipulation library 

  Name: libsemanage

  Version: 2.9

- Release: 2%{?dist}

+ Release: 3%{?dist}

  License: LGPLv2+

  Source0: https://github.com/SELinuxProject/selinux/releases/download/20190315/libsemanage-2.9.tar.gz

- # download https://raw.githubusercontent.com/fedora-selinux/scripts/master/selinux/make-fedora-selinux-patch.sh

- # run:

- # $ VERSION=2.9 ./make-fedora-selinux-patch.sh libsemanage

- # HEAD https://github.com/fedora-selinux/selinux/commit/431f72836d6c02450725cf6ffb1c7223b9fa6acc

- Patch1: libsemanage-fedora.patch

+ # fedora-selinux/selinux: git format-patch -N 20190315 -- libsemanage

+ # i=1; for j in 00*patch; do printf "Patch%04d: %s\n" $i $j; i=$((i+1));done

+ Patch0001: 0001-libsemanage-Fix-RESOURCE_LEAK-and-USE_AFTER_FREE-cov.patch

  URL: https://github.com/SELinuxProject/selinux/wiki

  Source1: semanage.conf

  
@@ -19,7 +17,7 @@ 

  BuildRequires: libselinux-devel >= %{libselinuxver} swig

  BuildRequires: libsepol-devel >= %{libsepolver} 

  BuildRequires: audit-libs-devel

- BuildRequires: python2 python2-devel bison flex bzip2-devel

+ BuildRequires: bison flex bzip2-devel

  

  BuildRequires: python3

  BuildRequires: python3-devel
@@ -59,19 +57,6 @@ 

  The semanage-devel package contains the libraries and header files

  needed for developing applications that manipulate binary policies. 

  

- %package -n python2-libsemanage

- %{?python_provide:%python_provide python2-libsemanage}

- # Remove before F30

- Provides: %{name}-python = %{version}-%{release}

- Provides: %{name}-python%{?_isa} = %{version}-%{release}

- Obsoletes: %{name}-python < %{version}-%{release}

- Summary: semanage python bindings for libsemanage

- Requires: %{name}%{?_isa} = %{version}-%{release}

- 

- %description -n python2-libsemanage

- The libsemanage-python package contains the python bindings for developing 

- SELinux management applications. 

- 

  %package -n python3-libsemanage

  Summary: semanage python 3 bindings for libsemanage

  Requires: %{name}%{?_isa} = %{version}-%{release}
@@ -87,11 +72,11 @@ 

  SELinux management applications.

  

  %prep

- %autosetup -n libsemanage-%{version} -p 1

+ %autosetup -n libsemanage-%{version} -p 2

  

  

  %build

- export LDFLAGS="%{?__global_ldflags}"

+ %set_build_flags

  

  # To support building the Python wrapper against multiple Python runtimes

  # Define a function, for how to perform a "build" of the python wrapper against
@@ -102,18 +87,15 @@ 

    # Perform the build from the upstream Makefile:

    make \

      PYTHON=$BinaryName \

-     CFLAGS="%{optflags}" LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" \

+     LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" \

      pywrap

  }

  

  make clean

- make CFLAGS="%{optflags}" swigify

- make CFLAGS="%{optflags}" LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" all

+ make swigify

+ make LIBDIR="%{_libdir}" SHLIBDIR="%{_lib}" all

  

  BuildPythonWrapper \

-   %{__python2}

-   

- BuildPythonWrapper \

    %{__python3}

  

  %install
@@ -133,10 +115,6 @@ 

  make DESTDIR="${RPM_BUILD_ROOT}" LIBDIR="%{_libdir}" SHLIBDIR="%{_libdir}" install

  

  InstallPythonWrapper \

-   %{__python2} \

-   .so

- 

- InstallPythonWrapper \

    %{__python3} \

    $(python3-config --extension-suffix)

    
@@ -169,10 +147,6 @@ 

  %{_includedir}/semanage/*.h

  %{_mandir}/man3/*

  

- %files -n python2-libsemanage

- %{python2_sitearch}/_semanage.so

- %{python2_sitearch}/semanage.py*

- 

  %files -n python3-libsemanage

  %{python3_sitearch}/*.so

  %{python3_sitearch}/semanage.py*
@@ -180,6 +154,9 @@ 

  %{_libexecdir}/selinux/semanage_migrate_store

  

  %changelog

+ * Tue Aug 13 2019 Petr Lautrbach <plautrba@redhat.com> - 2.9-3

+ - Drop python2-libsemanage (#1738466)

+ 

  * Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.9-2

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild