Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

Commit

Permalink
delete old rpm & update rpm to fedora 39
Browse files Browse the repository at this point in the history
Signed-off-by: Gonçalo Duarte <gonegrier.duarte@gmail.com>
  • Loading branch information
MrDuartePT committed Dec 4, 2023
1 parent daeb159 commit e9c0838
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 60 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
22 changes: 11 additions & 11 deletions subprojects/build_rpm_LLL.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cp -r ${REPODIR_LLL}/kernel_module ./lenovolegionlinux-kmod-${TAG}-x86_64

#Dkms change version
sudo sed -i "s/DKMS_VERSION/$TAG/g" ./lenovolegionlinux-kmod-${TAG}-x86_64/dkms.conf
mv lenovolegionlinux-kmod-${TAG}-x86_64/lenovolegionlinux.spec rpmbuild/SPECS
cp ${REPODIR_LLL}/deploy/build_packages/lenovolegionlinux-dkms.spec rpmbuild/SPECS/lenovolegionlinux.spec
#Change version according to tag
sed -i "s/_VERSION/${TAG}/g" rpmbuild/SPECS/lenovolegionlinux.spec

Expand All @@ -39,29 +39,29 @@ mv RPMS/x86_64/dkms-lenovolegionlinux-${TAG}-0.x86_64.rpm ${BUILD_DIR}/
#Build PYTHON RPM
cd ${BUILD_DIR}
mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
cp -r ${REPODIR_LLL}/python/legion_linux python3-lenovolegionlinux-${TAG}
mv python3-lenovolegionlinux-${TAG}/lenovolegionlinux.spec rpmbuild/SPECS
cp -r ${REPODIR_LLL}/python/legion_linux python-lenovolegionlinux-${TAG}
mv ${REPODIR_LLL}/deploy/build_packages/lenovolegionlinux.spec rpmbuild/SPECS
#Change version according to tag
sed -i "s/version = _VERSION/version = ${TAG}/g" python3-lenovolegionlinux-${TAG}/setup.cfg
sed -i "s/version = _VERSION/version = ${TAG}/g" python-lenovolegionlinux-${TAG}/setup.cfg
sed -i "s/%define version _VERSION/%define version ${TAG}/g" rpmbuild/SPECS/lenovolegionlinux.spec
sed -i "s/%define unmangled_version _VERSION/%define unmangled_version ${TAG}/g" rpmbuild/SPECS/lenovolegionlinux.spec
#
rm -r python3-lenovolegionlinux-${TAG}/legion_linux/extra && cp -r ${REPODIR_LLL}/extra python3-lenovolegionlinux-${TAG}/legion_linux/extra
tar --create --file python3-lenovolegionlinux-${TAG}.tar.gz python3-lenovolegionlinux-${TAG} && rm --recursive python3-lenovolegionlinux-${TAG}
mv python3-lenovolegionlinux-${TAG}.tar.gz rpmbuild/SOURCES
rm -r python-lenovolegionlinux-${TAG}/legion_linux/extra && cp -r ${REPODIR_LLL}/extra python-lenovolegionlinux-${TAG}/legion_linux/extra
tar --create --file python-lenovolegionlinux-${TAG}.tar.gz python-lenovolegionlinux-${TAG} && rm --recursive python-lenovolegionlinux-${TAG}
mv python-lenovolegionlinux-${TAG}.tar.gz rpmbuild/SOURCES
cd rpmbuild

#Use distrobox to build rpm on fedora
sudo rpmbuild --define "_topdir $(pwd)" -bs SPECS/lenovolegionlinux.spec
sudo rpmbuild --define "_topdir $(pwd)" --rebuild SRPMS/python3-lenovolegionlinux-${TAG}-1.src.rpm
mv RPMS/noarch/python3-lenovolegionlinux-${TAG}-1.noarch.rpm ${BUILD_DIR}/
sudo rpmbuild --define "_topdir $(pwd)" --rebuild SRPMS/python-lenovolegionlinux-${TAG}-1.src.rpm
mv RPMS/noarch/python-lenovolegionlinux-${TAG}-1.noarch.rpm ${BUILD_DIR}/

