1#!/usr/bin/python3
2
3import os
4import opk, cfg, opkgcl
5
6opk.regress_init()
7
8open("asdf", "w").close()
9a = opk.Opk(Package="a", Version="1.0", Architecture="all")
10a.write(data_files=["asdf"])
11b = opk.Opk(Package="b", Version="1.0", Architecture="all")
12b.write(data_files=["asdf"])
13os.unlink("asdf")
14opkgcl.install("a_1.0_all.opk")
15
16if not opkgcl.is_installed("a"):
17	print(__file__, ": Package 'a' not installed.")
18	exit(False)
19
20if not os.path.exists("{}/asdf".format(cfg.offline_root)):
21	print(__file__, ": asdf not created.")
22	exit(False)
23
24opkgcl.install("b_1.0_all.opk", "--force-overwrite")
25
26if "{}/asdf".format(cfg.offline_root) not in opkgcl.files("b"):
27	print(__file__, ": asdf not claimed by ``b''.")
28	exit(False)
29
30if "{}/asdf".format(cfg.offline_root) in opkgcl.files("a"):
31	print(__file__, ": asdf is still claimed by ``a''.")
32	exit(False)
33
34opkgcl.remove("b")
35opkgcl.remove("a")
36