Compare commits

...

No commits in common. "c9-beta" and "c8" have entirely different histories.
c9-beta ... c8

6 changed files with 256 additions and 114 deletions

3
.gitignore vendored
View File

@ -1,2 +1 @@
SOURCES/key.asc SOURCES/pyxattr-0.5.3.tar.gz
SOURCES/pyxattr-0.7.2.tar.gz

View File

@ -1,2 +1 @@
9a136d79c02f87a7bf7cbc5220b06f964699e03c SOURCES/key.asc b403951d3b987b0fa1203377fcab8165aaa29ac0 SOURCES/pyxattr-0.5.3.tar.gz
45be5c539112a57b56723892587bc11c680198d0 SOURCES/pyxattr-0.7.2.tar.gz

View File

@ -0,0 +1,127 @@
From 50f7c251523f6be3be3426aa6499e5495a18b442 Mon Sep 17 00:00:00 2001
From: Mark Hamzy <hamzy@us.ibm.com>
Date: Wed, 6 Aug 2014 14:06:45 -0500
Subject: [PATCH] use Py_ssize_t
>Starting with Python 2.5 the type of the length argument can be controlled by
>defining the macro PY_SSIZE_T_CLEAN before including Python.h. If the macro is
>defined, length is a Py_ssize_t rather than an int.
dmalcolm@redhat.com says:
"and IIRC that *does* in fact affect "et#" and the other hash-suffixed codes
i.e. PyArg_ParseTupleAndKeywords was expecting bufsize to be a Py_ssize_t, not an int."
So, changing size_t to Py_ssize_t and ints used as sizes to Py_ssize_t.
---
xattr.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/xattr.c b/xattr.c
index cc1fa44..2529e90 100644
--- a/xattr.c
+++ b/xattr.c
@@ -193,7 +193,7 @@ static int merge_ns(const char *ns, const char *name,
return 0;
}
-static ssize_t _list_obj(target_t *tgt, char *list, size_t size) {
+static Py_ssize_t _list_obj(target_t *tgt, char *list, Py_ssize_t size) {
if(tgt->type == T_FD)
return flistxattr(tgt->fd, list, size);
else if (tgt->type == T_LINK)
@@ -202,8 +202,8 @@ static ssize_t _list_obj(target_t *tgt, char *list, size_t size) {
return listxattr(tgt->name, list, size);
}
-static ssize_t _get_obj(target_t *tgt, const char *name, void *value,
- size_t size) {
+static Py_ssize_t _get_obj(target_t *tgt, const char *name, void *value,
+ Py_ssize_t size) {
if(tgt->type == T_FD)
return fgetxattr(tgt->fd, name, value, size);
else if (tgt->type == T_LINK)
@@ -213,7 +213,7 @@ static ssize_t _get_obj(target_t *tgt, const char *name, void *value,
}
static int _set_obj(target_t *tgt, const char *name,
- const void *value, size_t size, int flags) {
+ const void *value, Py_ssize_t size, int flags) {
if(tgt->type == T_FD)
return fsetxattr(tgt->fd, name, value, size, flags);
else if (tgt->type == T_LINK)
@@ -242,7 +242,7 @@ static int _remove_obj(target_t *tgt, const char *name) {
*/
const char *matches_ns(const char *ns, const char *name) {
- size_t ns_size;
+ Py_ssize_t ns_size;
if (ns == NULL || *ns == '\0')
return name;
ns_size = strlen(ns);
@@ -275,7 +275,7 @@ pygetxattr(PyObject *self, PyObject *args)
int nofollow = 0;
char *attrname = NULL;
char *buf;
- ssize_t nalloc, nret;
+ Py_ssize_t nalloc, nret;
PyObject *res;
/* Parse the arguments */
@@ -352,7 +352,7 @@ xattr_get(PyObject *self, PyObject *args, PyObject *keywds)
const char *fullname;
char *buf;
const char *ns = NULL;
- ssize_t nalloc, nret;
+ Py_ssize_t nalloc, nret;
PyObject *res;
static char *kwlist[] = {"item", "name", "nofollow", "namespace", NULL};
@@ -451,7 +451,7 @@ get_all(PyObject *self, PyObject *args, PyObject *keywds)
const char *ns = NULL;
char *buf_list, *buf_val;
const char *s;
- ssize_t nalloc, nlist, nval;
+ Py_ssize_t nalloc, nlist, nval;
PyObject *mylist;
target_t tgt;
static char *kwlist[] = {"item", "nofollow", "namespace", NULL};
@@ -604,7 +604,7 @@ pysetxattr(PyObject *self, PyObject *args)
int nofollow = 0;
char *attrname = NULL;
char *buf = NULL;
- int bufsize;
+ Py_ssize_t bufsize;
int nret;
int flags = 0;
target_t tgt;
@@ -670,7 +670,7 @@ xattr_set(PyObject *self, PyObject *args, PyObject *keywds)
int nofollow = 0;
char *attrname = NULL;
char *buf = NULL;
- int bufsize;
+ Py_ssize_t bufsize;
int nret;
int flags = 0;
target_t tgt;
@@ -856,7 +856,7 @@ pylistxattr(PyObject *self, PyObject *args)
{
char *buf;
int nofollow=0;
- ssize_t nalloc, nret;
+ Py_ssize_t nalloc, nret;
PyObject *myarg;
PyObject *mylist;
Py_ssize_t nattrs;
@@ -956,7 +956,7 @@ xattr_list(PyObject *self, PyObject *args, PyObject *keywds)
{
char *buf;
int nofollow = 0;
- ssize_t nalloc, nret;
+ Py_ssize_t nalloc, nret;
PyObject *myarg;
PyObject *res;
const char *ns = NULL;
--
2.0.0

View File

@ -0,0 +1,31 @@
From 3efd44125a6f64fba786d08254e9d1bb6f08abde Mon Sep 17 00:00:00 2001
From: Milind Changire <mchangir@redhat.com>
Date: Sat, 4 Aug 2018 17:51:25 +0530
Subject: [PATCH 2/2] add workaround for undefined ENOATTR
define ENOATTR as ENODATA
fixes bz#1610029
Signed-off-by: Milind Changire <mchangir@redhat.com>
---
xattr.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/xattr.c b/xattr.c
index 2529e90..ac248cd 100644
--- a/xattr.c
+++ b/xattr.c
@@ -97,6 +97,10 @@ typedef int Py_ssize_t;
multi-operations */
#define ESTIMATE_ATTR_SIZE 256
+#if !defined(ENOATTR)
+#define ENOATTR ENODATA
+#endif
+
typedef enum {T_FD, T_PATH, T_LINK} target_e;
typedef struct {
--
2.17.1

View File

@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEy5TjqjsXVdYeuxml9m4+QZ+E9N4FAl/D+d8ACgkQ9m4+QZ+E
9N6Hfg//amV/is8xZQb1tvXLRpTfPM4rWym4mRkufU5zMuEhO42ebHMetpTnbexY
HOPVSSIIiFSlqp1e4SOw8esQYjB6s28/4PXNK/wFUn6Meh6+YF7p7CTADb2goW25
CRxeLkens7Mso6GBrpmSR0AqZB7jMpXd4dmnCjRdR1NUNw3ui+yMnAMKD6zfQNzY
CIufV77EEe2uvJw33i6jHLnpd61bkN+V/r0BN9FA4i8uZMOHzGmtX4siEXDmwAJc
fLCJY2KmEAplDZl6RTgwiTFJJvRQDjhankz3pcUJk1oJa7HTCT4Uq0rOcYBtkNsv
u97GL5Mq9wsTv23v5/L3C1CbTIiAaEkmEexVgDledzr9KS24rzkxMo8D6mBzS1tx
y/hoUqbphsP/QVe8Yhbmy4x+E8dq5SlrPtpS+7xrr3AjLZJAk5l13yWcCEomNGva
alucUhWgylOSIVK9Z4TVxcZgeR/mDuDPBFxw8Cy+EkNpGbA1LVubLIdwo7+zx2r4
OM9TFu+4r9OQXzFOQhBmMbfUJfDO5wTuk3XuG8QlNH0mnOe8lL9fIHxTy+uQySbt
3t/8wAcIp499xwsWHkzZOgKEd9OSxZAzPdJjGsg+nwWlS5TQJQySHAHXup3vc+t0
8X4X76nX2CSqYoM5+3VAzn+YfBh3IQB3phVqrIltBM2otihgNdQ=
=Mm6V
-----END PGP SIGNATURE-----

View File

@ -1,118 +1,120 @@
%global with_python3 1
%if 0%{?rhel} > 7
# Disable python2 build by default
%global with_python2 0
%else
%global with_python2 1
%endif
Name: pyxattr Name: pyxattr
Summary: Extended attributes library wrapper for Python Summary: Extended attributes library wrapper for Python
Version: 0.7.2 Version: 0.5.3
Release: 4%{?dist} Release: 18%{?dist}
License: LGPLv2+ License: LGPLv2+
URL: https://pyxattr.k1024.org/ Group: Development/Libraries
Source0: %{URL}/downloads/%{name}-%{version}.tar.gz URL: http://pyxattr.k1024.org/
Source1: %{URL}/downloads/%{name}-%{version}.tar.gz.asc Source: https://pypi.python.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz
Source2: https://k1024.org/files/key.asc Patch0: 0001-use-Py_ssize_t.patch
Patch1: 0002-add-workaround-for-undefined-ENOATTR.patch
BuildRequires: gcc
BuildRequires: libattr-devel BuildRequires: libattr-devel
BuildRequires: python3-devel %if %{?with_python2}
BuildRequires: python3-setuptools BuildRequires: python2-devel, python2-setuptools
BuildRequires: gnupg2 %endif
BuildRequires: %{py3_dist pytest} %if %{?with_python3}
BuildRequires: python3-devel, python3-setuptools
%endif # with_python3
%global _description %{expand: %global _description\
Python extension module wrapper for libattr. It allows to query, list, Python extension module wrapper for libattr. It allows to query, list,\
add and remove extended attributes from files and directories.} add and remove extended attributes from files and directories.
%description %_description %description %_description
%package -n python3-%{name} %if %{?with_python2}
Summary: %{summary} %package -n python2-%{name}
%{?python_provide:%python_provide python3-%{name}} Summary: %summary
%{?python_provide:%python_provide python2-%{name}}
# Remove before F30
Provides: pyxattr = %{version}-%{release}
Provides: pyxattr%{?_isa} = %{version}-%{release}
Obsoletes: pyxattr < %{version}-%{release}
%description -n python3-%{name} %_description %description -n python2-%{name} %_description
%endif
%if %{?with_python3}
%package -n python3-%{name}
Summary: Extended attributes library wrapper for Python 3
%description -n python3-%{name}
Python extension module wrapper for libattr. It allows to query, list,
add and remove extended attributes from files and directories.
Python 3 version.
%endif # with_python3
%prep %prep
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %setup -q
%autosetup %patch0 -p1
%patch1 -p1
%build %build
%py3_build %if %{?with_python2}
CFLAGS="%{optflags}" %{__python2} setup.py build
%endif
%if 0%{?with_python3}
CFLAGS="%{optflags}" %{__python3} setup.py build
%endif # with_python3
%install %install
%py3_install %if %{?with_python2}
%{__python2} setup.py install --root="%{buildroot}" --prefix="%{_prefix}"
%endif
%if 0%{?with_python3}
%{__python3} setup.py install --root="%{buildroot}" --prefix="%{_prefix}"
%endif # with_python3
%check %check
# selinux in koji produces unexpected xattrs for tests # selinux in koji produces unexpected xattrs for tests
export TEST_IGNORE_XATTRS=security.selinux export TEST_IGNORE_XATTRS=security.selinux
# the module is just a C extension => need to add the installed destination to
# PYTHONPATH, otherwise it won't be found
export PYTHONPATH=%{buildroot}%{python3_sitearch}:$PYTHONPATH
python3 -m pytest tests
%files -n python3-%{name} %if %{?with_python2}
%{python3_sitearch}/xattr.cpython-%{python3_version_nodots}* %{__python2} setup.py test
%{python3_sitearch}/*egg-info %endif
%if 0%{?with_python3}
%{__python3} setup.py test
%endif # with_python3
%if %{?with_python2}
%files -n python2-%{name}
%defattr(0644,root,root,0755)
%{python2_sitearch}/xattr.so
%{python2_sitearch}/*egg-info
%{!?_licensedir:%global license %%doc}
%license COPYING %license COPYING
%doc NEWS README.md %doc NEWS README
%endif
%if %{?with_python3}
%files -n python3-%{name}
%defattr(0644,root,root,0755)
%{python3_sitearch}/xattr.cpython-??m*
%{python3_sitearch}/*egg-info
%{!?_licensedir:%global license %%doc}
%license COPYING
%doc NEWS README
%endif # with_python3
%changelog %changelog
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 0.7.2-4 * Sat Aug 04 2018 Milind Changire <mchangir@redhat.com> - 0.5.3-18
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags - fixes bz#1610029
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.7.2-3 * Tue Jun 26 2018 Lumír Balhar <lbalhar@redhat.com> - 0.5.3-17
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 - Python 2 subpackage disable by default
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Dec 1 2020 Dan Čermák <dan.cermak@cgc-instruments.com> - 0.7.2-1
- New upstream release 0.7.2
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jun 23 2020 Dan Čermák <dan.cermak@cgc-instruments.com> - 0.7.1-5
- BuildRequire python3-setuptools besides python3-devel
(see https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/GCPGM34ZGEOVUHSBGZTRYR5XKHTIJ3T7/)
* Fri May 22 2020 Miro Hrončok <mhroncok@redhat.com> - 0.7.1-4
- Rebuilt for Python 3.9
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Dec 03 2019 Marcin Zajaczkowski <mszpak ATT wp DOTT pl> - 0.7.1-2
- Backport RPM specification improvements from sister project pylibacl
* Tue Nov 26 2019 Dan Čermák <dan.cermak@cgc-instruments.com> - 0.7.1-1
- Update to 0.7.1
- Drop python2 subpackage
- Add gpg signature check
* Thu Aug 15 2019 Miro Hrončok <mhroncok@redhat.com> - 0.6.1-3
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sun Jul 14 2019 Dan Čermák <dan.cermak@cgc-instruments.com> - 0.6.1-1
- Bump version to 0.6.1
- Simplify spec file
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Tue Jul 24 2018 Marcin Zajaczkowski <mszpak ATT wp DOTT pl> - 0.5.6-2
- Backport patch from 0.6.1 to fix issues with missing ENOATTR in libatttr 2.4.48
in Fedora 28/29 (#1603242, related to #1601482) - 0.5.6-1 was broken also in F28
* Thu Jul 19 2018 Marcin Zajaczkowski <mszpak ATT wp DOTT pl> - 0.5.6-1
- Upgrade to 0.5.6 (transitional step before 0.6.x for Fedora <29)
- Drop Py_ssize_t patch applied upstream
- Update download URL
* Thu Jul 12 2018 Marcin Zajaczkowski <mszpak ATT wp DOTT pl> - 0.5.3-18
- Add gcc to BuildRequires - https://fedoraproject.org/wiki/Changes/Remove_GCC_from_BuildRoot
* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 0.5.3-17
- Rebuilt for Python 3.7
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.3-16 * Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.3-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild