Compare commits
No commits in common. "c8s" and "c10s" have entirely different histories.
1
.fmf/version
Normal file
1
.fmf/version
Normal file
@ -0,0 +1 @@
|
||||
1
|
||||
16
.gitignore
vendored
16
.gitignore
vendored
@ -1,2 +1,16 @@
|
||||
SOURCES/pyparted-3.11.7.tar.gz
|
||||
/pyparted-3.10.6.tar.gz
|
||||
/pyparted-3.10.7.tar.gz
|
||||
/pyparted-3.11.0.tar.gz
|
||||
/pyparted-3.11.2.tar.gz
|
||||
/pyparted-3.11.2.tar.gz.asc
|
||||
/pyparted-3.11.3.tar.gz
|
||||
/pyparted-3.11.4.tar.gz
|
||||
/pyparted-3.11.4.tar.gz.asc
|
||||
/pyparted-3.11.5.tar.gz
|
||||
/pyparted-3.11.5.tar.gz.asc
|
||||
/pyparted-3.11.7.tar.gz
|
||||
/pyparted-3.11.7.tar.gz.asc
|
||||
/pyparted-3.12.0.tar.gz
|
||||
/pyparted-3.12.0.tar.gz.asc
|
||||
/pyparted-3.13.0.tar.gz
|
||||
/pyparted-3.13.0.tar.gz.asc
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
--- !Policy
|
||||
product_versions:
|
||||
- rhel-8
|
||||
- rhel-10
|
||||
decision_context: osci_compose_gate
|
||||
rules:
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.rpminspect.static-analysis}
|
||||
- !PassingTestCaseRule {test_case_name: osci.brew-build.installability.functional}
|
||||
|
||||
BIN
keyring.gpg
Normal file
BIN
keyring.gpg
Normal file
Binary file not shown.
9
plans/run-tests.fmf
Normal file
9
plans/run-tests.fmf
Normal file
@ -0,0 +1,9 @@
|
||||
summary: Run pyparted tests
|
||||
prepare:
|
||||
how: install
|
||||
package:
|
||||
- python3-pyparted
|
||||
execute:
|
||||
script: |
|
||||
fallocate -l 1G $PWD/disk.img
|
||||
./tests/scripts/pyparted-tests $PWD/disk.img
|
||||
File diff suppressed because it is too large
Load Diff
328
pyparted.spec
328
pyparted.spec
@ -1,207 +1,213 @@
|
||||
%if 0%{?rhel}
|
||||
%if %{rhel} <= 7
|
||||
# disable python3 by default
|
||||
%bcond_with python3
|
||||
%else
|
||||
%bcond_without python3
|
||||
%endif
|
||||
Summary: Python module for GNU parted
|
||||
Name: pyparted
|
||||
Epoch: 1
|
||||
Version: 3.13.0
|
||||
Release: 7%{?dist}
|
||||
License: GPL-2.0-or-later
|
||||
URL: https://github.com/dcantrell/pyparted
|
||||
|
||||
%if %{rhel} > 7
|
||||
# disable python2 by default
|
||||
%bcond_with python2
|
||||
%else
|
||||
%bcond_without python2
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora}
|
||||
%if %{fedora} < 23
|
||||
# disable python3 by default
|
||||
%bcond_with python3
|
||||
%else
|
||||
%bcond_without python3
|
||||
%endif
|
||||
|
||||
%if %{fedora} > 28
|
||||
# disable python2 by default
|
||||
%bcond_with python2
|
||||
%else
|
||||
%bcond_without python2
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%global py2dir python2-build
|
||||
|
||||
Summary: Python module for GNU parted
|
||||
Name: pyparted
|
||||
Epoch: 1
|
||||
Version: 3.11.7
|
||||
Release: 4%{?dist}
|
||||
License: GPLv2+
|
||||
Group: System Environment/Libraries
|
||||
URL: https://github.com/rhinstaller/pyparted
|
||||
|
||||
Source0: https://github.com/rhinstaller/pyparted/archive/%{name}-%{version}.tar.gz
|
||||
|
||||
Patch0: pyparted-3.11.7-covscan.patch
|
||||
Source0: https://github.com/dcantrell/pyparted/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||
Source1: https://github.com/dcantrell/pyparted/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc
|
||||
Source2: keyring.gpg
|
||||
Source3: trustdb.gpg
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: gcc
|
||||
BuildRequires: parted-devel >= 3.2-18
|
||||
BuildRequires: parted-devel >= 3.4
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: e2fsprogs
|
||||
|
||||
%if %{with python3}
|
||||
BuildRequires: gnupg2
|
||||
BuildRequires: python3-devel
|
||||
BuildRequires: python3-six
|
||||
%endif
|
||||
BuildRequires: python3-setuptools
|
||||
|
||||
%if %{with python2}
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python2-six
|
||||
%endif
|
||||
|
||||
%global _description\
|
||||
Python module for the parted library. It is used for manipulating\
|
||||
%description
|
||||
Python module for the parted library. It is used for manipulating
|
||||
partition tables.
|
||||
|
||||
%description %_description
|
||||
|
||||
%if %{with python2}
|
||||
%package -n python2-pyparted
|
||||
Summary: %summary
|
||||
%{?python_provide:%python_provide python2-pyparted}
|
||||
# Remove before F30
|
||||
Provides: pyparted = %{epoch}:%{version}-%{release}
|
||||
Provides: pyparted%{?_isa} = %{epoch}:%{version}-%{release}
|
||||
Obsoletes: pyparted < %{epoch}:%{version}-%{release}
|
||||
|
||||
%description -n python2-pyparted %_description
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
%package -n python3-pyparted
|
||||
Summary: Python 3 module for GNU parted
|
||||
Group: System Environment/Libraries
|
||||
%if !%{with python2}
|
||||
Provides: pyparted = %{epoch}:%{version}-%{release}
|
||||
%endif
|
||||
Summary: Python 3 module for GNU parted
|
||||
|
||||
%description -n python3-pyparted
|
||||
Python module for the parted library. It is used for manipulating
|
||||
partition tables. This package provides Python 3 bindings for parted.
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
# Verify source archive signature
|
||||
gpg --no-default-keyring --keyring %{SOURCE2} --trustdb-name %{SOURCE3} --verify %{SOURCE1} %{SOURCE0} || exit 1
|
||||
|
||||
%if %{with python2}
|
||||
rm -rf ../%{py2dir}
|
||||
mkdir -p ../%{py2dir}
|
||||
cp -a . ../%{py2dir}
|
||||
mv ../%{py2dir} .
|
||||
%endif
|
||||
%autosetup
|
||||
|
||||
%build
|
||||
%if %{with python3}
|
||||
PYTHON=python3 CFLAGS="%{optflags}" make %{?_smp_mflags}
|
||||
%endif
|
||||
|
||||
%if %{with python2}
|
||||
pushd %{py2dir}
|
||||
PYTHON=python2 CFLAGS="%{optflags}" make %{?_smp_mflags}
|
||||
popd
|
||||
%endif
|
||||
%make_build CFLAGS="%{optflags} -fcommon"
|
||||
|
||||
%check
|
||||
%if %{with python3}
|
||||
PYTHON=python3 CFLAGS="%{optflags}" make test
|
||||
%endif
|
||||
|
||||
%if %{with python2}
|
||||
pushd %{py2dir}
|
||||
PYTHON=python2 CFLAGS="%{optflags}" make test
|
||||
popd
|
||||
%endif
|
||||
make test
|
||||
|
||||
%install
|
||||
%if %{with python3}
|
||||
PYTHON=python3 CFLAGS="%{optflags}" make install DESTDIR=%{buildroot}
|
||||
%endif
|
||||
%make_install
|
||||
|
||||
%if %{with python2}
|
||||
pushd %{py2dir}
|
||||
PYTHON=python2 CFLAGS="%{optflags}" make install DESTDIR=%{buildroot}
|
||||
popd
|
||||
%endif
|
||||
|
||||
%if %{with python3}
|
||||
%files -n python3-pyparted
|
||||
%doc AUTHORS COPYING NEWS README TODO
|
||||
%doc AUTHORS HACKING NEWS README.md RELEASE TODO
|
||||
%license LICENSE
|
||||
%{python3_sitearch}/_ped.*.so
|
||||
%{python3_sitearch}/parted
|
||||
%{python3_sitearch}/%{name}-%{version}-*.egg-info
|
||||
%endif
|
||||
|
||||
%if %{with python2}
|
||||
%files -n python2-pyparted
|
||||
%doc AUTHORS COPYING NEWS README TODO
|
||||
%{python2_sitearch}/_ped.so
|
||||
%{python2_sitearch}/parted
|
||||
%{python2_sitearch}/%{name}-%{version}-*.egg-info
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Jul 12 2021 David Cantrell <dcantrell@redhat.com> - 1:3.11.7-4
|
||||
- Rebuild for gating
|
||||
Related: rhbz#1927379
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1:3.13.0-7
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
|
||||
* Fri Jul 09 2021 David Cantrell <dcantrell@redhat.com> - 1:3.11.7-3
|
||||
- More covscan patch followup
|
||||
Related: rhbz#1927379
|
||||
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1:3.13.0-6
|
||||
- Bump release for June 2024 mass rebuild
|
||||
|
||||
* Fri Jul 09 2021 David Cantrell <dcantrell@redhat.com> - 1:3.11.7-2
|
||||
- Patched errors found by covscan
|
||||
Related: rhbz#1927379
|
||||
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.13.0-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Thu Jul 08 2021 David Cantrell <dcantrell@redhat.com> - 1:3.11.7-1
|
||||
- Upgrade to pyparted-3.11.7
|
||||
Resolves: rhbz#1927379
|
||||
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.13.0-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
* Tue May 18 2021 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-21
|
||||
- Rebuild for gating
|
||||
Related: rhbz#1927379
|
||||
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.13.0-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
* Tue May 18 2021 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-20
|
||||
- Fixes for gating
|
||||
Related: rhbz#1927379
|
||||
* Thu Jun 22 2023 Python Maint <python-maint@redhat.com> - 1:3.13.0-2
|
||||
- Rebuilt for Python 3.12
|
||||
|
||||
* Mon May 17 2021 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-19
|
||||
- Rebuild for gating
|
||||
Related: rhbz#1927379
|
||||
* Wed Jun 21 2023 David Cantrell <dcantrell@redhat.com> - 1:3.13.0-1
|
||||
- Upgrade to pyparted-3.13.0
|
||||
|
||||
* Mon May 17 2021 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-18
|
||||
- Rebuild for gating
|
||||
Related: rhbz#1927379
|
||||
* Thu Jun 15 2023 Python Maint <python-maint@redhat.com> - 1:3.12.0-11
|
||||
- Rebuilt for Python 3.12
|
||||
|
||||
* Mon May 17 2021 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-17
|
||||
- Rebuild
|
||||
Related: rhbz#1927379
|
||||
* Wed Jun 14 2023 David Cantrell <dcantrell@redhat.com> - 1:3.12.0-10
|
||||
- Use non-deprecated syntax for the %%patch macros
|
||||
|
||||
* Tue Feb 23 2021 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-16
|
||||
- Handle PED_EXCEPTION_FIX (Fix/Ignore) exceptions
|
||||
Resolves: rhbz#1927379
|
||||
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 1:3.12.0-9
|
||||
- Rebuilt for Python 3.12
|
||||
|
||||
* Wed Jul 25 2018 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-13
|
||||
- Do not build python2 subpackage
|
||||
Resolves: rhbz#1565329
|
||||
* Thu Mar 02 2023 David Cantrell <dcantrell@redhat.com> - 1:3.12.0-8
|
||||
- Fix FTBFS with _ped.disktype test case for gpt (#2171656)
|
||||
- Update License tag to SPDX expression
|
||||
|
||||
* Thu Jul 19 2018 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-12
|
||||
- Have python3-pyparted package provide 'pyparted'
|
||||
Resolves: rhbz#1602333
|
||||
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.12.0-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||
|
||||
* Mon May 28 2018 Charalampos Stratakis <cstratak@redhat.com> - 1:3.11.0-11
|
||||
- Conditionalize the python2 subpackage
|
||||
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.12.0-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
||||
|
||||
* Tue Jun 21 2022 David Cantrell <dcantrell@redhat.com> - 1:3.12.0-5
|
||||
- Patch pyparted to handle PED_DISK_TYPE_PARTITION_TYPE_ID for the
|
||||
msdos disk type and PED_DISK_TYPE_PARTITION_TYPE_UUID for the gpt
|
||||
label (#2098792)
|
||||
|
||||
* Mon Jun 20 2022 Adam Williamson <awilliam@redhat.com> - 1:3.12.0-4
|
||||
- Backport PR #92 to fix tests with parted 3.5 (#2098792)
|
||||
|
||||
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1:3.12.0-3
|
||||
- Rebuilt for Python 3.11
|
||||
|
||||
* Mon Mar 07 2022 David Cantrell <dcantrell@redhat.com> - 3.12.0-2
|
||||
- BR python3-setuptools
|
||||
|
||||
* Mon Mar 07 2022 David Cantrell <dcantrell@redhat.com> - 3.12.0-1
|
||||
- Upgrade to pyparted-3.12.0
|
||||
|
||||
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.11.7-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
|
||||
|
||||
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.11.7-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
|
||||
|
||||
* Thu Jun 03 2021 Python Maint <python-maint@redhat.com> - 1:3.11.7-3
|
||||
- Rebuilt for Python 3.10
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.11.7-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Fri Oct 23 2020 David Cantrell <dcantrell@redhat.com> - 1:3.11.7-1
|
||||
- Upgrade to pyparted-3.11.7 (BZ#1890443)
|
||||
- Set PY_SSIZE_T_CLEAN for the build (bcl)
|
||||
- add nvme support
|
||||
- Update RELEASE file to make last step be "make pypi" (dcantrell)
|
||||
|
||||
* Tue Jul 14 2020 Tom Stellard <tstellar@redhat.com> - 1:3.11.5-3
|
||||
- Use make macros
|
||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
||||
|
||||
* Sat May 23 2020 Miro Hrončok <mhroncok@redhat.com> - 1:3.11.5-2
|
||||
- Rebuilt for Python 3.9
|
||||
|
||||
* Mon Mar 09 2020 David Cantrell <dcantrell@redhat.com> - 1:3.11.5-1
|
||||
- Require at least libparted 3.3 and python 3.7 (dcantrell)
|
||||
- pedmodule.c: Fix partition enum flag handling (bcl)
|
||||
- Add support for chromeos_kernel and bls_boot partition flags (bcl)
|
||||
- Move exception declarations to _pedmodule.c (dcantrell)
|
||||
|
||||
* Tue Feb 11 2020 David Cantrell <dcantrell@redhat.com> - 1:3.11.4-1
|
||||
- Use Decimal for Device.getSize() operations, return a
|
||||
float (#1801355)
|
||||
- Update the 'twine upload' line in the Makefile
|
||||
- Don't intentionally prohibit Python 2 usage (#67)
|
||||
- mips64 support
|
||||
|
||||
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.11.3-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Fri Nov 15 2019 David Cantrell <dcantrell@redhat.com> - 1:3.11.3-1
|
||||
- Fix deprecation warning in parted/cachedlist.py (#1772060)
|
||||
|
||||
* Sun Oct 20 2019 Miro Hrončok <mhroncok@redhat.com> - 1:3.11.2-5
|
||||
- Remove python2-pyparted from Fedora 32+
|
||||
|
||||
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1:3.11.2-4
|
||||
- Rebuilt for Python 3.8.0rc1 (#1748018)
|
||||
|
||||
* Fri Aug 16 2019 Miro Hrončok <mhroncok@redhat.com> - 1:3.11.2-3
|
||||
- Rebuilt for Python 3.8
|
||||
|
||||
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.11.2-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Fri Feb 01 2019 David Cantrell <dcantrell@redhat.com> - 1:3.11.2-1
|
||||
- pyparted-3.11.2 (dcantrell)
|
||||
- Do not remove the generated tarballs. (dcantrell)
|
||||
- Update the RELEASE file. (dcantrell)
|
||||
- tests: Fix flag_get_name tests (bcl)
|
||||
- Avoid potential NULL dereferences in pydisk.c and pytimer.c
|
||||
(dcantrell)
|
||||
- New - example to query device capacity (jflorian)
|
||||
- correct spelling mistake (edward)
|
||||
- _ped's *_flag_get_name methods now throw a PartedException instead of
|
||||
ValueError on unsupported flags. (lukasz.zemczak)
|
||||
- Make the partition name a property on parted.Partition objects (#34)
|
||||
(dcantrell)
|
||||
|
||||
* Tue Jul 31 2018 Florian Weimer <fweimer@redhat.com> - 1:3.11.0-17
|
||||
- Rebuild with fixed binutils
|
||||
|
||||
* Fri Jul 27 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1:3.11.0-16
|
||||
- Rebuild for new binutils
|
||||
|
||||
* Thu Jul 26 2018 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-15
|
||||
- Do not disable python2 builds by default. There are still some packages
|
||||
that have not been updated to python3 and require python2-pyparted.
|
||||
|
||||
* Wed Jul 25 2018 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-14
|
||||
- Conditionalize python2 and python3 builds to make the SRPM more portable
|
||||
across releases. On RHEL > 7 and Fedora > 28, do not build for python2.
|
||||
On RHEL <= 7, do not build for python3.
|
||||
|
||||
* Tue Jul 24 2018 David Cantrell <dcantrell@redhat.com> - 1:3.11.0-13
|
||||
- Use 'python2' when building the Python 2.x bindings (#1605566)
|
||||
- BuildRequires gcc (#1605566)
|
||||
- %%{python_sitearch} -> %%{python2_sitearch} (#1605566)
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1:3.11.0-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 1:3.11.0-11
|
||||
- Rebuilt for Python 3.7
|
||||
|
||||
* Mon Apr 02 2018 Adam Williamson <awilliam@redhat.com> - 1:3.11.0-10
|
||||
- Make pyparted provides/obsoletes include the epoch
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
---
|
||||
changedfiles:
|
||||
# ignore the Python bytecode files; they change with every build
|
||||
ignore:
|
||||
- "*.pyc"
|
||||
3
sources
3
sources
@ -1 +1,2 @@
|
||||
SHA512 (pyparted-3.11.7.tar.gz) = 41018989c21aab577cd1d51f521128d072b346afb9dcdcc27490cdbc2ed4382a854e4bd16780da72a0a95bbd521f14ee0e7f02816f34656cbae734d43a4f0b83
|
||||
SHA512 (pyparted-3.13.0.tar.gz) = a9162afdbee48de5474de98ae8c08df028d485e122fcafae8421dddd47c9ed00d8dd9f40d854b14d4582483d8ea3469128a912491371385e4f18a0dbbbafbfd5
|
||||
SHA512 (pyparted-3.13.0.tar.gz.asc) = 6f3e973b52584450c3eed97d64266df832d8820a6a72f731fbb9fbd9be06f93f2d53b47bcae01b78a831e3e3cedca3ae8629dc5f9fe35dcc3ed11226a11fd952
|
||||
|
||||
88
tests/scripts/pyparted-tests
Executable file
88
tests/scripts/pyparted-tests
Executable file
@ -0,0 +1,88 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import parted
|
||||
import sys
|
||||
|
||||
|
||||
def init_disk(disk_img):
|
||||
# Make a disklabel (failures here will raise an error)
|
||||
dev = parted.getDevice(disk_img)
|
||||
disk = parted.freshDisk(dev, "gpt")
|
||||
|
||||
# Make a partition
|
||||
geom = parted.Geometry(device=dev,
|
||||
start=2048,
|
||||
end=50*2048)
|
||||
fs = parted.FileSystem(type="ext4", geometry=geom)
|
||||
part = parted.Partition(disk=disk,
|
||||
type=parted.PARTITION_NORMAL,
|
||||
fs=fs,
|
||||
geometry=geom)
|
||||
disk.addPartition(partition=part,
|
||||
constraint=dev.optimalAlignedConstraint)
|
||||
part.setFlag(parted.PARTITION_BOOT)
|
||||
disk.commit()
|
||||
|
||||
def read_disk(disk_img):
|
||||
# Read the disk and check the partitions
|
||||
dev = parted.getDevice(disk_img)
|
||||
disk = parted.newDisk(dev)
|
||||
|
||||
if dev.length == 0:
|
||||
print("ERROR: Disk has no length", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if len(disk.partitions) != 1:
|
||||
print("ERROR: Wrong number of partitions", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
part = disk.partitions[0]
|
||||
if part.geometry.end != 50*2048:
|
||||
print("ERROR: Partition is wrong length", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
if part.geometry.start != 2048:
|
||||
print("ERROR: Parition doesn't start at sector 2048", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def remove_partition(disk_img):
|
||||
# Remove partition and check disk
|
||||
dev = parted.getDevice(disk_img)
|
||||
disk = parted.newDisk(dev)
|
||||
|
||||
if len(disk.partitions) != 1:
|
||||
print("ERROR: Wrong number of partitions", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
disk.removePartition(partition=disk.partitions[0])
|
||||
disk.commit()
|
||||
|
||||
dev = parted.getDevice(disk_img)
|
||||
disk = parted.newDisk(dev)
|
||||
|
||||
if len(disk.partitions) != 0:
|
||||
print("ERROR: Failed to delete partition", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def main(disk_img):
|
||||
print(f"Running tests on {disk_img}")
|
||||
|
||||
try:
|
||||
init_disk(disk_img)
|
||||
read_disk(disk_img)
|
||||
remove_partition(disk_img)
|
||||
except Exception as e:
|
||||
print(f"ERROR: {str(e)}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
print("PASS", file=sys.stderr)
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: %s <disk.img>" % sys.argv[0], file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
main(sys.argv[1])
|
||||
@ -1,21 +0,0 @@
|
||||
---
|
||||
|
||||
- hosts: localhost
|
||||
roles:
|
||||
# Fetch package source
|
||||
- role: standard-test-source
|
||||
tags:
|
||||
- classic
|
||||
- role: standard-test-basic
|
||||
tags:
|
||||
- classic
|
||||
required_packages:
|
||||
- gcc
|
||||
- make
|
||||
- parted-devel
|
||||
- python3-devel
|
||||
- redhat-rpm-config
|
||||
tests:
|
||||
- simple:
|
||||
dir: source/
|
||||
run: make test PYTHON=python3
|
||||
BIN
trustdb.gpg
Normal file
BIN
trustdb.gpg
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user