From e9324b9384250f0699de642d96ad36484eb12be8 Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Sun, 3 Mar 2024 13:09:38 +0100 Subject: [PATCH] Changes for building fakeredis and Flor rpm --- data/projects.ini | 7 ++-- data/rpm_templates/Flor.spec | 9 +++--- data/rpm_templates/fakeredis.spec | 44 ++++++++++++++++++++++++++ l2tdevtools/build_helpers/dpkg.py | 12 +++---- l2tdevtools/build_helpers/factory.py | 4 +++ l2tdevtools/build_helpers/interface.py | 2 +- l2tdevtools/build_helpers/rpm.py | 4 +-- 7 files changed, 65 insertions(+), 17 deletions(-) create mode 100644 data/rpm_templates/fakeredis.spec diff --git a/data/projects.ini b/data/projects.ini index 16931f73..1733ca79 100644 --- a/data/projects.ini +++ b/data/projects.ini @@ -416,10 +416,11 @@ description_long: Discover and load entry points from installed packages version: >=1.1.0 dpkg_build_dependencies: python3-poetry-core build_system: poetry -maintainer: Bruce Merry -homepage_url: https://github.com/jamesls/fakeredis +rpm_template_spec: fakeredis.spec +maintainer: Daniel Moran +homepage_url: https://github.com/cunla/fakeredis-py download_url: https://pypi.org/project/fakeredis -git_url: https://github.com/jamesls/fakeredis.git +git_url: https://github.com/cunla/fakeredis-py.git description_short: A fake version of a redis-py description_long: Fake implementation of redis API (redis-py) for testing purposes diff --git a/data/rpm_templates/Flor.spec b/data/rpm_templates/Flor.spec index f9fc1564..3d74bc80 100644 --- a/data/rpm_templates/Flor.spec +++ b/data/rpm_templates/Flor.spec @@ -19,10 +19,10 @@ BuildRequires: python3-devel, python3-setuptools %description A Bloom filter implementation in Python -%package -n python3-%{{name}} +%package -n python3-flor Summary: Python 3 module of Flor - An efficient Bloom filter implementation in Python -%description -n python3-%{{name}} +%description -n python3-flor A Bloom filter implementation in Python %prep @@ -39,9 +39,8 @@ rm -rf %{{buildroot}}/usr/share/doc/%{{name}}/ %clean rm -rf %{{buildroot}} -%files -n python3-%{{name}} - - +%files -n python3-flor +%doc README.md %{{python3_sitelib}}/flor %{{python3_sitelib}}/Flor*.egg-info diff --git a/data/rpm_templates/fakeredis.spec b/data/rpm_templates/fakeredis.spec new file mode 100644 index 00000000..e2db305f --- /dev/null +++ b/data/rpm_templates/fakeredis.spec @@ -0,0 +1,44 @@ +%define name fakeredis +%define version {version} +%define release 1 + +Name: %{{name}} +Version: %{{version}} +Release: %{{release}} +Summary: A fake version of a redis-py +License: BSD-3-Clause +URL: https://github.com/cunla/fakeredis-py +Source: %{{name}}-%{{version}}.tar.gz +BuildArch: noarch +BuildRequires: python3-devel, python3-poetry-core, python3-tox-current-env + +%description +Fake implementation of redis API (redis-py) for testing purposes + +%package -n python3-%{{name}} +Summary: A fake version of a redis-py + +%description -n python3-%{{name}} +Fake implementation of redis API (redis-py) for testing purposes + +%prep +%autosetup -p1 -n %{{name}}-%{{version}} + +%generate_buildrequires +%pyproject_buildrequires -t + +%build +%pyproject_wheel + +%install +%pyproject_install + +%files -n python3-%{{name}} +%license LICENSE +%doc README.md +%{{python3_sitelib}}/fakeredis +%{{python3_sitelib}}/fakeredis*.dist-info + +%changelog +* {date_time} log2timeline development team {version}-1 +- Auto-generated diff --git a/l2tdevtools/build_helpers/dpkg.py b/l2tdevtools/build_helpers/dpkg.py index 29716fd4..a834b457 100644 --- a/l2tdevtools/build_helpers/dpkg.py +++ b/l2tdevtools/build_helpers/dpkg.py @@ -232,7 +232,7 @@ def _CreatePackagingFiles(self, source_directory, project_version): # the dpkg directory. if os.path.exists(debian_directory): logging.info('Removing: {0:s}'.format(debian_directory)) - shutil.rmtree(debian_directory) + shutil.rmtree(debian_directory, ignore_errors=True) dpkg_directory = os.path.join(source_directory, 'dpkg') @@ -580,7 +580,7 @@ def Build(self, source_helper_object): temporary_directory = os.path.join(source_directory, 'tmp') if os.path.exists(temporary_directory): logging.info('Removing: {0:s}'.format(temporary_directory)) - shutil.rmtree(temporary_directory) + shutil.rmtree(temporary_directory, ignore_errors=True) if not self._BuildPrepare( source_directory, source_helper_object.project_name, project_version, @@ -698,7 +698,7 @@ def Build(self, source_helper_object): temporary_directory = os.path.join(source_directory, 'tmp') if os.path.exists(temporary_directory): logging.info('Removing: {0:s}'.format(temporary_directory)) - shutil.rmtree(temporary_directory) + shutil.rmtree(temporary_directory, ignore_errors=True) if not self._BuildPrepare( source_directory, source_helper_object.project_name, project_version, @@ -832,7 +832,7 @@ def _DetermineBuildConfiguration(self, source_directory): build_configuration.has_bin_directory = True if os.path.exists(installroot_path): - shutil.rmtree(installroot_path) + shutil.rmtree(installroot_path, ignore_errors=True) return build_configuration @@ -929,7 +929,7 @@ def Build(self, source_helper_object): temporary_directory = os.path.join(source_directory, 'tmp') if os.path.exists(temporary_directory): logging.info('Removing: {0:s}'.format(temporary_directory)) - shutil.rmtree(temporary_directory) + shutil.rmtree(temporary_directory, ignore_errors=True) if not self._BuildPrepare( source_directory, project_name, project_version, self.version_suffix, @@ -1086,7 +1086,7 @@ def Build(self, source_helper_object): temporary_directory = os.path.join(source_directory, 'tmp') if os.path.exists(temporary_directory): logging.info('Removing: {0:s}'.format(temporary_directory)) - shutil.rmtree(temporary_directory) + shutil.rmtree(temporary_directory, ignore_errors=True) if not self._BuildPrepare( source_directory, project_name, project_version, self.version_suffix, diff --git a/l2tdevtools/build_helpers/factory.py b/l2tdevtools/build_helpers/factory.py index 17a459d9..3550f35d 100644 --- a/l2tdevtools/build_helpers/factory.py +++ b/l2tdevtools/build_helpers/factory.py @@ -23,9 +23,13 @@ class BuildHelperFactory(object): 'wheel': wheel.FlitWheelBuildHelper, } + # Note that the rpm and srpm setup.py build helpers are used to build + # projects that use poetry. _POETRY_BUILD_HELPER_CLASSES = { 'dpkg': dpkg.PybuildDPKGBuildHelper, 'dpkg-source': dpkg.PybuildSourceDPKGBuildHelper, + 'rpm': rpm.SetupPyRPMBuildHelper, + 'srpm': rpm.SetupPySRPMBuildHelper, 'wheel': wheel.PoetryWheelBuildHelper, } diff --git a/l2tdevtools/build_helpers/interface.py b/l2tdevtools/build_helpers/interface.py index 6201864a..342413b6 100644 --- a/l2tdevtools/build_helpers/interface.py +++ b/l2tdevtools/build_helpers/interface.py @@ -45,7 +45,7 @@ def _RemoveOlderSourceDirectories(self, project_name, project_version): for filename in filenames: if os.path.isdir(filename) and not filenames_to_ignore.match(filename): logging.info('Removing: {0:s}'.format(filename)) - shutil.rmtree(filename) + shutil.rmtree(filename, ignore_errors=True) def _RemoveOlderSourcePackages(self, project_name, project_version): """Removes previous versions of source packages. diff --git a/l2tdevtools/build_helpers/rpm.py b/l2tdevtools/build_helpers/rpm.py index 7c8a25f6..c22c3809 100644 --- a/l2tdevtools/build_helpers/rpm.py +++ b/l2tdevtools/build_helpers/rpm.py @@ -293,7 +293,7 @@ def _RemoveOlderBuildDirectory(self, project_name, project_version): for filename in filenames: if not filenames_to_ignore.match(filename): logging.info('Removing: {0:s}'.format(filename)) - shutil.rmtree(filename) + shutil.rmtree(filename, ignore_errors=True) def _RemoveOlderRPMs(self, project_name, project_version): """Removes previous versions of .rpm files. @@ -557,7 +557,7 @@ def Clean(self, source_helper_object): for filename in ('build', 'dist'): if os.path.exists(filename): logging.info('Removing: {0:s}'.format(filename)) - shutil.rmtree(filename, True) + shutil.rmtree(filename, ignore_errors=True) # Remove previous versions of rpms. project_name, project_version = self._GetFilenameSafeProjectInformation(