summaryrefslogtreecommitdiffstats
path: root/build_tools/bin/sync_profiles.py
blob: 6bc7d8f9e229c5a70d3032f6297ef0caf6531b98 (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
#!/usr/bin/python2
import os
profiledir="/build_tools/larch8/larch0/profiles"
def getProfileList(profileType):
  profilelist=[]
  dirlist=os.listdir(profiledir)
  for dir in dirlist:
    if dir.startswith("linhes"):
      if profileType != "All":
        if dir.find(profileType) > 0:
          profilelist.append(dir)
      else:
          profilelist.append(dir)
  return profilelist
  
def SyncTesting():
  profilelist = getProfileList("testing")
  return profilelist
def SyncStable():
  profilelist = getProfileList("stable")
  return profilelist
  
def SyncALL():
  profilelist = getProfileList("All")
  return profilelist
    
options = ['Sync Testing', 'Sync Stable',  'Sync ALL']
callbacks = [SyncTesting, SyncStable, SyncALL]
for i,option in enumerate(options):
    print('%s. %s' % (i, option)) # display all options
choice = int(raw_input('your choice? '))

profilelist = callbacks[choice]() # call correspondending function
for i,option in enumerate(profilelist):
    print('%s. %s' % (i, option)) # display all options
    print ""
print "\nSync From which profile"    
choice = int(raw_input('your choice? '))
srcprofile=profilelist[choice]

for i in profilelist:
  if i == srcprofile:
    continue
  cmd = 'rsync   --exclude pacman.conf.repos  --exclude splash.xpm.gz --exclude splash.xpm --exclude vbg.jpg --exclude=pacman.conf --delete -apv %s/%s/  %s/%s/' %(profiledir,srcprofile,profiledir,i)
  print cmd
  os.system(cmd)