Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate some open source repositories to the new ppa url #54

Closed
asottile opened this issue Dec 31, 2017 · 4 comments
Closed

Migrate some open source repositories to the new ppa url #54

asottile opened this issue Dec 31, 2017 · 4 comments
Assignees

Comments

@asottile
Copy link
Member

Mostly to avoid #53

I'm going to attempt to use https://github.com/asottile/all-repos plus some scripting to update some public github repositories to the new ppa location.

For those without context:

We moved to a shared PPA name so that contributors could be added and releases could be made separately. Updating is simple, replacing ppa:fkrull/deadsnakes with ppa:deadsnakes (or the full name ppa:deadsnakes/ppa)

@asottile asottile self-assigned this Dec 31, 2017
@asottile
Copy link
Member Author

For all-repos-sed I'll use this pattern:

-r 's#ppa:fkrull/deadsnakes($|[^-])#ppa:deadsnakes/ppa\1#g'

(to avoid replacing fkrull/deadsnakes-python2.7which we're no longer maintaining and has no replacement)

@asottile
Copy link
Member Author

asottile commented Dec 31, 2017

Here's a script I used to find some "popular" and "recently maintained" repositories referencing the old ppa name:

import argparse
import datetime
import json
import urllib.parse

import requests


def dt(s):
    return datetime.datetime.strptime(s, '%Y-%m-%dT%H:%M:%SZ')


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('query')
    parser.add_argument('--pages', default=5, type=int)
    parser.add_argument('--min-stars', default=25, type=int)
    parser.add_argument('--days', default=180, type=int)
    args = parser.parse_args()

    now = datetime.datetime.utcnow()
    days_max = datetime.timedelta(args.days)

    with open('all-repos3.json') as f:
        contents = json.load(f)
        username = contents['push_settings']['username']
        password = contents['push_settings']['api_key']

    query = urllib.parse.quote(args.query)
    url = f'https://api.github.com/search/code?q={query}&per_page=100'
    limit = args.pages

    ret = []
    kwargs = {'auth': requests.auth.HTTPBasicAuth(username, password)}
    resp = requests.get(url, **kwargs)
    resp.raise_for_status()
    ret.extend(resp.json()['items'])
    limit -= 1
    while limit > 0 and 'next' in resp.links:
        url = resp.links['next']['url']
        resp = requests.get(url, **kwargs)
        resp.raise_for_status()
        ret.extend(resp.json()['items'])
        limit -= 1

    res = set()

    for result in ret:
        resp = requests.get(result['repository']['url'], **kwargs)
        resp.raise_for_status()
        repo = resp.json()
        if (
                repo['stargazers_count'] >= args.min_stars and
                now - dt(repo['pushed_at']) <= days_max
        ):
            res.add(result['repository']['full_name'])

    import pprint; pprint.pprint(sorted(res))


if __name__ == '__main__':
    exit(main())

The query I'm using "ppa:fkrull/deadsnakes" fork:false

EDIT: Apparently fork:false doesn't actually change the results -- fortunately my after-the-fact filtering mostly eliminates forks anyway.

@asottile
Copy link
Member Author

@asottile
Copy link
Member Author

Here's the commandline I'm going to run (without --dry-run):

all-repos-sed -C all-repos3.json --dry-run -r 's#ppa:fkrull/deadsnakes($|[^-])#ppa:deadsnakes/ppa\1#g' '*' --branch-name update_deadsnakes_ppa_name --commit-msg 'Update deadsnakes ppa name

The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54'

zoli pushed a commit to limetext/lime-qml that referenced this issue Jan 1, 2018
The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54

Committed via https://github.com/asottile/all-repos
terrytangyuan pushed a commit to apache/mxnet that referenced this issue Jan 2, 2018
The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54

Committed via https://github.com/asottile/all-repos
pklampros pushed a commit to pklampros/depthmapX that referenced this issue Jan 11, 2018
The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54

Committed via https://github.com/asottile/all-repos
t0mab added a commit to unistra/pydiploy that referenced this issue Jan 12, 2018
yuxiangw pushed a commit to yuxiangw/incubator-mxnet that referenced this issue Jan 25, 2018
The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54

Committed via https://github.com/asottile/all-repos
@asottile asottile closed this as completed Feb 4, 2018
rahul003 pushed a commit to rahul003/mxnet that referenced this issue Jun 4, 2018
The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54

Committed via https://github.com/asottile/all-repos
zheng-da pushed a commit to zheng-da/incubator-mxnet that referenced this issue Jun 28, 2018
The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54

Committed via https://github.com/asottile/all-repos
JHSaunders pushed a commit to BusinessOptics/gryphon that referenced this issue Feb 13, 2019
The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54

Committed via https://github.com/asottile/all-repos
t0mab added a commit to unistra/pydiploy that referenced this issue Jun 7, 2019
pklampros pushed a commit to SpaceGroupUCL/depthmapX that referenced this issue Sep 2, 2020
The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54

Committed via https://github.com/asottile/all-repos
ChristoferDutz added a commit to ChristoferDutz/sorl-thumbnail that referenced this issue Jan 31, 2024
The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54

Committed via https://github.com/asottile/all-repos
codemaster0909219 added a commit to codemaster0909219/sorl-thumbnail that referenced this issue May 30, 2024
The deadsnakes ppa has changed names!  For more information, see deadsnakes/issues#54

Committed via https://github.com/asottile/all-repos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant