Compare commits

...

No commits in common. "c8-stream-3.8" and "c10s" have entirely different histories.

15 changed files with 321 additions and 108 deletions

View File

@ -1 +0,0 @@
efbe83434843c1963a9e56f36a9afa74a38c60a8 SOURCES/5.4.1.tar.gz

1
.fmf/version Normal file
View File

@ -0,0 +1 @@
1

25
.gitignore vendored
View File

@ -1 +1,24 @@
SOURCES/5.4.1.tar.gz
PyYAML-3.09.tar.gz
/PyYAML-3.10.tar.gz
/PyYAML-3.11.tar.gz
/PyYAML-3.12.tar.gz
/PyYAML-4.1.tar.gz
/pyyaml-4.1.tar.gz
/PyYAML-4.2b4.tar.gz
/PyYAML-5.1b1.tar.gz
/PyYAML-5.1b3.tar.gz
/PyYAML-5.1b6.tar.gz
/PyYAML-5.1.tar.gz
/PyYAML-5.1.1.tar.gz
/PyYAML-5.1.2.tar.gz
/5.1.2.tar.gz
/5.2.tar.gz
/5.3.tar.gz
/5.3.1.tar.gz
/5.4b1.tar.gz
/5.4b2.tar.gz
/5.4.tar.gz
/5.4.1.tar.gz
/6.0b1.tar.gz
/6.0.tar.gz
/6.0.1.tar.gz

39
731.patch Normal file
View File

@ -0,0 +1,39 @@
From 17dc5b6cd96dcfe64fd71789c771ca9b96d260e5 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Fri, 21 Jul 2023 09:50:00 -0400
Subject: [PATCH] Fix builds with Cython 3
This is a *de minimis* fix for building with Cython 3. Recent Cython<3
releases provided `Cython.Distutils.build_ext` as an alias to
`Cython.Distutils.old_build_ext.old_build_ext`; Cython 3 drops this
alias and instead uses a wholly new `Cython.Distutils.build_ext` that
does not provide the `cython_sources` function used in `setup.py`.
Explicitly importing `old_build_ext` preserves the existing behavior for
recent Cython<3 and uses the correct behavior for Cython 3. Should the
import fail (*e.g.*, because the version of Cython available predates
the availability of `old_build_ext`), the import falls back to just
`Cython.Distutils.build_ext`.
Signed-off-by: Andrew J. Hesford <ajh@sideband.org>
---
setup.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 944e7fa2..462b1e95 100644
--- a/setup.py
+++ b/setup.py
@@ -82,7 +82,11 @@
with_cython = True
try:
from Cython.Distutils.extension import Extension as _Extension
- from Cython.Distutils import build_ext as _build_ext
+ try:
+ from Cython.Distutils.old_build_ext import old_build_ext as _build_ext
+ except ImportError:
+ from Cython.Distutils import build_ext as _build_ext
+
with_cython = True
except ImportError:
if with_cython:

77
PyYAML.spec Normal file
View File

@ -0,0 +1,77 @@
Name: PyYAML
Version: 6.0.1
Release: %autorelease
Summary: YAML parser and emitter for Python
# SPDX
License: MIT
URL: https://github.com/yaml/pyyaml
Source: https://github.com/yaml/pyyaml/archive/%{version}.tar.gz
# Fix build with Cython 3
# Proposed upstream but refused (upstream does not want Cython 3)
Patch: https://github.com/yaml/pyyaml/pull/731.patch
BuildRequires: gcc
BuildRequires: libyaml-devel
BuildRequires: python3-devel
%global _description\
YAML is a data serialization format designed for human readability and\
interaction with scripting languages. PyYAML is a YAML parser and\
emitter for Python.\
\
PyYAML features a complete YAML 1.1 parser, Unicode support, pickle\
support, capable extension API, and sensible error messages. PyYAML\
supports standard YAML tags and provides Python-specific tags that\
allow to represent an arbitrary Python object.\
\
PyYAML is applicable for a broad range of tasks from complex\
configuration files to object serialization and persistence.
%description %_description
%package -n python3-pyyaml
Summary: %summary
%py_provides python3-yaml
%py_provides python3-PyYAML
%description -n python3-pyyaml %_description
%prep
%autosetup -p1 -n pyyaml-%{version}
chmod a-x examples/yaml-highlight/yaml_hl.py
# remove pre-generated file
rm -rf ext/_yaml.c
# we have a patch for Cython 3
sed -i 's/Cython<3.0/Cython/' pyproject.toml
%generate_buildrequires
%pyproject_buildrequires
%build
%pyproject_wheel
%install
%pyproject_install
%pyproject_save_files yaml _yaml
%check
%{py3_test_envvars} %{python3} tests/lib/test_all.py
%files -n python3-pyyaml -f %{pyproject_files}
%doc CHANGES README.md examples
%changelog
%autochangelog

View File

