8
sys.path.append(os.path.join(os.path.sep+'usr','share'))
12
print 'No previous gourmet installation found.'
15
import gourmet.recipeManager as recipeManager # The *old* Gourmet
17
# We need to get our upgradeHandler from the *new* Gourmet...
18
gourmet_base_path = os.path.split(os.path.split(os.path.abspath(__file__))[0])[0]
19
sys.path.append(os.path.join(gourmet_base_path,
23
print 'just added',sys.path[-1]
27
#for mkdata in glob.glob('/home/*/.gourmet/recipes.mk'):
28
for mkdata in ['/home/tom/Projects/grm-db-experiments/src/lib/exporters/reference_setup/recipes.mk']:
29
print 'Dumping old recipe database',mkdata,'...'
30
stat = os.stat(mkdata)
31
uid,gid = stat.st_uid,stat.st_gid
32
recipeManager.dbargs['file']=mkdata
34
recipeManager.RecipeManager(**recipeManager.dbargs)
36
print 'Unable to load old database in ',mkdata
38
se = upgradeHandler.SimpleExporter()
39
ofi = os.path.join(os.path.split(mkdata)[0],
41
se.write_data(file(ofi,'w'))
45
os.chown(mkdata,uid,gid)
46
print 'Saved data in backup file ',ofi
47
print 'Data will be imported on first start of the new Gourmet by the appropriate user.'
49
if __name__ == '__main__':