Advertising
- Mine
- Monday, July 9th, 2007 at 3:12:58am UTC
- #!/usr/bin/python
- import sys
- import os
- import deb822
- def get_filenames(f):
- base = os.path.dirname(f)
- if f.endswith('.dsc'):
- d = deb822.Dsc(file(f))
- elif f.endswith('.changes'):
- d = deb822.Changes(file(f))
- return [os.path.join(base, elt['name']) for elt in d['Files']] + [f]
- def get_distro(files_list):
- "Runs sed on the .diff.gz to find what pbuilder to run."
- ## Assumes that pbuilders are named in the pbuilder-sed , pbuilder-gutsy
- ## style.
- for file in files_list:
- if file.endswith('.changes'):
- changes_file = file.open(file, 'r')
- for line in changes_file.readlines():
- if line.split(';')[0].split()[-1] == True:
- return line.split(';')[0].split()[-1]
- def get_dsc(files_list):
- for file in files_list:
- if file.endswith('.dsc'):
- return file
- if len (sys.argv) < 3:
- print "See man rsync(1) for accepted Options"
- dest = sys.argv[-1]
- files = []
- for f in sys.argv[1:-1]:
- files += get_filenames(f)
- distro = get_distro(files)
- if dest.endswith('/') == False:
- rdsc = dest.split(':')[-1] + '/' + get_dsc(files)
- else:
- rdsc = dest.split(':')[-1] + get_dsc(files)
- os.execvp('rsync', ['rsync'] + files + [dest])
- os.execvp('ssh', ['ssh'] + [dest] + '": pbuilder-' + distro + 'build ' + rdsc)
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.