• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/opkg-lede/tests/regress/issue51.py

  1 #!/usr/bin/python3
  2 
  3 import os
  4 import opk, cfg, opkgcl
  5 
  6 opk.regress_init()
  7 
  8 open("foo", "w").close()
  9 a1 = opk.Opk(Package="a", Version="1.0", Architecture="all")
 10 a1.write(data_files=["foo"])
 11 os.rename("a_1.0_all.opk", "a_with_foo.opk")
 12 
 13 opkgcl.install("a_with_foo.opk")
 14 
 15 # ----
 16 opkgcl.install("a_with_foo.opk")
 17 
 18 open("bar", "w").close()
 19 o = opk.OpkGroup()
 20 a2 = opk.Opk(Package="a", Version="1.0", Architecture="all")
 21 a2.write(data_files=["foo", "bar"])
 22 o.opk_list.append(a2)
 23 o.write_list()
 24 
 25 os.unlink("foo")
 26 os.unlink("bar")
 27 
 28 opkgcl.update()
 29 opkgcl.install("a", "--force-reinstall")
 30 
 31 foo_fullpath = "{}/foo".format(cfg.offline_root)
 32 bar_fullpath = "{}/bar".format(cfg.offline_root)
 33 
 34 if not os.path.exists(foo_fullpath) or not os.path.exists(bar_fullpath):
 35         print(__file__, ": Files foo and/or bar are missing.")
 36         exit(False)
 37 
 38 a_files = opkgcl.files("a")
 39 if not foo_fullpath in a_files or not bar_fullpath in a_files:
 40         print(__file__, ": Package 'a' does not own foo and/or bar.")
 41         exit(False)
 42 
 43 opkgcl.remove("a")
 44 
 45 if os.path.exists(foo_fullpath) or os.path.exists(bar_fullpath):
 46         print(__file__, ": Files foo and/or bar still exist "
 47                                 "after removal of package 'a'.")
 48         exit(False)
 49 
 50 # ----
 51 o = opk.OpkGroup()
 52 a2 = opk.Opk(Package="a", Version="1.0", Architecture="all")
 53 a2.write()
 54 o.opk_list.append(a2)
 55 o.write_list()
 56 
 57 
 58 opkgcl.update()
 59 
 60 opkgcl.install("a", "--force-reinstall")
 61 
 62 if os.path.exists(foo_fullpath):
 63         print(__file__, ": File 'foo' not orphaned as it should be.")
 64         exit(False)
 65 
 66 if foo_fullpath in opkgcl.files("a"):
 67         print(__file__, ": Package 'a' incorrectly owns file 'foo'.")
 68         exit(False)
 69 
 70 opkgcl.remove("a")

This page was automatically generated by LXR 0.3.1.  •  OpenWrt