Skip to content

Commit

Permalink
Migrate Fedora/RHEL packages to Fedora Copr
Browse files Browse the repository at this point in the history
* update spec files
* update github workflows
* update READMEs
* remove old fedora repo

Closes: #146
Signed-off-by: Gonçalo Duarte <[email protected]>
  • Loading branch information
MrDuartePT committed Dec 15, 2023
1 parent 8079e8a commit c984ba3
Show file tree
Hide file tree
Showing 23 changed files with 71 additions and 369 deletions.
89 changes: 1 addition & 88 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,95 +233,8 @@ jobs:
shell: bash


build-test-commit-rpms:
needs: [test-in-docker-container]
runs-on: ubuntu-latest
container:
image: fedora:39
steps:
- name: Install Dependencies in Container
run: |
sudo dnf install -y git kernel-headers kernel-devel dmidecode lm_sensors PyQt5 python3-yaml python3-pip python3-argcomplete polkit rpmdevtools rpmlint rpm rpm-sign
sudo dnf install -y dkms openssl mokutil
shell: bash

- name: Clone repo and submodules
uses: actions/checkout@v3
with:
path: ./LLL
submodules: recursive
fetch-depth: 0

- name: Check if tagged
id: check_if_tagged
run: |
cd LLL
otag=$(git tag --points-at HEAD)
echo "Tag is ${otag}"
if [ -z "$otag" ]
then
hastag=0
else
hastag=1
fi
echo "hastag=$hastag" >> $GITHUB_OUTPUT
- name: Update submodules
run: |
cd LLL
git submodule update --init
git pull --recurse-submodules
git submodule update --remote --recursive
shell: bash

- name: Build rpm darkdetect
run: |
cd LLL
./deploy/build_packages/build_rpm_darkdetect.sh
shell: bash

- name: Build rpm LenovoLegionLinux
run: |
cd LLL
./deploy/build_packages/build_rpm_LLL.sh
shell: bash

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}