#Test Install
rpm -i ${BUILD_DIR}/python3-lenovolegionlinux-${TAG}-1.noarch.rpm
rpm -i ${BUILD_DIR}/python-lenovolegionlinux-${TAG}-1.noarch.rpm

#Move to repo
cp ${BUILD_DIR}/dkms-lenovolegionlinux-${TAG}-0.x86_64.rpm ${REPODIR}/fedora/packages
cp ${BUILD_DIR}/python3-lenovolegionlinux-${TAG}-1.noarch.rpm ${REPODIR}/fedora/packages
cp ${BUILD_DIR}/python-lenovolegionlinux-${TAG}-1.noarch.rpm ${REPODIR}/fedora/packages

#create repo file
echo "[LLL-pkg-repo]
Expand Down
21 changes: 11 additions & 10 deletions subprojects/build_rpm_darkdetect.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
REPODIR="${DIR}/.."
REPODIR_LLL="${REPODIR}/subprojects/LenovoLegionLinux"
BUILD_DIR=/tmp/darkdetect_rpm

set -ex
Expand All @@ -20,29 +21,29 @@ mkdir -p "${BUILD_DIR}"

## BUILD PYTHON RPM
#Setup BUILD_DIR
cp --recursive ${REPODIR}/subprojects/darkdetect ${BUILD_DIR}/python3-darkdetect-${TAG}
cp --recursive ${REPODIR}/subprojects/{setup.cfg,setup.py,darkdetect.spec} ${BUILD_DIR}/python3-darkdetect-${TAG}
cp --recursive ${REPODIR}/subprojects/darkdetect ${BUILD_DIR}/python-darkdetect-${TAG}
cp --recursive ${REPODIR}/subprojects/{setup.cfg,setup.py,darkdetect.spec} ${BUILD_DIR}/python-darkdetect-${TAG}

#Create rpm
cd ${BUILD_DIR}
mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
mv python3-darkdetect-${TAG}/darkdetect.spec rpmbuild/SPECS
mv python-darkdetect-${TAG}/darkdetect.spec rpmbuild/SPECS
#Change version according to tag
sed -i "s/version = _VERSION/version = ${TAG}/g" python3-darkdetect-${TAG}/setup.cfg
sed -i "s/version = _VERSION/version = ${TAG}/g" python-darkdetect-${TAG}/setup.cfg
sed -i "s/%define version _VERSION/%define version ${TAG}/g" rpmbuild/SPECS/darkdetect.spec
sed -i "s/%define unmangled_version _VERSION/%define unmangled_version ${TAG}/g" rpmbuild/SPECS/darkdetect.spec
#
tar --create --file python3-darkdetect-${TAG}.tar.gz python3-darkdetect-${TAG} && rm --recursive python3-darkdetect-${TAG}
mv python3-darkdetect-${TAG}.tar.gz rpmbuild/SOURCES
tar --create --file python-darkdetect-${TAG}.tar.gz python-darkdetect-${TAG} && rm --recursive python-darkdetect-${TAG}
mv python-darkdetect-${TAG}.tar.gz rpmbuild/SOURCES
cd rpmbuild

#Use distrobox to build rpm on fedora
sudo rpmbuild --define "_topdir $(pwd)" -bs SPECS/darkdetect.spec
sudo rpmbuild --define "_topdir $(pwd)" --rebuild SRPMS/python3-darkdetect-${TAG}-1.src.rpm
mv RPMS/noarch/python3-darkdetect-${TAG}-1.noarch.rpm ${BUILD_DIR}/
sudo rpmbuild --define "_topdir $(pwd)" --rebuild SRPMS/python-darkdetect-${TAG}-1.src.rpm
mv RPMS/noarch/python-darkdetect-${TAG}-1.noarch.rpm ${BUILD_DIR}/

