Add discord-ptb

Added discord-canary
This commit is contained in:
windowsboy111
2022-10-16 21:50:01 +08:00
parent afaba869b3
commit 8f4cde0524
4 changed files with 81 additions and 2 deletions
-2
View File
@@ -39,5 +39,3 @@ f.close()
f = open(SPEC, 'w')
f.write(newspec)
f.close()
run_cmds(f"wget https://discordapp.com/api/download/canary?platform=linux&format=tar.gz")
+6
View File
@@ -0,0 +1,6 @@
project "pkg" {
rpm {
spec = "discord-ptb.spec"
sources = "."
}
}
+41
View File
@@ -0,0 +1,41 @@
import os
import re
from requests import get
def run_cmds(*cmds: str):
for cmd in cmds:
print(f"chkupdate: $ {cmd}")
if rc := os.system(cmd):
exit(f"chkupdate: Stopping because {rc=}")
SPEC = 'discord-ptb.spec'
REGEX = r'Version:(\s+)([\.\d]+)\n'
LINK = 'https://discordapp.com/api/download/ptb?platform=linux&format=tar.gz'
html = get(LINK, allow_redirects=False).text
newver = re.findall(r'https://dl-ptb\.discordapp\.net/apps/linux/([\.\d]+)/', html)
if not any(newver):
exit("chkupdate: Failed to parse html!")
newver = newver[0]
f = open(SPEC, 'r')
content = f.read()
found = re.findall(REGEX, content)
try:
assert found
curver = found[0][1]
if newver == curver:
print("chkupdate: Up to date!")
exit()
else:
print(f"chkupdate: {curver} -> {newver}")
except IndexError or AssertionError:
exit("chkupdate: Failed to read spec!")
newspec = re.sub(REGEX, f'Version:{found[0][0]}{newver}\n', content, 1)
f.close()
f = open(SPEC, 'w')
f.write(newspec)
f.close()
+34
View File
@@ -0,0 +1,34 @@
Name: discord-ptb
Version: 0.0.33
Release: %autorelease
Summary: Free Voice and Text Chat for Gamers.
URL: discord.com
Source0: https://dl-ptb.discordapp.net/apps/linux/%{version}/discord-ptb-%{version}.tar.gz
License: https://discord.com/terms
Requires: libatomic, glibc, alsa-lib, GConf2, libnotify, nspr >= 4.13, nss >= 3.27, libstdc++, libX11 >= 1.6, libXtst >= 1.2, libappindicator, libcxx, libXScrnSaver
Group: Applications/Internet
ExclusiveArch: x86_64
%description
Imagine a place where you can belong to a school club, a gaming group, or a worldwide art community. Where just you and a handful of friends can spend time together. A place that makes it easy to talk every day and hang out more often.
%prep
%autosetup -n DiscordPTB
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p %{buildroot}%{_datadir}/discord-ptb
cp -rv * %{buildroot}%{_datadir}/discord-ptb
mkdir -p %{buildroot}%{_datadir}/applications/
mkdir -p %{buildroot}%{_datadir}/pixmaps
install discord-ptb.desktop %{buildroot}%{_datadir}/applications/discord-ptb.desktop
install discord.png %{buildroot}%{_datadir}/pixmaps/discord-ptb.png
%files
%{_datadir}/discord-ptb/
%{_datadir}/applications/discord-ptb.desktop
%{_datadir}/pixmaps/discord-ptb.png
%changelog
* Sun Oct 16 2022 windowsboy111 <wboy111@outlook.com> - 0.0.33
- Initial Package.