-
Notifications
You must be signed in to change notification settings - Fork 0
/
debpin.py
executable file
·48 lines (33 loc) · 1.06 KB
/
debpin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python2
from argparse import ArgumentParser
import os
import subprocess
from deb_create_watch import detect_hosting_service, write_watch_file
def parse_args():
ap = ArgumentParser()
ap.add_argument('url')
ap.add_argument('--pkg-name')
return ap.parse_args()
def run_cmd(*a):
print '$', ' '.join(a)
subprocess.check_call(list(a))
def create_git_repo(pkgname):
os.mkdir(pkgname)
os.chdir(pkgname)
run_cmd('git', 'init', '.')
def main():
args = parse_args()
proposed_project_name, watch = detect_hosting_service(args.url)
if not args.pkg_name:
args.pkg_name = proposed_project_name
create_git_repo(args.pkg_name)
os.mkdir('debian')
write_watch_file(watch)
run_cmd('/usr/bin/dch', '--create', "--package", args.pkg_name, '--empty',
'-v', '0.0.0-1')
run_cmd('/usr/bin/git', 'import-orig', '--uscan', '-v', '--no-interactive')
os.unlink('debian/changelog')
run_cmd('/usr/bin/debdry')
run_cmd('/usr/bin/git', 'add', 'debian')
if __name__ == '__main__':
main()