#Test Install
rpm -i ${BUILD_DIR}/python3-darkdetect-${TAG}-1.noarch.rpm
rpm -i ${BUILD_DIR}/python-darkdetect-${TAG}-1.noarch.rpm

#Move to repo
cp ${BUILD_DIR}/python3-darkdetect-${TAG}-1.noarch.rpm ${REPODIR}/fedora/packages
cp ${BUILD_DIR}/python-darkdetect-${TAG}-1.noarch.rpm ${REPODIR}/fedora/packages
53 changes: 14 additions & 39 deletions subprojects/darkdetect.spec
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
%global srcname darkdetect
%define name python3-darkdetect
%define version _VERSION
%define unmangled_version _VERSION
%define release 1

Summary: Detect OS Dark Mode from Python
Name: %{name}
Name: python-darkdetect
Version: %{version}
Release: %{release}
Source0: %{name}-%{unmangled_version}.tar.gz
Release: 1
Source0: %{name}-%{version}.tar.gz
License: BSD-3-Clause
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: albertosottile <Alberto Sottile <asottile@gmail.com>>
Packager: Gonçalo Negrier Duarte <gonegrier.duarte@gamil.com>
Url: https://github.com/albertosottile/darkdetect

BuildRequires: python3-devel
BuildRequires: python3-wheel
Vendor: Alberto Sottile <asottile@gmail.com>
Packager: Gonçalo Negrier Duarte <gonegrier.duarte@gamil.com>
Url: https://github.com/albertosottile/darkdetect

%description
# Darkdetect
# Darkdetect (UNOFFICIAL RPM)

This package allows to detect if the user is using Dark Mode on:

Expand Down Expand Up @@ -88,40 +84,19 @@ pip install darkdetect[macos-listener]


%prep
%autosetup -n %{name}-%{unmangled_version} -n %{name}-%{unmangled_version}
%autosetup -n %{name}-%{version} -n %{name}-%{version}

%build
unset RPM_BUILD_ROOT
python3 setup.py bdist_wheel
%{python3} setup.py bdist_wheel

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
mkdir %{buildroot}
mkdir %{buildroot}/usr
cd "%{_builddir}/%{name}-%{version}"
python3 -m installer --destdir="%{buildroot}" dist/*.whl

%files -n python3-%{srcname}
/usr/lib/python3.11/site-packages/darkdetect/__init__.py
/usr/lib/python3.11/site-packages/darkdetect/__main__.py
/usr/lib/python3.11/site-packages/darkdetect/_dummy.py
/usr/lib/python3.11/site-packages/darkdetect/_linux_detect.py
/usr/lib/python3.11/site-packages/darkdetect/_mac_detect.py
/usr/lib/python3.11/site-packages/darkdetect/_windows_detect.py
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/_linux_detect.cpython-311.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/__init__.cpython-311.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/__main__.cpython-311.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/_mac_detect.cpython-311.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/_dummy.cpython-311.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/_windows_detect.cpython-311.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/__init__.cpython-311.opt-1.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/__main__.cpython-311.opt-1.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/_dummy.cpython-311.opt-1.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/_linux_detect.cpython-311.opt-1.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/_mac_detect.cpython-311.opt-1.pyc
/usr/lib/python3.11/site-packages/darkdetect/__pycache__/_windows_detect.cpython-311.opt-1.pyc
/usr/lib/python3.11/site-packages/darkdetect-%{version}.dist-info/LICENSE
/usr/lib/python3.11/site-packages/darkdetect-%{version}.dist-info/METADATA
/usr/lib/python3.11/site-packages/darkdetect-%{version}.dist-info/RECORD
/usr/lib/python3.11/site-packages/darkdetect-%{version}.dist-info/WHEEL
/usr/lib/python3.11/site-packages/darkdetect-%{version}.dist-info/top_level.txt
%{python3} -m installer --destdir="%{buildroot}" dist/*.whl

%files -n python-%{srcname}
%{python3_sitelib}/darkdetect/*
%{python3_sitelib}/darkdetect-%{version}.dist-info/*

0 comments on commit e9c0838

Please sign in to comment.