Skip to content

Commit

Permalink
Update script for Fedora 39
Browse files Browse the repository at this point in the history
* also delete old rmp package
* also delete old deb packages

Signed-off-by: Gonçalo Duarte <[email protected]>
  • Loading branch information
MrDuartePT committed Dec 1, 2023
1 parent f9dae56 commit 85432b8
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 65 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ jobs:
needs: [test-in-docker-container]
runs-on: ubuntu-latest
container:
image: fedora:38
image: fedora:39
steps:
- name: Install Dependencies in Container
run: |
Expand Down
18 changes: 9 additions & 9 deletions deploy/build_packages/build_rpm_LLL.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,30 @@ 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}/python/legion_linux python3-lenovolegionlinux-${TAG}
cp -r ${REPODIR}/python/legion_linux python-lenovolegionlinux-${TAG}
cp ${REPODIR}/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}/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}/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}/package_repo/fedora/packages
cp ${BUILD_DIR}/python3-lenovolegionlinux-${TAG}-1.noarch.rpm ${REPODIR}/package_repo/fedora/packages
cp ${BUILD_DIR}/python-lenovolegionlinux-${TAG}-1.noarch.rpm ${REPODIR}/package_repo/fedora/packages

#create repo file
echo "[LLL-pkg-repo]
Expand Down
20 changes: 10 additions & 10 deletions deploy/build_packages/build_rpm_darkdetect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ mkdir -p "${BUILD_DIR}"

## BUILD PYTHON RPM
#Setup BUILD_DIR
cp --recursive ${REPODIR}/subprojects/darkdetect ${BUILD_DIR}/python3-darkdetect-${TAG}
cp --recursive ${REPODIR}/deploy/build_packages/{setup.cfg,setup.py,darkdetect.spec} ${BUILD_DIR}/python3-darkdetect-${TAG}
cp --recursive ${REPODIR}/subprojects/darkdetect ${BUILD_DIR}/python-darkdetect-${TAG}
cp --recursive ${REPODIR}/deploy/build_packages/{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}/package_repo/fedora/packages
cp ${BUILD_DIR}/python-darkdetect-${TAG}-1.noarch.rpm ${REPODIR}/package_repo/fedora/packages
19 changes: 6 additions & 13 deletions deploy/build_packages/darkdetect.spec
Original file line number Diff line number Diff line change
Expand Up @@ -88,22 +88,15 @@ pip install darkdetect[macos-listener]

%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}
%{python3_sitelib}/darkdetect/__init__.py
%{python3_sitelib}/darkdetect/__main__.py
%{python3_sitelib}/darkdetect/_dummy.py
%{python3_sitelib}/_linux_detect.py
%{python3_sitelib}/darkdetect-%{version}.dist-info/LICENSE
%{python3_sitelib}/darkdetect-%{version}.dist-info/METADATA
%{python3_sitelib}/darkdetect-%{version}.dist-info/RECORD
%{python3_sitelib}/darkdetect-%{version}.dist-info/WHEEL
%{python3_sitelib}/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/*
61 changes: 29 additions & 32 deletions deploy/build_packages/lenovolegionlinux.spec
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,32 @@ cd "%{_builddir}/%{name}-%{version}"
install -D -m 0644 %{_builddir}/%{name}-%{version}/legion_linux/extra/service/legion-linux.service %{_unitdir}/legion-linux.service
install -D -m 0644 %{_builddir}/%{name}-%{version}/legion_linux//extra/service/legion-linux.path %{_unitdir}/legion-linux.path

%files -n python3-%{srcname}
%{python3_sitelib}/legion_linux/__init__.py
%{python3_sitelib}/legion_linux/legion.py
%{python3_sitelib}/legion_linux/legion_cli.py
%{python3_sitelib}/legion_linux/legion_gui.py
%{python3_sitelib}/legion_linux/legion_logo.png
%{python3_sitelib}/legion_linux/legion_logo_dark.png
%{python3_sitelib}/legion_linux/legion_logo_light.png
%{python3_sitelib}/legion_linux-%{version}.dist-info/METADATA
%{python3_sitelib}/legion_linux-%{version}.dist-info/RECORD
%{python3_sitelib}/legion_linux-%{version}.dist-info/WHEEL
%{python3_sitelib}/legion_linux-%{version}.dist-info/entry_points.txt
%{python3_sitelib}/legion_linux-%{version}.dist-info/top_level.txt
/usr/bin/fancurve-set
/usr/bin/legion_cli
/usr/bin/legion_gui
/usr/share/applications/legion_gui.desktop
/usr/share/applications/legion_gui_user.desktop
/usr/share/legion_linux/.env
/usr/share/legion_linux/balanced-ac.yaml
/usr/share/legion_linux/balanced-battery.yaml
/usr/share/legion_linux/balanced-performance-ac.yaml
/usr/share/legion_linux/balanced-performance-battery.yaml
/usr/share/legion_linux/performance-ac.yaml
/usr/share/legion_linux/performance-battery.yaml
/usr/share/legion_linux/quiet-ac.yaml
/usr/share/legion_linux/quiet-battery.yaml
/usr/share/pixmaps/legion_logo.png
/usr/share/pixmaps/legion_logo_dark.png
/usr/share/pixmaps/legion_logo_light.png
/usr/share/polkit-1/actions/legion_cli.policy
/usr/share/polkit-1/actions/legion_gui.policy
%files -n python-%{srcname}
%{python3_sitelib}/legion_linux/*
%{python3_sitelib}/legion_linux-%{version}.dist-info/*
%{_bindir}/fancurve-set
%{_bindir}/legion_cli
%{_bindir}/legion_gui
%{_datadir}/applications/legion_gui.desktop
%{_datadir}/applications/legion_gui_user.desktop
%{_datadir}/legion_linux/.env
%{_datadir}/legion_linux/balanced-ac.yaml
%{_datadir}/legion_linux/balanced-battery.yaml
%{_datadir}/legion_linux/balanced-performance-ac.yaml
%{_datadir}/legion_linux/balanced-performance-battery.yaml
%{_datadir}/legion_linux/performance-ac.yaml
%{_datadir}/legion_linux/performance-battery.yaml
%{_datadir}/legion_linux/quiet-ac.yaml
%{_datadir}/legion_linux/quiet-battery.yaml
%{_datadir}/pixmaps/legion_logo.png
%{_datadir}/pixmaps/legion_logo_dark.png
%{_datadir}/pixmaps/legion_logo_light.png
%{_datadir}/polkit-1/actions/legion_cli.policy
%{_datadir}/polkit-1/actions/legion_gui.policy

%post
echo "Frist install?! Pls copy /usr/share/legion_linux folder to /etc/legion_linux.\n"
echo "Command: sudo cp /usr/share/legion_linux /etc/legion_linux"

%preun
echo "After uninstall you can remover /etc/legion_linux to get rid of the configuration file!"
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 85432b8

Please sign in to comment.