]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blame - bin/pfa-mvpkg
- package removal works (and I'm starting to like python's flexibility)
[projects/pld-ftp-admin.git] / bin / pfa-mvpkg
CommitLineData
514f66ab
MM
1#!/usr/bin/env python
2# vi: encoding=utf-8 ts=8 sts=4 sw=4 et
3
2f949c90 4import sys, os, string, urllib, re
514f66ab 5
2f949c90
MM
6sys.path.insert(0, os.environ['HOME']+'/pld-ftp-admin/modules')
7import config
8from ftptree import Pkg, FtpTree
9
10def direxists(path):
514f66ab 11 try:
2f949c90 12 os.stat(config.value['ftp_dir']+'/'+path)
514f66ab
MM
13 except OSError, (errno, errmsg):
14 return False
15 else:
16 return True
17
514f66ab
MM
18if len(sys.argv) < 4:
19 print "Not enough parameters given"
20 print "move.py src-tree dst-tree package1 [package2...]"
21 sys.exit(1)
22
2f949c90
MM
23if not direxists(sys.argv[1]):
24 print config.value['ftp_dir']+'/'+sys.argv[1] + " does not exist"
514f66ab
MM
25 sys.exit(1)
26
2f949c90
MM
27if not direxists(sys.argv[2]):
28 print config.value['ftp_dir']+'/'+sys.argv[2] + " does not exist"
514f66ab
MM
29 sys.exit(1)
30
2f949c90
MM
31srctree=FtpTree(sys.argv[1], loadall=True)
32dsttree=FtpTree(sys.argv[2])
14085d11 33srctree.mark4moving(sys.argv[3:])
514f66ab 34
2f949c90 35srctree.movepkgs(dsttree)
514f66ab 36
This page took 0.062353 seconds and 4 git commands to generate.