From c08d3873c361e926eb69645a18a2ba82e6e29015 Mon Sep 17 00:00:00 2001 From: graham.gower@gmail.com Date: Sun, 23 Oct 2011 19:42:50 -0400 Subject: Use a default Version and Architecture in the event that none is specified. git-svn-id: http://opkg.googlecode.com/svn/trunk@632 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358 --- diff --git a/tests/regress/issue26.py b/tests/regress/issue26.py index d7f2174..dd4ef92 100755 --- a/tests/regress/issue26.py +++ b/tests/regress/issue26.py @@ -6,12 +6,12 @@ import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() -o.add(Package="a", Version="2.0", Architecture="all") +o.add(Package="a", Version="2.0") o.write_opk() o.write_list() # older version, not in Packages list -a1 = opk.Opk(Package="a", Version="1.0", Architecture="all") +a1 = opk.Opk(Package="a", Version="1.0") a1.write() opkgcl.update() diff --git a/tests/regress/issue31.py b/tests/regress/issue31.py index ca00f67..42e51e3 100755 --- a/tests/regress/issue31.py +++ b/tests/regress/issue31.py @@ -6,8 +6,8 @@ import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Architecture="all", Depends="b") -o.add(Package="b", Version="1.0", Architecture="all", Depends="c") +o.add(Package="a", Depends="b") +o.add(Package="b", Depends="c") o.write_opk() o.write_list() diff --git a/tests/regress/issue45.py b/tests/regress/issue45.py index e1ab5f6..30735f9 100755 --- a/tests/regress/issue45.py +++ b/tests/regress/issue45.py @@ -6,8 +6,8 @@ import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Architecture="all", Depends="b") -o.add(Package="b", Version="1.0", Architecture="all") +o.add(Package="a", Depends="b") +o.add(Package="b") o.write_opk() o.write_list() diff --git a/tests/regress/issue46.py b/tests/regress/issue46.py index 814b05d..ec56941 100755 --- a/tests/regress/issue46.py +++ b/tests/regress/issue46.py @@ -6,8 +6,8 @@ import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Architecture="all", Recommends="b") -o.add(Package="b", Version="2.0", Architecture="all") +o.add(Package="a", Version="1.0", Recommends="b") +o.add(Package="b", Version="2.0") o.write_opk() o.write_list() diff --git a/tests/regress/issue50.py b/tests/regress/issue50.py index a4a18cc..19897b4 100755 --- a/tests/regress/issue50.py +++ b/tests/regress/issue50.py @@ -6,15 +6,15 @@ import opk, cfg, opkgcl opk.regress_init() open("foo", "w").close() -a1 = opk.Opk(Package="a", Version="1.0", Architecture="all") +a1 = opk.Opk(Package="a", Version="1.0") a1.write(data_files=["foo"]) opkgcl.install("a_1.0_all.opk") o = opk.OpkGroup() -a2 = opk.Opk(Package="a", Version="2.0", Architecture="all", Depends="b") +a2 = opk.Opk(Package="a", Version="2.0", Depends="b") a2.write() -b1 = opk.Opk(Package="b", Version="1.0", Architecture="all") +b1 = opk.Opk(Package="b", Version="1.0") b1.write(data_files=["foo"]) o.opk_list.append(a2) o.opk_list.append(b1) diff --git a/tests/regress/issue51.py b/tests/regress/issue51.py index 75803ed..9849dbc 100755 --- a/tests/regress/issue51.py +++ b/tests/regress/issue51.py @@ -6,7 +6,7 @@ import opk, cfg, opkgcl opk.regress_init() open("foo", "w").close() -a1 = opk.Opk(Package="a", Version="1.0", Architecture="all") +a1 = opk.Opk(Package="a") a1.write(data_files=["foo"]) os.rename("a_1.0_all.opk", "a_with_foo.opk") @@ -17,7 +17,7 @@ opkgcl.install("a_with_foo.opk") open("bar", "w").close() o = opk.OpkGroup() -a2 = opk.Opk(Package="a", Version="1.0", Architecture="all") +a2 = opk.Opk(Package="a") a2.write(data_files=["foo", "bar"]) o.opk_list.append(a2) o.write_list() @@ -49,7 +49,7 @@ if os.path.exists(foo_fullpath) or os.path.exists(bar_fullpath): # ---- o = opk.OpkGroup() -a2 = opk.Opk(Package="a", Version="1.0", Architecture="all") +a2 = opk.Opk(Package="a") a2.write() o.opk_list.append(a2) o.write_list() diff --git a/tests/regress/issue55.py b/tests/regress/issue55.py index 1a2763b..8628306 100755 --- a/tests/regress/issue55.py +++ b/tests/regress/issue55.py @@ -8,7 +8,7 @@ opk.regress_init() long_filename = 110*"a" os.symlink(long_filename, "linky") -a = opk.Opk(Package="a", Version="1.0", Architecture="all") +a = opk.Opk(Package="a") a.write(data_files=["linky"]) os.unlink("linky") opkgcl.install("a_1.0_all.opk") diff --git a/tests/regress/issue58.py b/tests/regress/issue58.py index 8635617..72a1854 100755 --- a/tests/regress/issue58.py +++ b/tests/regress/issue58.py @@ -6,9 +6,9 @@ import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Architecture="all", Recommends="b") -o.add(Package="b", Version="1.0", Architecture="all") -o.add(Package="c", Version="1.0", Architecture="all", Recommends="b") +o.add(Package="a", Recommends="b") +o.add(Package="b") +o.add(Package="c", Recommends="b") o.write_opk() o.write_list() diff --git a/tests/regress/issue72.py b/tests/regress/issue72.py index 3c71401..d0c511b 100755 --- a/tests/regress/issue72.py +++ b/tests/regress/issue72.py @@ -13,7 +13,7 @@ long_filename2 = long_dir + "/" + 110*"c" os.mkdir(long_dir) open(long_filename, "w").close() os.symlink(long_b, long_filename2) -a = opk.Opk(Package="a", Version="1.0", Architecture="all") +a = opk.Opk(Package="a") a.write(data_files=[long_dir, long_filename, long_filename2]) os.unlink(long_filename) os.unlink(long_filename2) diff --git a/tests/regress/issue79.py b/tests/regress/issue79.py index 1d427f6..30ba201 100755 --- a/tests/regress/issue79.py +++ b/tests/regress/issue79.py @@ -6,9 +6,9 @@ import opk, cfg, opkgcl opk.regress_init() o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Architecture="all", Depends="b", ) -o.add(Package="b", Version="1.0", Architecture="all") -o.add(Package="c", Version="1.0", Architecture="all", Depends="b") +o.add(Package="a", Version="1.0", Depends="b") +o.add(Package="b", Version="1.0") +o.add(Package="c", Version="1.0", Depends="b") o.write_opk() o.write_list() @@ -19,9 +19,9 @@ opkgcl.install("c") opkgcl.flag_unpacked("a") o = opk.OpkGroup() -o.add(Package="a", Version="1.0", Architecture="all", Depends="b", ) -o.add(Package="b", Version="1.0", Architecture="all") -o.add(Package="c", Version="2.0", Architecture="all") +o.add(Package="a", Version="1.0", Depends="b") +o.add(Package="b", Version="1.0") +o.add(Package="c", Version="2.0") o.write_opk() o.write_list() diff --git a/tests/regress/opk.py b/tests/regress/opk.py index 9763bd3..ebfb6ec 100644 --- a/tests/regress/opk.py +++ b/tests/regress/opk.py @@ -14,6 +14,13 @@ class Opk: if k not in self.valid_control_fields: raise Exception("Invalid control field: " "{}".format(k)) + if "Package" not in control.keys(): + print("Cannot create opk without Package name.\n") + return None + if "Architecture" not in control.keys(): + control["Architecture"] = "all" + if "Version" not in control.keys(): + control["Version"] = "1.0" self.control = control def write(self, tar_not_ar=False, data_files=None): -- cgit v0.9.1