...
 
Commits (7)
......@@ -3,34 +3,94 @@
# A small utility to check for new project releases that need packaging
##
import re
import os
import pathlib
import logging
import smtplib
from email.message import EmailMessage
from github import Github
from github.GithubException import UnknownObjectException
def get_package_versions():
"""Read the spec files and extract the github repo names and versions"""
spec_versions = {}
spec_path = pathlib.Path("./")
for spec in spec_path.glob("*.spec"):
with open(spec) as f:
project = None
version = None
# this is fairly brittle, parsing the specfile would be much cleaner.
lines = f.readlines()
for line in lines:
if line.startswith("Version"):
version = line.split(":")[-1].strip()
LAST_PACKAGED = { "emersion/slurp": "1.2.0", "emersion/grim": "1.2.0", "swaywm/wlroots": "1.2.0", "swaywm/sway": "1.2.0", "ammen99/wf-recorder": "0.0.1", "bugaevc/wl-clipboard": "1.0.0" }
if line.startswith("source0"):
url = line[line.find(":")+1:].strip()
match = re.match( r'https://github.com/([^/]+)/([^/]+)/archive/*', url )
if match:
project = "{}/{}".format(match.group(1), match.group(2))
if project and version:
spec_versions[project] = version
return spec_versions
# for all projects fetch the latest version and download urls
def get_releases(api_key=None):
def get_releases(packages, api_key=None):
"""Use the github api to fetch releases for each one"""
if not api_key:
api_key = os.environ['GITHUB_API_KEY']
g = Github(api_key)
last_releases = {}
for (project, packaged_version) in LAST_PACKAGED.items():
outdated = {}
for (project, packaged_version) in packages.items():
repo = g.get_repo(project)
try:
release = repo.get_latest_release()
release_version = release.tag_name
last_releases[project] = release_version
if release.tag_name != "v"+packaged_version:
# clean up the tag name
if release_version[0] == "v" or release_version[0] == "V":
release_version = release_version[1:]
if release_version != packaged_version:
outdated[project] = (release_version, packaged_version, release.html_url)
logging.warning("project %s (release %s) doesn't match packaged version (%s)", project, release_version, packaged_version)
except UnknownObjectException as e:
logging.warning("project %s has no releases, cannot check version infomation", project)
return last_releases
return outdated
def send_email(user, outdated):
msg = EmailMessage()
mail_user = os.environ['EMAIL_NOTIFY_USER']
mail_pass = os.environ['EMAIL_NOTIFY_PASS']
text = "There were outdated packages in your set:\n"
for (project,data) in outdated.items():
text += "{}, last version: {}, package version: {}, details: {}".format(project, *data)
msg.set_content(text)
msg['Subject'] = "packages need update"
msg['From'] = mail_user+"@fossgalaxy.com"
msg['to'] = user
with smtplib.SMTP("mail.fossgalaxy.com", port=587) as s:
s.starttls()
s.login(mail_user, mail_pass)
s.send_message(msg)
s.quit()
if __name__ == '__main__':
get_releases()
packages = get_package_versions()
outdated = get_releases(packages)
if outdated:
send_email("webpigeon@fossgalaxy.com", outdated)
for (project, data) in outdated.items():
print(project, data)
Name: mako
Version: 1.4
Release: 1%{?dist}
Summary: A lightweight Wayland notification daemon
License: MIT
URL: https://wayland.emersion.fr/mako
Source0: https://github.com/emersion/mako/archive/v%{version}.tar.gz
BuildRequires: gcc
BuildRequires: meson
BuildRequires: scdoc
BuildRequires: pkgconfig(wayland-client)
BuildRequires: pkgconfig(wayland-protocols)
BuildRequires: pkgconfig(pango)
BuildRequires: pkgconfig(cairo)
BuildRequires: systemd-devel
Provides: mako = %{version}-%{release}
%description
A lightweight notification daemon for Wayland.
%prep
%autosetup
%build
%meson
%meson_build
%install
%meson_install
%files
%{_bindir}/mako
%{_bindir}/makoctl
%{_mandir}/man1/mako.1.gz
%{_mandir}/man1/makoctl.1.gz
%doc README.md
%license LICENSE
%changelog
* Tue Sep 24 2019 Joseph Walton-Rivers <webpigeon@fossgalaxy.com> - 1.4
- Bump version to 1.4
* Fri Aug 16 2019 Joseph Walton-Rivers <webpigeon@fossgalaxy.com> - 1.2-4
- use pkgconfig versions of dependencies
* Mon Jan 14 2019 Aurelien Rouene <aurelien@rouene.fr> - 1.2-3
- Removing useless service unit
* Fri Jan 11 2019 Aurelien Rouene <aurelien@rouene.fr> - 1.2-2
- Adding license, man files, service unit
* Fri Jan 11 2019 Aurelien Rouene <aurelien@rouene.fr> - 1.2-1
- RPM release of mako 1.2
......@@ -14,7 +14,7 @@ BuildRequires: pkgconfig(wayland-client)
BuildRequires: pkgconfig(wayland-protocols)
BuildRequires: pkgconfig(wayland-scanner)
% xdg-mime and /etc/mime.types are optional runtime deps
# xdg-mime and /etc/mime.types are optional runtime deps
%description
%{summary}.
......@@ -35,5 +35,6 @@ BuildRequires: pkgconfig(wayland-scanner)
%files
%{_bindir}/wl-copy
%{_bindir}/wl-paste
%{_mandir}/man1/wl-clipboard.1*
%{_mandir}/man1/wl-copy.1*
%{_mandir}/man1/wl-paste.1*
\ No newline at end of file
%{_mandir}/man1/wl-paste.1*