#!/usr/bin/python # dscp - Copy Debian source and binary packages using scp # Copyright (C) 2007 Romain Francoise # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or (at # your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. import sys, os, 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] if len(sys.argv) < 3: print "usage: dscp foo.dsc [...] user@host:" sys.exit(1) dest = sys.argv[-1] files = [] for f in sys.argv[1:-1]: files += get_filenames(f) os.execvp('scp', ['scp'] + files + [dest])