- name: Copy and Generate files - Fedora
run: |
cd LLL
cd package_repo/fedora
gpg --armor --export "${{ secrets.GPG_ID }}" > ./pgp-key.public
sudo rpm --import pgp-key.public
echo "%_signature gpg
%_gpg_name Package Manager" > ~/.rpmmacros
rpm --addsign ./packages/*.rpm
cd packages
rm repodata/* || true
createrepo_c .
gpg --batch --detach-sign --armor repodata/repomd.xml
shell: bash

- name: Commit changes
if: steps.check_if_tagged.outputs.hastag == 1
run: |
cd LLL
git fetch
git add -A
git config user.name github-actions
git config user.email [email protected]
git commit -m "Add new rpms"
git pull --rebase
git push
shell: bash

test-packages:
needs: [build-test-commit-debs, build-test-commit-rpms]
needs: [build-test-commit-debs]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
[![More Reddit](https://img.shields.io/static/v1?label=Reddit&message=linuxhardware&color=blueviolet)](https://www.reddit.com/r/linuxhardware/)
</br>
[![Unbutu and Debian PPA](https://img.shields.io/badge/Ubuntu%2FDebian-LLL_PPA-orange)](https://github.com/johnfanv2/LenovoLegionLinux/tree/main/package_repo)
[![RHEL/Fedora PPA](https://img.shields.io/badge/RHEL%2FFedora-LLL_PPA-blue)](https://github.com/johnfanv2/LenovoLegionLinux/tree/main/package_repo)
[![Fedora Copr](https://img.shields.io/badge/Nobara%2FFedora-fedora_copr-blue)](https://copr.fedorainfracloud.org/coprs/mrduarte/LenovoLegionLinux/)
[![AUR](https://img.shields.io/aur/version/lenovolegionlinux-git?label=AUR%20Package)](https://aur.archlinux.org/packages/lenovolegionlinux-git)
[![AUR DKMS](https://img.shields.io/aur/version/lenovolegionlinux-dkms-git?label=AUR%20Package%20%28dkms%29)](https://aur.archlinux.org/packages/lenovolegionlinux-dkms-git)
[![GURU Overlay](https://img.shields.io/badge/Gentoo_Overlay-GURU-blueviolet)](https://gitweb.gentoo.org/repo/proj/guru.git/)
Expand Down Expand Up @@ -94,9 +94,8 @@ It allows you to control features like the fan curve, power mode, power limits,
- Debian/Ubuntu:
- Official PPA (TAG version): [here](https://github.com/johnfanv2/LenovoLegionLinux/blob/main/package_repo)
- Official PPA (GIT[^1] version): [here](https://mrduartept.github.io/LLL-pkg-repo)
- Fedora/RHEL Base Distros:
- Official PPA (TAG version): [here](https://github.com/johnfanv2/LenovoLegionLinux/blob/main/package_repo)
- Official PPA (GIT[^1] version): [here](https://mrduartept.github.io/LLL-pkg-repo)
- Fedora Base Distros:
- Official Fedora COPR (TAG version): [here]((https://copr.fedorainfracloud.org/coprs/mrduarte/LenovoLegionLinux/)
- Arch Base Distros:
- [lenovolegionlinux-git](https://aur.archlinux.org/packages/lenovolegionlinux-git)
- [lenovolegionlinux-dkms-git](https://aur.archlinux.org/packages/lenovolegionlinux-dkms-git)[^2]
Expand Down
71 changes: 0 additions & 71 deletions deploy/build_packages/build_rpm_LLL.sh

This file was deleted.

46 changes: 0 additions & 46 deletions deploy/build_packages/build_rpm_darkdetect.sh

This file was deleted.

41 changes: 22 additions & 19 deletions deploy/build_packages/darkdetect.spec
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
%global srcname darkdetect
%define version _VERSION
%global libname %{srcname}
%global pkgname %{srcname}

Summary: Detect OS Dark Mode from Python
Name: python-darkdetect
Version: %{version}
Name: python-%{pkgname}
Version: 0.8.0
Release: 1
Source0: %{name}-%{version}.tar.gz
License: BSD-3-Clause
Source0: https://github.com/albertosottile/darkdetect/archive/refs/tags/v%{version}.tar.gz
Source1: https://raw.githubusercontent.com/johnfanv2/LenovoLegionLinux/main/deploy/build_packages/setup.cfg
Source2: https://raw.githubusercontent.com/johnfanv2/LenovoLegionLinux/main/deploy/build_packages/setup.py
License: Custom
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-wheel
BuildRequires: python3-pip
Vendor: Alberto Sottile <[email protected]>
Packager: Gonçalo Negrier Duarte <[email protected]>
Url: https://github.com/albertosottile/darkdetect
Expand Down Expand Up @@ -84,19 +87,19 @@ pip install darkdetect[macos-listener]


%prep
%autosetup -n %{name}-%{version} -n %{name}-%{version}
%autosetup -p1 -n %{pkgname}-%{version}
cp %{SOURCE1} %{SOURCE2} .
sed -i "s/version = _VERSION/version = %{version}/g" setup.cfg

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

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

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

%files -n python-%{pkgname}
%doc README.md
%license LICENSE
%{python3_sitelib}/%{libname}/
%{python3_sitelib}/%{libname}-%{version}.dist-info
19 changes: 11 additions & 8 deletions deploy/build_packages/lenovolegionlinux-dkms.spec
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
# norootforbuild
%global dkms_name lenovolegionlinux
%define srcname LenovoLegionLinux
%global dkms_name %{srcname}

Name: dkms-lenovolegionlinux
License: GPL
Name: dkms-%{srcname}
License: GPL-2.0
Group: System/Kernel
Summary: LenovoLegionLinux Kernel Module Package
Version: _VERSION
Version: 0.0.9
Release: 0
Source0: %{dkms_name}-kmod-%{version}-x86_64.tar.gz
Source0: https://github.com/johnfanv2/LenovoLegionLinux/archive/refs/tags/v%{version}-prerelease.tar.gz

Requires: dkms

%description
Driver for controlling Lenovo Legion laptops including fan control and power mode.

%prep
%autosetup -p0 -n %{dkms_name}-kmod-%{version}-x86_64
%autosetup -p1 -n %{srcname}-%{version}-prerelease

%install
mkdir -p %{buildroot}%{_usrsrc}/%{dkms_name}-%{version}/
cp -fr * %{buildroot}%{_usrsrc}/%{dkms_name}-%{version}/
cp -fr kernel_module/* %{buildroot}%{_usrsrc}/%{dkms_name}-%{version}/

%post
dkms add -m %{dkms_name} -v %{version} -q || :
Expand All @@ -32,4 +33,6 @@ dkms install -m %{dkms_name} -v %{version} -q --force || :
dkms remove -m %{dkms_name} -v %{version} -q --all || :

%files
%{_usrsrc}/%{dkms_name}-%{version}
%license LICENSE
%doc README.md
%{_usrsrc}/%{dkms_name}-%{version}
Loading

0 comments on commit c984ba3

Please sign in to comment.