summaryrefslogtreecommitdiffstats
path: root/rpmbuild-remote.py
blob: 1b7b76225a1287f2d19bc86ce4e57b35b60bb5f0 (plain)
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
49
50
51
52
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from iniparse import INIConfig
import paramiko
import getopt
import sys
import os

def usage():
    print """
rpmbuild-remote : Build an RPM on a remote system

 rpmbuild-remote [options]... <files>...
 
 --help                 Print this message
 -c, --config <config>  Configuration file to use for the build.
                        Default: ~/.rpmbuild-remote
 -s, --system <system>  The remote machine to use (defined in config
                        file)
 -u, --user <username>  The username on the remote system
                        Default: current user
 -h, --host <host>      The hostname/IP of the remote system
 -p, --port <port>      The port to use on the remote system
                        Default: 21
 -d, --dest <dest>      Directory to place resulting files
                        Default: ~/rpmbuild-remote/
 -m, --mock <target>    Use mock (only applies to SRPM files)
                        Default: None
 files                  The list of files can contain either SRPM
                        files or a list starting with a spec file and
                        followed by sources for the package.
"""

def main(argv):
    try:
        opts, args = getopts.getopts(argv, "c:s:u:h:p:d:m:", ['config=', 'system=', 'user=', 'host=', 'port=', 'dest=', 'mock='])
    except getopt.GetoptError, err:
        print str(err)
        usage()
        sys.exit(1)
    home = os.path.expanduser('~')
    config = os.path.join(home, '.rpmbuild-remote')
    system = ''
    user = os.getlogin()
    host = ''
    port = 21
    dest = os.path.join(home, 'rpmbuild-remote')
    mock = ''

if __name__ == '__main__':
    main(sys.argv[1:])