source: branches/communities/jamendo/scripts/buildpackage.py

Last change on this file was 92, checked in by sylvinus, 10 years ago

jamendo.tgz build v1

  • Property svn:mime-type set to text/plain
File size: 1.1 KB
Line 
1import sys,os,shutil
2
3if len(sys.argv)<2:
4    print "Usage : python buildpackage.py [path_to_luci_app] [package_filename]"
5    sys.exit(0)
6
7module = sys.argv[1]
8
9if (not os.path.isdir(module)) or (not os.path.isdir(os.path.join(module,"luasrc"))):
10    print "%s is not a luci app" % module
11    sys.exit(0)
12   
13dir_sandbox = "build"
14
15def copy_to_sandbox(local_dir,remote_dir):
16    remote_dir = dir_sandbox+"/files"+remote_dir
17    os.system("mkdir -p %s" % remote_dir)
18    os.system("cp -R %s/ %s" % (local_dir,remote_dir))
19    os.system("find %s -name '*.svn' | xargs rm -rf" % (remote_dir,))
20   
21dir_luasrc = os.path.join(module,"luasrc")
22dir_htdocs = os.path.join(module,"htdocs")
23dir_root = os.path.join(module,"root")
24
25os.system("rm -rf %s && mkdir -p %s" % (dir_sandbox,dir_sandbox))
26#upgrade file
27os.system("cp %s %s/upgrade" % (os.path.join(module,"upgrade"),dir_sandbox))
28
29if os.path.isdir(dir_luasrc):
30    copy_to_sandbox(dir_luasrc,"/usr/lib/lua/luci/")
31
32if os.path.isdir(dir_htdocs):
33    copy_to_sandbox(dir_htdocs,"/www/")
34
35if os.path.isdir(dir_root):
36    copy_to_sandbox(dir_root,"/")
37
38
39os.system("cd %s && tar zcvf %s *" % (dir_sandbox,sys.argv[2]))
Note: See TracBrowser for help on using the repository browser.