10 class abs(makepkg
._make
_package
):
12 Do some stuff with ABS. Search, compile, install.
13 You know, everything that you need to be happy
15 def __init__(self
, put
, conf
):
19 def do_builddir(self
, bdir
=None, *ignore
):
20 # shouldn't this be plugin independent method?
22 if not os
.path
.isdir(bdir
):
23 if self
.put
.ask("No such directory, create it?"):
26 self
.conf
.build_dir
= bdir
28 self
.put("Permission denied.", "RED", True)
30 self
.conf
.build_dir
= bdir
31 self
.put("Build directory: ", "GREEN", False)
32 self
.put(self
.conf
.build_dir
)
34 def do_info(self
, pkgname
, *ignore
):
35 """Show PKGBUILD info"""
36 for root
, dirs
, files
in os
.walk(self
.conf
.abs_path
):
39 self
.show_pkgbuild(os
.path
.join(root
, d
, "PKGBUILD"))
42 def do_search(self
, pkgname
, *ignore
):
43 """Find PKGBUILD in ABS file tree."""
44 # TODO 2008-02-13 20:08:29
45 # Regular expression operations for searching
47 for root
, dirs
, files
in os
.walk(self
.conf
.abs_path
):
52 for line
in open(os
.path
.join(root
, d
, "PKGBUILD"), "r"):
53 if line
.startswith("pkgver"):
54 name
+= " - " + line
.split("=")[1][:-1]
55 self
.put("[abs] ", "YELLOW", False)
56 self
.put(name
.ljust(32), "WHITE", False)
61 def do_compile(self
, pkgname
, *ignore
):
62 """Run conf.compile_cmd in given path"""
63 for root
, dirs
, files
in os
.walk(self
.conf
.abs_path
):
66 path
= os
.path
.join(root
, d
)
67 build_path
= os
.path
.join(self
.conf
.build_dir
, d
)
68 if os
.path
.isdir(build_path
):
69 if self
.put
.ask("Directory exist. Delete it?"):
70 shutil
.rmtree(build_path
)
72 self
.put("Nothing to do.")
74 shutil
.copytree(path
, build_path
)
75 os
.system("cd %s && %s " % (build_path
, self
.conf
.compile_cmd
))
77 self
.put("PKGBUILD not found.")
79 def do_install(self
, pkgname
, *ignore
):
80 """Install package from conf.build_path + pkgname."""
81 build_path
= os
.path
.join(self
.conf
.build_dir
, pkgname
)
82 if not os
.path
.isdir(build_path
):
83 self
.put("No package found. Try to compile it first.")
85 self
.run_install(build_path
)