pkg_src_list_push: remove unused function
[oweals/opkg-lede.git] / tests / regress / issue46.py
1 #!/usr/bin/python3
2
3 import os
4 import opk, cfg, opkgcl
5
6 opk.regress_init()
7
8 o = opk.OpkGroup()
9 o.add(Package="a", Version="1.0", Architecture="all", Recommends="b")
10 o.add(Package="b", Version="2.0", Architecture="all")
11 o.write_opk()
12 o.write_list()
13
14 # prime the status file so 'b' is not installed as a recommendation
15 status_filename = "{}/usr/lib/opkg/status".format(cfg.offline_root)
16 f = open(status_filename, "w")
17 f.write("Package: b\n")
18 f.write("Version: 1.0\n")
19 f.write("Architecture: all\n")
20 f.write("Status: deinstall hold not-installed\n")
21 f.close()
22
23 opkgcl.update()
24
25 opkgcl.install("a")
26 if opkgcl.is_installed("b"):
27         print(__file__, ": Package 'b' installed despite "
28                                         "deinstall/hold status.")
29         exit(False)
30
31 opkgcl.remove("a")
32 opkgcl.install("a")
33 if opkgcl.is_installed("b"):
34         print(__file__, ": Package 'b' installed - deinstall/hold status "
35                                         "not retained.")
36         exit(False)
37
38 opkgcl.remove("a")
39 open(status_filename, "w").close()