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