@ -1,128 +1,64 @@
# RHEL8: disable building python2 in the python39 module
%bcond_with python2
* Fri Jul 28 2023 Miro Hrončok <mhroncok@redhat.com> - 6.0.1-4
- Fix build with Cython 3
Name: PyYAML
Version: 5.4.1
Release: 1%{?dist}
%global uversion %{version}
Summary: YAML parser and emitter for Python
* Tue Jul 25 2023 Miro Hrončok <mhroncok@redhat.com> - 6.0.1-3
- Pin Cython < 3 to build this package
License: MIT
URL: https://github.com/yaml/pyyaml
Source0: https://github.com/yaml/pyyaml/archive/%{uversion}.tar.gz
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 6.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
# Exclude i686 arch. Due to a modularity issue it's being added to the
# x86_64 compose of CRB, but we don't want to ship it at all.
# See: https://projects.engineering.redhat.com/browse/RCM-72605
ExcludeArch: i686
* Tue Jul 18 2023 John Eckersberg <jeckersb@redhat.com> - 6.0.1-1
- New upstream release 6.0.1 (rhbz#2223462)
BuildRequires: gcc
BuildRequires: libyaml-devel
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 6.0-8
- Rebuilt for Python 3.12
%if %{with python2}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%endif
* Tue Apr 11 2023 John Eckersberg <jeckersb@redhat.com> - 6.0-7
- Rebuilt for Python 3.12 / Cython 0.29.34 (rhbz#2177815)
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-rpm-macros
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-Cython
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 6.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
%global _description\
YAML is a data serialization format designed for human readability and\
interaction with scripting languages. PyYAML is a YAML parser and\
emitter for Python.\
\
PyYAML features a complete YAML 1.1 parser, Unicode support, pickle\
support, capable extension API, and sensible error messages. PyYAML\
supports standard YAML tags and provides Python-specific tags that\
allow to represent an arbitrary Python object.\
\
PyYAML is applicable for a broad range of tasks from complex\
configuration files to object serialization and persistence.
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 6.0-4
- Rebuilt for Python 3.11
%description %_description
* Tue Feb 08 2022 Miro Hrončok <mhroncok@redhat.com> - 6.0-3
- Remove some outdated Obsoletes and Provides,
but keep providing python3-yaml and python3-PyYAML for users
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
%if %{with python2}
%package -n python2-pyyaml
Summary: %summary
Provides: python-yaml = %{version}-%{release}
Provides: python-yaml%{?_isa} = %{version}-%{release}
Provides: python2-yaml = %{version}-%{release}
Provides: python2-yaml%{?_isa} = %{version}-%{release}
Provides: PyYAML = %{version}-%{release}
Provides: PyYAML%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python2-pyyaml}
* Wed Oct 13 2021 John Eckersberg <jeckersb@redhat.com> - 6.0-1
- New upstream release 6.0
%description -n python2-pyyaml %_description
%endif
* Mon Oct 4 2021 John Eckersberg <jeckersb@redhat.com> - 6.0-0.1.b1
- New upstream beta release 6.0b1 (rhbz#2010501)
%package -n python%{python3_pkgversion}-pyyaml
Summary: %summary
Provides: python%{python3_pkgversion}-yaml = %{version}-%{release}
Provides: python%{python3_pkgversion}-yaml%{?_isa} = %{version}-%{release}
%{?python_provide:%python_provide python%{python3_pkgversion}-pyyaml}
Provides: python%{python3_pkgversion}-PyYAML = %{version}-%{release}
Provides: python%{python3_pkgversion}-PyYAML%{?_isa} = %{version}-%{release}
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
%description -n python%{python3_pkgversion}-pyyaml %_description
* Wed Jun 02 2021 Python Maint <python-maint@redhat.com> - 5.4.1-3
- Rebuilt for Python 3.10
* Mon Jan 25 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
%prep
%setup -q -n pyyaml-%{uversion}
chmod a-x examples/yaml-highlight/yaml_hl.py
* Thu Jan 21 2021 John Eckersberg <jeckersb@redhat.com> - 5.4.1-1
- New upstream release 5.4.1 (rhbz#1918523)
# remove pre-generated file
rm -rf ext/_yaml.c
* Wed Jan 20 2021 John Eckersberg <jeckersb@redhat.com> - 5.4-1
- New upstream release 5.4
- Fixes CVE-2020-14343
* Fri Jan 15 2021 John Eckersberg <jeckersb@redhat.com> - 5.4-0.1.b2
- New upstream beta release 5.4b2 (rhbz#1916496)
%build
%py3_build
%if %{with python2}
# py2_build reuses Cython output from py3_build
%py2_build
%endif
%install
%if %{with python2}
%py2_install
%endif
%py3_install
%check
%if %{with python2}
%{__python2} setup.py test
%endif
%{__python3} setup.py test
%if %{with python2}
%files -n python2-pyyaml
%license LICENSE
%doc CHANGES README examples
%{python2_sitearch}/*
%endif
%files -n python%{python3_pkgversion}-pyyaml
%license LICENSE
%doc CHANGES README examples
%{python3_sitearch}/*
%changelog
* Tue Mar 23 2021 Tomas Orsava <torsava@redhat.com> - 5.4.1-1
- Rebase to version 5.4.1 to fix CVE-2020-14343
- Resolves: rhbz#1860466
* Mon Jan 18 2021 Tomas Orsava <torsava@redhat.com> - 5.3.1-6
- Add PyYAML to the python39 module in RHEL8
- Resolves: rhbz#1877430
* Thu Jan 14 2021 John Eckersberg <jeckersb@redhat.com> - 5.4-0.1.b1
- New upstream beta release 5.4b1 (rhbz#1916034)
* Mon Nov 23 2020 Miro Hrončok <mhroncok@redhat.com> - 5.3.1-5
- Disable Python 2 build on RHEL 9+

5
gating.yaml Normal file
View File

@ -0,0 +1,5 @@
--- !Policy
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

4
plan.fmf Normal file
View File

@ -0,0 +1,4 @@
discover:
how: fmf
execute:
how: tmt

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (6.0.1.tar.gz) = 1c74a92a4ad7d47854dc7bcb2e89b3c8e0b14fa815c7dbfbc22b24480dbba6c81e971c77ee384c494a960914b95f06edf943d7431925a5ed674a0ba830d258e0

5
tests/smoke/main.fmf Normal file
View File

@ -0,0 +1,5 @@
test: ./runtest.sh
framework: beakerlib
require:
- python3-pyyaml
duration: 5m

View File

@ -0,0 +1,3 @@
#!/usr/bin/env python
import yaml
print(yaml.dump({'name': 'Silenthand Olleander', 'race': 'Human', 'traits': ['ONE_HAND', 'ONE_EYE']}))

View File

@ -0,0 +1,13 @@
#!/usr/bin/env python
import yaml
documents = """
---
name: foo
---
name: bar
---
name: foobar
"""
for data in yaml.load_all(documents, Loader=yaml.SafeLoader):
print(data)

View File

@ -0,0 +1,24 @@
import yaml
class Hero:
def __init__(self, name, hp, sp):
self.name = name
self.hp = hp
self.sp = sp
def __repr__(self):
return "%s(name=%r, hp=%r, sp=%r)" % (
self.__class__.__name__, self.name, self.hp, self.sp)
STRING = """
!!python/object:__main__.Hero
name: Welthyr Syxgon
hp: 1200
sp: 0
"""
try:
yaml.load(STRING, Loader=yaml.SafeLoader)
raise RuntimeError("Didn't raise exception")
except yaml.constructor.ConstructorError:
pass
print(yaml.unsafe_load(STRING))

View File

@ -0,0 +1,9 @@
#!/usr/bin/env python
import yaml
document = """
a: 1
b:
c: 3
d: 4
"""
print(yaml.dump(yaml.load(document, Loader=yaml.SafeLoader)))

74
tests/smoke/runtest.sh Executable file
View File

@ -0,0 +1,74 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/PyYAML/Sanity/Smoke
# Description: Smoke test for this component
# Author: Stepan Sigut <ssigut@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PYTHON=${PYTHON:-"python3"}
PATTERN1="{'name': 'foo'}
{'name': 'bar'}
{'name': 'foobar'}"
PATTERN3="name: Silenthand Olleander
race: Human
traits: [ONE_HAND, ONE_EYE]"
PATTERN4="a: 1
b: {c: 3, d: 4}"
PATTERN5="Hero(name='Welthyr Syxgon', hp=1200, sp=0)"
set -o pipefail
rlJournalStart
rlPhaseStartSetup
# export python's MAJOR and MINOR version
rlRun "export $($PYTHON -c \
'import sys; print("MAJOR={0} MINOR={1}".format(\
sys.version_info[0],sys.version_info[1]))')"
rlPhaseEnd
rlPhaseStartTest "Running pyyaml_load.py"
rlRun -s "$PYTHON pyyaml_load.py"
rlAssertGrep "$PATTERN1" "$rlRun_LOG"
rlPhaseEnd
rlPhaseStartTest "Running pyyaml_dump.py"
rlRun -s "$PYTHON pyyaml_dump.py"
rlAssertGrep "$PATTERN3" "$rlRun_LOG"
rlPhaseEnd
rlPhaseStartTest "Running pyyaml_parse.py"
rlRun -s "$PYTHON pyyaml_parse.py"
rlAssertGrep "$PATTERN4" "$rlRun_LOG"
rlPhaseEnd
rlPhaseStartTest "Running pyyaml_object.py"
rlRun -s "$PYTHON pyyaml_object.py"
rlAssertGrep "$PATTERN5" "$rlRun_LOG"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd