diff --git a/.gitignore b/.gitignore index e69de29..7fffbc2 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +/pyxdg-0.25.tar.gz +/pyxdg-0.26.tar.gz diff --git a/pyxdg-0.25-CVE-2014-1624.patch b/pyxdg-0.25-CVE-2014-1624.patch new file mode 100644 index 0000000..614af5f --- /dev/null +++ b/pyxdg-0.25-CVE-2014-1624.patch @@ -0,0 +1,48 @@ +diff -up pyxdg-0.25/xdg/BaseDirectory.py.CVE-2014-1624 pyxdg-0.25/xdg/BaseDirectory.py +--- pyxdg-0.25/xdg/BaseDirectory.py.CVE-2014-1624 2014-12-04 11:49:53.681654931 -0500 ++++ pyxdg-0.25/xdg/BaseDirectory.py 2014-12-04 11:52:45.831522703 -0500 +@@ -25,7 +25,7 @@ Typical usage: + Note: see the rox.Options module for a higher-level API for managing options. + """ + +-import os ++import os, stat + + _home = os.path.expanduser('~') + xdg_data_home = os.environ.get('XDG_DATA_HOME') or \ +@@ -131,15 +131,29 @@ def get_runtime_dir(strict=True): + + import getpass + fallback = '/tmp/pyxdg-runtime-dir-fallback-' + getpass.getuser() ++ create = False + try: +- os.mkdir(fallback, 0o700) ++ # This must be a real directory, not a symlink, so attackers can't ++ # point it elsewhere. So we use lstat to check it. ++ st = os.lstat(fallback) + except OSError as e: + import errno +- if e.errno == errno.EEXIST: +- # Already exists - set 700 permissions again. +- import stat +- os.chmod(fallback, stat.S_IRUSR|stat.S_IWUSR|stat.S_IXUSR) +- else: # pragma: no cover ++ if e.errno == errno.ENOENT: ++ create = True ++ else: + raise ++ else: ++ # The fallback must be a directory ++ if not stat.S_ISDIR(st.st_mode): ++ os.unlink(fallback) ++ create = True ++ # Must be owned by the user and not accessible by anyone else ++ elif (st.st_uid != os.getuid()) \ ++ or (st.st_mode & (stat.S_IRWXG | stat.S_IRWXO)): ++ os.rmdir(fallback) ++ create = True ++ ++ if create: ++ os.mkdir(fallback, 0o700) + + return fallback diff --git a/pyxdg-0.25-find-first-mimetype-match.patch b/pyxdg-0.25-find-first-mimetype-match.patch new file mode 100644 index 0000000..b46f5ec --- /dev/null +++ b/pyxdg-0.25-find-first-mimetype-match.patch @@ -0,0 +1,13 @@ +diff -up pyxdg-0.25/xdg/Mime.py.BAD pyxdg-0.25/xdg/Mime.py +--- pyxdg-0.25/xdg/Mime.py.BAD 2013-03-05 10:19:10.750845664 -0500 ++++ pyxdg-0.25/xdg/Mime.py 2013-03-05 10:19:14.771845520 -0500 +@@ -360,7 +360,8 @@ def _cache_database(): + if pattern.startswith('*.'): + rest = pattern[2:] + if not ('*' in rest or '[' in rest or '?' in rest): +- exts[rest] = mtype ++ if rest not in exts: ++ exts[rest] = mtype + continue + if '*' in pattern or '[' in pattern or '?' in pattern: + globs.append((pattern, mtype)) diff --git a/pyxdg-0.26-fix-OnlyShowIn.patch b/pyxdg-0.26-fix-OnlyShowIn.patch new file mode 100644 index 0000000..e731e34 --- /dev/null +++ b/pyxdg-0.26-fix-OnlyShowIn.patch @@ -0,0 +1,18 @@ +diff -up pyxdg-0.26/xdg/Menu.py.fixOnlyShowIn pyxdg-0.26/xdg/Menu.py +--- pyxdg-0.26/xdg/Menu.py.fixOnlyShowIn 2018-11-01 11:34:26.222123436 -0400 ++++ pyxdg-0.26/xdg/Menu.py 2018-11-01 11:36:39.459203908 -0400 +@@ -298,11 +298,11 @@ class Menu: + entry.Show = NO_EXEC + self.Visible -= 1 + elif xdg.Config.windowmanager: +- if (entry.DesktopEntry.OnlyShowIn != [] and ( +- xdg.Config.windowmanager not in entry.DesktopEntry.OnlyShowIn ++ if (entry.DesktopEntry.getOnlyShowIn() != [] and ( ++ xdg.Config.windowmanager not in entry.DesktopEntry.getOnlyShowIn() + ) + ) or ( +- xdg.Config.windowmanager in entry.DesktopEntry.NotShowIn ++ xdg.Config.windowmanager in entry.DesktopEntry.getNotShowIn() + ): + entry.Show = NOT_SHOW_IN + self.Visible -= 1 diff --git a/pyxdg-0.26-getType-fix.patch b/pyxdg-0.26-getType-fix.patch new file mode 100644 index 0000000..b9f963c --- /dev/null +++ b/pyxdg-0.26-getType-fix.patch @@ -0,0 +1,14 @@ +diff -up pyxdg-0.26/xdg/Menu.py.getTypefix pyxdg-0.26/xdg/Menu.py +--- pyxdg-0.26/xdg/Menu.py.getTypefix 2018-11-01 11:37:50.561645188 -0400 ++++ pyxdg-0.26/xdg/Menu.py 2018-11-30 11:33:10.728729275 -0500 +@@ -994,8 +994,8 @@ class XMLMenuBuilder(object): + menuentry = MenuEntry(directory, dir) + if not menu.Directory: + menu.Directory = menuentry +- elif menuentry.Type == MenuEntry.TYPE_SYSTEM: +- if menu.Directory.Type == MenuEntry.TYPE_USER: ++ elif menuentry.getType() == MenuEntry.TYPE_SYSTEM: ++ if menu.Directory.getType() == MenuEntry.TYPE_USER: + menu.Directory.Original = menuentry + if menu.Directory: + break diff --git a/pyxdg.spec b/pyxdg.spec new file mode 100644 index 0000000..0cf4003 --- /dev/null +++ b/pyxdg.spec @@ -0,0 +1,235 @@ +%bcond_without tests + +Name: pyxdg +Version: 0.26 +Release: 11%{?dist} +Summary: Python library to access freedesktop.org standards +License: LGPLv2 +URL: http://freedesktop.org/Software/pyxdg +Source0: https://pypi.python.org/packages/source/r/PyXDG/%{name}-%{version}.tar.gz +# https://gitlab.freedesktop.org/xdg/pyxdg/merge_requests/2 +Patch0: pyxdg-0.26-fix-OnlyShowIn.patch +Patch1: pyxdg-0.26-getType-fix.patch +BuildArch: noarch +# These are needed for the nose tests. +BuildRequires: hicolor-icon-theme +BuildRequires: shared-mime-info + +%description +PyXDG is a python library to access freedesktop.org standards + +%package -n python%{python3_pkgversion}-pyxdg +Summary: Python3 library to access freedesktop.org standards +BuildRequires: python%{python3_pkgversion}-devel +%if %{with check} +# These are needed for the nose tests. +BuildRequires: python%{python3_pkgversion}-nose +%endif +%{?python_provide:%python_provide python%{python3_pkgversion}-pyxdg} + +%description -n python%{python3_pkgversion}-pyxdg +PyXDG is a python library to access freedesktop.org standards. This +package contains a Python 3 version of PyXDG. + +%prep +%setup -q +%patch0 -p1 -b .fixOnlyShowIn +%patch1 -p1 -b .getType + +%build +%py3_build + +%install +%py3_install + +%if %{with check} +%check +# icon-test currently fails +# https://bugs.freedesktop.org/show_bug.cgi?id=104846 +nosetests-%{python3_version} || : +%endif + +%files -n python%{python3_pkgversion}-pyxdg +%license COPYING +%doc AUTHORS ChangeLog README TODO +%{python3_sitelib}/xdg +%{python3_sitelib}/pyxdg-*.egg-info + +%changelog +* Wed Jul 29 2020 Fedora Release Engineering - 0.26-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Sun May 24 2020 Miro Hrončok - 0.26-10 +- Rebuilt for Python 3.9 + +* Thu Jan 30 2020 Fedora Release Engineering - 0.26-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Thu Nov 07 2019 Miro Hrončok - 0.26-8 +- Subpackage python2-pyxdg has been removed + See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal + +* Thu Oct 03 2019 Miro Hrončok - 0.26-7 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Sat Aug 17 2019 Miro Hrončok - 0.26-6 +- Rebuilt for Python 3.8 + +* Fri Jul 26 2019 Fedora Release Engineering - 0.26-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Sat Feb 02 2019 Fedora Release Engineering - 0.26-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Nov 30 2018 Tom Callaway - 0.26-3 +- fix incorrect use of Type attribute (bz 1654857) + +* Thu Nov 1 2018 Tom Callaway - 0.26-2 +- fix OnlyShowIn (bz 1624651) + +* Mon Jul 23 2018 Tom Callaway - 0.26-1 +- update to 0.26 + +* Sat Jul 14 2018 Fedora Release Engineering - 0.25-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Mon Jun 18 2018 Miro Hrončok - 0.25-16 +- Rebuilt for Python 3.7 + +* Fri Feb 09 2018 Fedora Release Engineering - 0.25-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jan 31 2018 Iryna Shcherbina - 0.25-14 +- Update Python 2 dependency declarations to new packaging standards + (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3) + +* Thu Jul 27 2017 Fedora Release Engineering - 0.25-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 0.25-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Dec 12 2016 Charalampos Stratakis - 0.25-11 +- Rebuild for Python 3.6 + +* Mon Nov 21 2016 Orion Poplawski - 0.25-10 +- Ship python2-pyxdg +- Enable python 3 builds for EPEL +- Use %%license +- Modernize spec + +* Tue Jul 19 2016 Fedora Release Engineering - 0.25-9 +- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages + +* Thu Feb 04 2016 Fedora Release Engineering - 0.25-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Nov 10 2015 Fedora Release Engineering - 0.25-7 +- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5 + +* Thu Jun 18 2015 Fedora Release Engineering - 0.25-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Thu Dec 4 2014 Tom Callaway - 0.25-5 +- fix CVE-2014-1624 + +* Sun Jun 08 2014 Fedora Release Engineering - 0.25-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Tue May 27 2014 Kalev Lember - 0.25-3 +- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4 + +* Sun Aug 04 2013 Fedora Release Engineering - 0.25-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Thu Feb 28 2013 Tom Callaway - 0.25-1 +- update to 0.25 + +* Thu Feb 14 2013 Fedora Release Engineering - 0.24-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Wed Nov 7 2012 Tomas Bzatek - 0.24-1 +- update to 0.24 + +* Fri Oct 26 2012 Tom Callaway - 0.23-2 +- gracefully handle kde-config fails + +* Mon Oct 8 2012 Tom Callaway - 0.23-1 +- update to 0.23 +- enable python3 + +* Sat Jul 21 2012 Fedora Release Engineering - 0.19-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jan 14 2012 Fedora Release Engineering - 0.19-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Wed Feb 09 2011 Fedora Release Engineering - 0.19-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Thu Jul 22 2010 David Malcolm - 0.19-2 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + +* Wed Apr 28 2010 Tom "spot" Callaway - 0.19-1 +- update to 0.19 + +* Wed Aug 19 2009 Tom "spot" Callaway - 0.17-1 +- update to 0.17 + +* Sun Jul 26 2009 Fedora Release Engineering - 0.16-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu Feb 26 2009 Fedora Release Engineering - 0.16-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Sat Nov 29 2008 Ignacio Vazquez-Abrams - 0.16-2 +- Rebuild for Python 2.6 + +* Thu Oct 30 2008 Tom "spot" Callaway - 0.16-1 +- update to 0.16 +- fix indent bug in DesktopEntry.py (bz 469229) + +* Sat Apr 5 2008 Tom "spot" Callaway - 0.15-6 +- add egg-info (fixes FTBFS bz 440813) + +* Wed Jan 3 2007 Patrice Dumas - 0.15-5 +- remove requires for python-abi (automatic now) and python directory +- remove package name from summary +- change tabs to spaces + +* Thu Dec 21 2006 Patrice Dumas - 0.15-4 +- rebuild for python 2.5 + +* Sat Sep 23 2006 Tom "spot" Callaway - 0.15-3 +- rebuild for fc6 + +* Wed Feb 15 2006 John Mahowald - 0.15.2 +- Rebuild for Fedora Extras 5 + +* Fri Oct 14 2005 John Mahowald - 0.15-1 +- Rebuilt for 0.15 + +* Sun Jul 03 2005 Sindre Pedersen Bjordal - 0.14-2 +- Added %%{?dist} tag to release +- BuildArch: noarch +- Removed unneccesary CLFAGS + +* Sun Jun 05 2005 Sindre Pedersen Bjordal - 0.14-1 +- Rebuilt for 0.14 + +* Wed Jun 01 2005 Sindre Pedersen Bjordal - 0.13-1 +- Rebuilt for 0.13 + +* Tue May 31 2005 Sindre Pedersen Bjordal - 0.12-1 +- Rebuilt for 0.12 + +* Sat May 28 2005 Sindre Pedersen Bjordal - 0.11-1 +- Rebuilt for 0.11 + +* Mon May 23 2005 Sindre Pedersen Bjordal - 0.10-1 +- Adapt to Fedora Extras template, based on spec from NewRPMs + +* Tue Dec 14 2004 Che +- initial rpm release + + diff --git a/sources b/sources new file mode 100644 index 0000000..33431fb --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (pyxdg-0.26.tar.gz) = f5306e6e15af07df2599017500fc8ad83e722e5d5c6e4fda014aab1d77df92a3c3199a5be7a889faaecab72861e9910be9d80142d29856eb7a11f6ab9a923bd2