Skip to content

Commit

Permalink
update python rpm build
Browse files Browse the repository at this point in the history
* need also to solve dkms
  • Loading branch information
MrDuartePT committed Aug 26, 2023
1 parent 3c2ceb9 commit 2342ae2
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 3 deletions.
12 changes: 9 additions & 3 deletions deploy/build_deb_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ sudo EDITOR=/bin/true dpkg-source -q --commit . p1
sudo dpkg-buildpackage -uc -us
cp ../python3-legion-linux_1.0.0-1_all.deb ${BUILD_DIR}/python3-legion-linux_1.0.0-1_amd64.deb

#Convert to RPM
#Build to RPM
cd ${BUILD_DIR}
sudo alien -r -c -v ./python3-legion-linux_1.0.0-1_amd64.deb
mv ./python3-legion-linux-1.0.0-2.noarch.rpm ./python3-legion-linux-1.0.0-1.amd64.rpm
mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
cp ${REPODIR}/deploy/lenovolegionlinux.spec rpmbuild/SPECS
cp -r ${REPODIR}/python/legion_linux lenovolegionlinux-1.0.0
tar --create --file lenovolegionlinux-1.0.0.tar.gz lenovolegionlinux-1.0.0
mv lenovolegionlinux-1.0.0.tar.gz rpmbuild/SOURCES
cd rpmbuild
rpmbuild --define "_topdir `pwd`" -bs SPECS/lenovolegionlinux-1.0.0
mv SRPMS/lenovolegionlinux-1.0.0-1.src.rpm ${BUILD_DIR}/
53 changes: 53 additions & 0 deletions deploy/lenovolegionlinux.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
%global python3_pkgversion 3.11

Name: lenovolegionlinux
Version: 1.0.0
Release: 1%{?dist}
Summary: lenovolegionlinux Python library

License: Custom License
URL: https://github.com/albertosottile/lenovolegionlinux
Source0: lenovolegionlinux-1.0.0.tar.gz

BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel

# Build dependencies needed to be specified manually
BuildRequires: python%{python3_pkgversion}-setuptools


%global _description %{expand:
Driver and tools for controlling Lenovo Legion laptops in Linux including fan control and power mode.}

%description %_description

%package -n python%{python3_pkgversion}-lenovolegionlinux
Summary: %{summary}

%description -n python%{python3_pkgversion}-lenovolegionlinux %_description


%prep
%autosetup -p1 -n lenovolegionlinux-%{version}


%build
# The macro only supported projects with setup.py
%py3_build


%install
# The macro only supported projects with setup.py
%py3_install
install -D -m 0644 %{_sourcedir}/extra/service/legion-linux.service %{_unitdir}/legion-linux.service
install -D -m 0644 %{_sourcedir}/extra/service/legion-linux.path %{_unitdir}/legion-linux.path


%check
%{pytest}


# Note that there is no %%files section for the unversioned python module
%files -n python%{python3_pkgversion}-lenovolegionlinux
%doc README.md
%license LICENSE

0 comments on commit 2342ae2

Please sign in to comment.