handlers/freecode: never shouldve been used in ebuilds
* https://bugs.gentoo.org/637970 Signed-off-by: Alfred Wingate <parona@protonmail.com>
This commit is contained in:
parent
c628edc26b
commit
294dcc2a9c
2
TODO
2
TODO
@ -47,6 +47,4 @@ euscan
|
|||||||
e.g.: <remote-id type="deb">
|
e.g.: <remote-id type="deb">
|
||||||
http://mysite.com/deb/dists/stable/main/binary-i386/Packages
|
http://mysite.com/deb/dists/stable/main/binary-i386/Packages
|
||||||
</remote-id>
|
</remote-id>
|
||||||
- Propose new remote-id: freecode
|
|
||||||
e.g.: <remote-id type="freecode">projectname</remote-id>
|
|
||||||
|
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
# Copyright 2011 Corentin Chary <corentin.chary@gmail.com>
|
|
||||||
# Copyright 2020-2023 src_prepare group
|
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
|
||||||
|
|
||||||
import re
|
|
||||||
import urllib.error
|
|
||||||
import urllib.parse
|
|
||||||
import urllib.request
|
|
||||||
|
|
||||||
import portage
|
|
||||||
|
|
||||||
from euscan import helpers, mangling, output
|
|
||||||
|
|
||||||
HANDLER_NAME = "freecode"
|
|
||||||
CONFIDENCE = 100
|
|
||||||
PRIORITY = 90
|
|
||||||
|
|
||||||
|
|
||||||
def can_handle(pkg, url=None):
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def scan_pkg(pkg, options):
|
|
||||||
cp, ver, rev = portage.pkgsplit(pkg.cpv)
|
|
||||||
|
|
||||||
package = options["data"].strip()
|
|
||||||
|
|
||||||
output.einfo("Using FreeCode handler: " + package)
|
|
||||||
|
|
||||||
fp = urllib.request.urlopen("http://freecode.com/projects/%s/releases" % package)
|
|
||||||
content = str(fp.read())
|
|
||||||
|
|
||||||
result = re.findall(
|
|
||||||
r'<a href="/projects/%s/releases/(\d+)">([^<]+)</a>' % package, content
|
|
||||||
)
|
|
||||||
|
|
||||||
ret = []
|
|
||||||
for release_id, up_pv in result:
|
|
||||||
pv = mangling.mangle_version(up_pv, options)
|
|
||||||
if helpers.version_filtered(cp, ver, pv):
|
|
||||||
continue
|
|
||||||
fp = urllib.request.urlopen(
|
|
||||||
f"http://freecode.com/projects/{package}/releases/{release_id}"
|
|
||||||
)
|
|
||||||
content = str(fp.read())
|
|
||||||
download_page = re.findall(r'<a href="(/urls/[^"]+)"', content)[0]
|
|
||||||
fp = urllib.request.urlopen("http://freecode.com%s" % download_page)
|
|
||||||
content = str(fp.read())
|
|
||||||
url = re.findall(
|
|
||||||
r'In case it doesn\'t, click here: <a href="([^"]+)"', content
|
|
||||||
)[0]
|
|
||||||
ret.append((url, pv, HANDLER_NAME, CONFIDENCE))
|
|
||||||
return ret
|
|
Loading…
Reference in New Issue
Block a user