* [PATCH] buildhistory.bbclass: add pkg_pre/postinst/rm contents
@ 2012-05-27 18:29 Andreas Müller
2012-05-28 13:19 ` Paul Eggleton
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Müller @ 2012-05-27 18:29 UTC (permalink / raw)
To: openembedded-core
A use-case would have been [1].
The following tests were performed:
* image from scratch with old buildhistory contents
* image from scratch with buildhistory contents from scratch
* decrement a PR for a test recipe and check if the message
'ERROR: Package version for xy went backwards' is displayed.
[1] http://patches.openembedded.org/patch/28841/
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
meta/classes/buildhistory.bbclass | 80 +++++++++++++++++++++++--------------
1 files changed, 50 insertions(+), 30 deletions(-)
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index d2d19ff..9c49bab 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -57,6 +57,10 @@ python buildhistory_emit_pkghistory() {
self.rrecommends = ""
self.files = ""
self.filelist = ""
+ self.preinst = ""
+ self.postinst = ""
+ self.prerm = ""
+ self.postrm = ""
# Should check PACKAGES here to see if anything removed
@@ -74,18 +78,19 @@ python buildhistory_emit_pkghistory() {
try:
for line in f:
lns = line.split('=')
- name = lns[0].strip()
- value = lns[1].strip(" \t\r\n").strip('"')
- if name == "PE":
- rcpinfo.pe = value
- elif name == "PV":
- rcpinfo.pv = value
- elif name == "PR":
- rcpinfo.pr = value
- elif name == "DEPENDS":
- rcpinfo.depends = value
- elif name == "PACKAGES":
- rcpinfo.packages = value
+ if len(lns)==2:
+ name = lns[0].strip()
+ value = lns[1].strip(" \t\r\n").strip('"')
+ if name == "PE":
+ rcpinfo.pe = value
+ elif name == "PV":
+ rcpinfo.pv = value
+ elif name == "PR":
+ rcpinfo.pr = value
+ elif name == "DEPENDS":
+ rcpinfo.depends = value
+ elif name == "PACKAGES":
+ rcpinfo.packages = value
finally:
f.close()
return rcpinfo
@@ -96,24 +101,25 @@ python buildhistory_emit_pkghistory() {
try:
for line in f:
lns = line.split('=')
- name = lns[0].strip()
- value = lns[1].strip(" \t\r\n").strip('"')
- if name == "PE":
- pkginfo.pe = value
- elif name == "PV":
- pkginfo.pv = value
- elif name == "PR":
- pkginfo.pr = value
- elif name == "RDEPENDS":
- pkginfo.rdepends = value
- elif name == "RRECOMMENDS":
- pkginfo.rrecommends = value
- elif name == "PKGSIZE":
- pkginfo.size = long(value)
- elif name == "FILES":
- pkginfo.files = value
- elif name == "FILELIST":
- pkginfo.filelist = value
+ if len(lns)==2:
+ name = lns[0].strip()
+ value = lns[1].strip(" \t\r\n").strip('"')
+ if name == "PE":
+ pkginfo.pe = value
+ elif name == "PV":
+ pkginfo.pv = value
+ elif name == "PR":
+ pkginfo.pr = value
+ elif name == "RDEPENDS":
+ pkginfo.rdepends = value
+ elif name == "RRECOMMENDS":
+ pkginfo.rrecommends = value
+ elif name == "PKGSIZE":
+ pkginfo.size = long(value)
+ elif name == "FILES":
+ pkginfo.files = value
+ elif name == "FILELIST":
+ pkginfo.filelist = value
finally:
f.close()
return pkginfo
@@ -198,6 +204,12 @@ python buildhistory_emit_pkghistory() {
filelist.sort()
pkginfo.filelist = " ".join(filelist)
+ # pre/postinst/rm
+ pkginfo.preinst = getpkgvar(pkg, 'pkg_preinst') or ""
+ pkginfo.postinst = getpkgvar(pkg, 'pkg_postinst') or ""
+ pkginfo.prerm = getpkgvar(pkg, 'pkg_prerm') or ""
+ pkginfo.postrm = getpkgvar(pkg, 'pkg_postrm') or ""
+
write_pkghistory(pkginfo, d)
write_latestlink(pkg, pe, pv, pr, d)
@@ -246,6 +258,14 @@ def write_pkghistory(pkginfo, d):
f.write("PKGSIZE = %d\n" % pkginfo.size)
f.write("FILES = %s\n" % pkginfo.files)
f.write("FILELIST = %s\n" % pkginfo.filelist)
+ if pkginfo.preinst != "":
+ f.write("\npkg_preinst=\n%s\n" % pkginfo.preinst)
+ if pkginfo.postinst != "":
+ f.write("\npkg_postinst=\n%s\n" % pkginfo.postinst)
+ if pkginfo.prerm != "":
+ f.write("\npkg_prerm=\n%s\n" % pkginfo.prerm)
+ if pkginfo.postrm != "":
+ f.write("\npkg_postrm=\n%s\n" % pkginfo.postrm)
finally:
f.close()
--
1.7.4.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] buildhistory.bbclass: add pkg_pre/postinst/rm contents
2012-05-27 18:29 [PATCH] buildhistory.bbclass: add pkg_pre/postinst/rm contents Andreas Müller
@ 2012-05-28 13:19 ` Paul Eggleton
0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggleton @ 2012-05-28 13:19 UTC (permalink / raw)
To: Andreas Müller; +Cc: openembedded-core
On Sunday 27 May 2012 20:29:42 Andreas Müller wrote:
> A use-case would have been [1].
>
> The following tests were performed:
> * image from scratch with old buildhistory contents
> * image from scratch with buildhistory contents from scratch
> * decrement a PR for a test recipe and check if the message
> 'ERROR: Package version for xy went backwards' is displayed.
>
> [1] http://patches.openembedded.org/patch/28841/
FWIW I hadn't forgotten about this feature request, although I hadn't got
around to implementing it yet.
I haven't tested your patch but if I read it correctly you are writing the
scripts out underneath the "value =" lines in the package data file. My concern
with doing this is that it makes those files more difficult to parse. I had
thought that the way to do it would be to write these scripts to separate files
(e.g. latest.pkg_prerm, latest.pkg_postrm etc.). Would that be OK?
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-28 13:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-27 18:29 [PATCH] buildhistory.bbclass: add pkg_pre/postinst/rm contents Andreas Müller
2012-05-28 13:19 ` Paul Eggleton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox