pactest: add note tests
This commit is contained in:
parent
2b1ca6c298
commit
1340b5336e
8 changed files with 77 additions and 0 deletions
|
@ -9,6 +9,8 @@ pacman_tests = [
|
||||||
'tests/config002.py',
|
'tests/config002.py',
|
||||||
'tests/database001.py',
|
'tests/database001.py',
|
||||||
'tests/database002.py',
|
'tests/database002.py',
|
||||||
|
'tests/database003.py',
|
||||||
|
'tests/database004.py',
|
||||||
'tests/database010.py',
|
'tests/database010.py',
|
||||||
'tests/database011.py',
|
'tests/database011.py',
|
||||||
'tests/database012.py',
|
'tests/database012.py',
|
||||||
|
@ -174,6 +176,7 @@ pacman_tests = [
|
||||||
'tests/symlink020.py',
|
'tests/symlink020.py',
|
||||||
'tests/symlink021.py',
|
'tests/symlink021.py',
|
||||||
'tests/sync-failover-404-with-body.py',
|
'tests/sync-failover-404-with-body.py',
|
||||||
|
'tests/sync-keep-note.py',
|
||||||
'tests/sync-install-assumeinstalled.py',
|
'tests/sync-install-assumeinstalled.py',
|
||||||
'tests/sync-nodepversion01.py',
|
'tests/sync-nodepversion01.py',
|
||||||
'tests/sync-nodepversion02.py',
|
'tests/sync-nodepversion02.py',
|
||||||
|
@ -181,6 +184,7 @@ pacman_tests = [
|
||||||
'tests/sync-nodepversion04.py',
|
'tests/sync-nodepversion04.py',
|
||||||
'tests/sync-nodepversion05.py',
|
'tests/sync-nodepversion05.py',
|
||||||
'tests/sync-nodepversion06.py',
|
'tests/sync-nodepversion06.py',
|
||||||
|
'tests/sync-note-targets-only.py',
|
||||||
'tests/sync-sysupgrade-print-replaced-packages.py',
|
'tests/sync-sysupgrade-print-replaced-packages.py',
|
||||||
'tests/sync-update-assumeinstalled.py',
|
'tests/sync-update-assumeinstalled.py',
|
||||||
'tests/sync-update-package-removing-required-provides.py',
|
'tests/sync-update-package-removing-required-provides.py',
|
||||||
|
|
|
@ -121,6 +121,8 @@ class pmdb(object):
|
||||||
pkg.groups = _getsection(fd)
|
pkg.groups = _getsection(fd)
|
||||||
elif line == "%URL%":
|
elif line == "%URL%":
|
||||||
pkg.url = fd.readline().strip("\n")
|
pkg.url = fd.readline().strip("\n")
|
||||||
|
elif line == "%NOTE%":
|
||||||
|
pkg.note = fd.readline().strip("\n")
|
||||||
elif line == "%LICENSE%":
|
elif line == "%LICENSE%":
|
||||||
pkg.license = _getsection(fd)
|
pkg.license = _getsection(fd)
|
||||||
elif line == "%ARCH%":
|
elif line == "%ARCH%":
|
||||||
|
@ -208,6 +210,7 @@ class pmdb(object):
|
||||||
make_section(data, "INSTALLDATE", pkg.installdate)
|
make_section(data, "INSTALLDATE", pkg.installdate)
|
||||||
make_section(data, "SIZE", pkg.size)
|
make_section(data, "SIZE", pkg.size)
|
||||||
make_section(data, "REASON", pkg.reason)
|
make_section(data, "REASON", pkg.reason)
|
||||||
|
make_section(data, "NOTE", pkg.note)
|
||||||
else:
|
else:
|
||||||
make_section(data, "FILENAME", pkg.filename())
|
make_section(data, "FILENAME", pkg.filename())
|
||||||
make_section(data, "REPLACES", pkg.replaces)
|
make_section(data, "REPLACES", pkg.replaces)
|
||||||
|
|
|
@ -34,6 +34,7 @@ class pmpkg(object):
|
||||||
self.desc = ""
|
self.desc = ""
|
||||||
self.groups = []
|
self.groups = []
|
||||||
self.url = ""
|
self.url = ""
|
||||||
|
self.note = ""
|
||||||
self.license = []
|
self.license = []
|
||||||
self.arch = ""
|
self.arch = ""
|
||||||
self.builddate = ""
|
self.builddate = ""
|
||||||
|
@ -71,6 +72,7 @@ class pmpkg(object):
|
||||||
s.append("url: %s" % self.url)
|
s.append("url: %s" % self.url)
|
||||||
s.append("files: %s" % " ".join(self.files))
|
s.append("files: %s" % " ".join(self.files))
|
||||||
s.append("reason: %d" % self.reason)
|
s.append("reason: %d" % self.reason)
|
||||||
|
s.append("note: %s" % self.note)
|
||||||
return "\n".join(s)
|
return "\n".join(s)
|
||||||
|
|
||||||
def fullname(self):
|
def fullname(self):
|
||||||
|
|
|
@ -108,6 +108,9 @@ class pmrule(object):
|
||||||
if f.startswith(value + "\t"):
|
if f.startswith(value + "\t"):
|
||||||
success = 1
|
success = 1
|
||||||
break;
|
break;
|
||||||
|
elif case == "NOTE":
|
||||||
|
if newpkg.note != value:
|
||||||
|
success = 0
|
||||||
else:
|
else:
|
||||||
tap.diag("PKG rule '%s' not found" % case)
|
tap.diag("PKG rule '%s' not found" % case)
|
||||||
success = -1
|
success = -1
|
||||||
|
|
10
test/pacman/tests/database003.py
Normal file
10
test/pacman/tests/database003.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
self.description = "-D --note :D"
|
||||||
|
|
||||||
|
lp = pmpkg("pkg")
|
||||||
|
self.addpkg2db("local", lp)
|
||||||
|
|
||||||
|
self.args = "-D pkg --note :D"
|
||||||
|
|
||||||
|
self.addrule("PACMAN_RETCODE=0")
|
||||||
|
self.addrule("PKG_EXIST=pkg")
|
||||||
|
self.addrule("PKG_NOTE=pkg|:D")
|
11
test/pacman/tests/database004.py
Normal file
11
test/pacman/tests/database004.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
self.description = "-D --rmnote"
|
||||||
|
|
||||||
|
lp = pmpkg("pkg")
|
||||||
|
lp.note = "D:"
|
||||||
|
self.addpkg2db("local", lp)
|
||||||
|
|
||||||
|
self.args = "-D pkg --rmnote"
|
||||||
|
|
||||||
|
self.addrule("PACMAN_RETCODE=0")
|
||||||
|
self.addrule("PKG_EXIST=pkg")
|
||||||
|
self.addrule("PKG_NOTE=pkg|")
|
14
test/pacman/tests/sync-keep-note.py
Normal file
14
test/pacman/tests/sync-keep-note.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
self.description = "Sync a package keeping the existing note"
|
||||||
|
|
||||||
|
sp = pmpkg("pkg")
|
||||||
|
self.addpkg2db("sync", sp)
|
||||||
|
|
||||||
|
lp = pmpkg("pkg")
|
||||||
|
lp.note = "this is a note"
|
||||||
|
self.addpkg2db("local", lp)
|
||||||
|
|
||||||
|
self.args = "-S pkg"
|
||||||
|
|
||||||
|
self.addrule("PACMAN_RETCODE=0")
|
||||||
|
self.addrule("PKG_EXIST=pkg")
|
||||||
|
self.addrule("PKG_NOTE=pkg|this is a note")
|
30
test/pacman/tests/sync-note-targets-only.py
Normal file
30
test/pacman/tests/sync-note-targets-only.py
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
self.description = "Make sure note is only set for targets"
|
||||||
|
|
||||||
|
sp1 = pmpkg("pkg1", "1.0-2")
|
||||||
|
sp1.depends = ["pkg2"]
|
||||||
|
|
||||||
|
sp2 = pmpkg("pkg2")
|
||||||
|
|
||||||
|
sp3 = pmpkg("pkg3")
|
||||||
|
sp3.depends = ["pkg4"]
|
||||||
|
|
||||||
|
sp4 = pmpkg("pkg4")
|
||||||
|
|
||||||
|
for p in sp1, sp2, sp3, sp4:
|
||||||
|
self.addpkg2db("sync", p)
|
||||||
|
|
||||||
|
lp1 = pmpkg("pkg1")
|
||||||
|
self.addpkg2db("local", lp1)
|
||||||
|
|
||||||
|
self.args = "-S pkg1 pkg3 --note aaaa"
|
||||||
|
|
||||||
|
self.addrule("PACMAN_RETCODE=0")
|
||||||
|
self.addrule("PKG_EXIST=pkg1")
|
||||||
|
self.addrule("PKG_EXIST=pkg2")
|
||||||
|
self.addrule("PKG_EXIST=pkg3")
|
||||||
|
self.addrule("PKG_EXIST=pkg4")
|
||||||
|
|
||||||
|
self.addrule("PKG_NOTE=pkg1|aaaa")
|
||||||
|
self.addrule("PKG_NOTE=pkg2|")
|
||||||
|
self.addrule("PKG_NOTE=pkg3|aaaa")
|
||||||
|
self.addrule("PKG_NOTE=pkg4|")
|
Loading…
Add table
Reference in a new issue