From 7937158c01c71774eb5872f742a9d9c771df5b79 Mon Sep 17 00:00:00 2001 From: jbj Date: Fri, 9 Aug 2002 22:25:04 +0000 Subject: - python: add (optional) ts.check() callback. CVS patchset: 5619 CVS date: 2002/08/09 22:25:04 --- CHANGES | 1 + lib/depends.c | 2 +- lib/rpmts.c | 15 +++++++- lib/rpmts.h | 22 +++++++++-- po/cs.po | 4 +- po/da.po | 4 +- po/de.po | 4 +- po/en_RN.po | 4 +- po/es.po | 4 +- po/eu_ES.po | 4 +- po/fi.po | 4 +- po/fr.po | 4 +- po/gl.po | 4 +- po/hu.po | 4 +- po/id.po | 4 +- po/is.po | 4 +- po/it.po | 4 +- po/ja.po | 4 +- po/ko.po | 4 +- po/no.po | 4 +- po/pl.po | 4 +- po/pt.po | 4 +- po/pt_BR.po | 4 +- po/ro.po | 4 +- po/rpm.pot | 4 +- po/ru.po | 4 +- po/sk.po | 4 +- po/sl.po | 6 +-- po/sr.po | 4 +- po/sv.po | 4 +- po/tr.po | 4 +- po/uk.po | 4 +- po/wa.po | 4 +- po/zh.po | 4 +- po/zh_CN.GB2312.po | 4 +- python/rpmts-py.c | 105 ++++++++++++++++++++++++++++++++++++++++++++--------- rpm.spec.in | 3 +- 37 files changed, 186 insertions(+), 88 deletions(-) diff --git a/CHANGES b/CHANGES index 3fe9776d5..d0a16f88e 100644 --- a/CHANGES +++ b/CHANGES @@ -229,6 +229,7 @@ - fix: src.rpm installs need fd pos at payload. - python: add return codes for rollbacks and fooDB methods. - avoid generating fingerprints for locale/zoneinfo sub-directories. + - python: add (optional) ts.check() callback. 4.0.3 -> 4.0.4: - solaris: translate i86pc to i386 (#57182). diff --git a/lib/depends.c b/lib/depends.c index 70c9db24e..8c6c0e3f7 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -502,7 +502,7 @@ static int unsatisfiedDepend(rpmts ts, rpmds dep, int adding) /*@-boundsread@*/ if (adding && !(rpmtsFlags(ts) & RPMTRANS_FLAG_NOSUGGEST)) { if (ts->solve != NULL) - xx = (*ts->solve) (ts, dep); + xx = (*ts->solve) (ts, dep, ts->solveData); } /*@=boundsread@*/ diff --git a/lib/rpmts.c b/lib/rpmts.c index f8cf0ec3a..253335550 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -341,7 +341,7 @@ static int sugcmp(const void * a, const void * b) } /*@-bounds@*/ -int rpmtsSolve(rpmts ts, rpmds ds) +int rpmtsSolve(rpmts ts, rpmds ds, /*@unused@*/ const void * data) { const char * errstr; const char * str; @@ -464,6 +464,18 @@ int rpmtsAvailable(rpmts ts, const rpmds ds) /*@=nullstate@*/ } +int rpmtsSetSolveCallback(rpmts ts, + int (*solve) (rpmts ts, rpmds key, const void * data), + const void * solveData) +{ + int rc = 0; + if (ts) { + ts->solve = solve; + ts->solveData = solveData; + } + return rc; +} + rpmps rpmtsProblems(rpmts ts) { rpmps ps = NULL; @@ -1043,6 +1055,7 @@ rpmts rpmtsCreate(void) ts->dsi = NULL; ts->solve = rpmtsSolve; + ts->solveData = NULL; ts->nsuggests = 0; ts->suggests = NULL; ts->sdb = NULL; diff --git a/lib/rpmts.h b/lib/rpmts.h index 81ec9f4b1..4a64a8c21 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -112,8 +112,9 @@ struct rpmts_s { rpmdb sdb; /*!< Solve database handle. */ int sdbmode; /*!< Solve database open mode. */ /*@null@*/ - int (*solve) (rpmts ts, const rpmds key) + int (*solve) (rpmts ts, rpmds key, const void * data) /*@modifies ts @*/; /*!< Search for NEVRA key. */ + const void * solveData; /*!< Solve callback data */ int nsuggests; /*!< No. of depCheck suggestions. */ /*@only@*/ /*@null@*/ const void ** suggests; /*!< Possible depCheck suggestions. */ @@ -370,13 +371,14 @@ int rpmtsOpenSDB(rpmts ts, int dbmode) /*@=exportlocal@*/ /** - * Attempt to solve a needed dependency using the solve database.. + * Attempt to solve a needed dependency using the solve database. * @param ts transaction set * @param ds dependency set - * @return 0 if resolved (and added to ts), 1 not found + * @param data opaque data associated with callback + * @return 0 if resolved, 1 not found */ /*@-exportlocal@*/ -int rpmtsSolve(rpmts ts, rpmds ds) +int rpmtsSolve(rpmts ts, rpmds ds, const void * data) /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/; /*@=exportlocal@*/ @@ -393,6 +395,18 @@ int rpmtsAvailable(rpmts ts, const rpmds ds) /*@globals fileSystem @*/ /*@modifies ts, fileSystem @*/; +/** + * Set dependency solver callback. + * @param ts transaction set + * @param (*solve) dependency solver callback + * @param solveData dependency solver callback data (opaque) + * @return 0 on success + */ +int rpmtsSetSolveCallback(rpmts ts, + int (*solve) (rpmts ts, rpmds ds, const void * data), + const void * solveData) + /*@modifies ts @*/; + /** * Return current transaction set problems. * @param ts transaction set diff --git a/po/cs.po b/po/cs.po index eda7cf8e5..11cda61dc 100644 --- a/po/cs.po +++ b/po/cs.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2001-07-24 10:02+0100\n" "Last-Translator: Milan Kerslager \n" "Language-Team: Czech \n" @@ -2811,7 +2811,7 @@ msgid "cannot open Solve database in %s\n" msgstr "nemohu otevøít RPM databázi v %s\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "získávám seznam pøipojených systémù souborù\n" diff --git a/po/da.po b/po/da.po index 74afd9ddd..5414aebc2 100644 --- a/po/da.po +++ b/po/da.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2001-04-05 23:03GMT\n" "Last-Translator: Claus Hindsgaul \n" "Language-Team: Danish \n" @@ -2828,7 +2828,7 @@ msgid "cannot open Solve database in %s\n" msgstr "kan ikke åbne rpm-database i %s\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "henter liste over monterede filsystemer\n" diff --git a/po/de.po b/po/de.po index 68df25394..5046536e4 100644 --- a/po/de.po +++ b/po/de.po @@ -37,7 +37,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 1998-08-03 18:02+02:00\n" "Last-Translator: Karl Eichwalder \n" "Language-Team: German \n" @@ -3001,7 +3001,7 @@ msgid "cannot open Solve database in %s\n" msgstr "Fehler: kann nicht öffnen %s%s/packages.rpm\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/en_RN.po b/po/en_RN.po index 10d8e4a26..e8bb766e4 100644 --- a/po/en_RN.po +++ b/po/en_RN.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2731,7 +2731,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/es.po b/po/es.po index 10d8e4a26..e8bb766e4 100644 --- a/po/es.po +++ b/po/es.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2731,7 +2731,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/eu_ES.po b/po/eu_ES.po index 10d8e4a26..e8bb766e4 100644 --- a/po/eu_ES.po +++ b/po/eu_ES.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2731,7 +2731,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/fi.po b/po/fi.po index 3b7dd6b18..b07ff0a3d 100644 --- a/po/fi.po +++ b/po/fi.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "Last-Translator: Raimo Koski \n" "Language-Team: Finnish \n" "Content-Type: text/plain; charset=\n" @@ -2864,7 +2864,7 @@ msgid "cannot open Solve database in %s\n" msgstr "virhe: en voi avata %s%s/packages.rpm\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/fr.po b/po/fr.po index dfbc3b3bf..d093ae426 100644 --- a/po/fr.po +++ b/po/fr.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2905,7 +2905,7 @@ msgid "cannot open Solve database in %s\n" msgstr "impossible d'ouvrir: %s\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/gl.po b/po/gl.po index 3317a9147..c9dc5504a 100644 --- a/po/gl.po +++ b/po/gl.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.1\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2001-01-13 22:31+0100\n" "Last-Translator: Jesús Bravo Álvarez \n" "Language-Team: Galician \n" @@ -2726,7 +2726,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/hu.po b/po/hu.po index 10d8e4a26..e8bb766e4 100644 --- a/po/hu.po +++ b/po/hu.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2731,7 +2731,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/id.po b/po/id.po index 10d8e4a26..e8bb766e4 100644 --- a/po/id.po +++ b/po/id.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2731,7 +2731,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/is.po b/po/is.po index 6f302ea0c..ae4972649 100644 --- a/po/is.po +++ b/po/is.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2001-07-12 13:25+0000\n" "Last-Translator: Richard Allen \n" "Language-Team: is \n" @@ -2754,7 +2754,7 @@ msgid "cannot open Solve database in %s\n" msgstr "get ekki opnað pakka gagnagrunn í %s\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/it.po b/po/it.po index 10d8e4a26..e8bb766e4 100644 --- a/po/it.po +++ b/po/it.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2731,7 +2731,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/ja.po b/po/ja.po index 8fe61eeb9..35b90dff0 100644 --- a/po/ja.po +++ b/po/ja.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 1999-12-01 22:49 +JST\n" "Last-Translator: Kanda Mitsuru \n" "Language-Team: JRPM \n" @@ -2914,7 +2914,7 @@ msgid "cannot open Solve database in %s\n" msgstr "%s/packages.rpm ¤ò¥ª¡¼¥×¥ó¤Ç¤­¤Þ¤»¤ó\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "¥Þ¥¦¥ó¥È¤µ¤ì¤¿¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î¥ê¥¹¥È¤ò¼èÆÀ¤·¤Æ¤¤¤Þ¤¹\n" diff --git a/po/ko.po b/po/ko.po index aed64b266..12170fa74 100644 --- a/po/ko.po +++ b/po/ko.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.4\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2002-03-04 17:17+0900\n" "Last-Translator: Jong-Hoon Ryu \n" "Language-Team: GNU Translation project \n" @@ -2805,7 +2805,7 @@ msgid "cannot open Solve database in %s\n" msgstr "%sÀÇ rpm µ¥ÀÌÅͺ£À̽º¸¦ ¿­ ¼ö ¾ø½À´Ï´Ù\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/no.po b/po/no.po index 43707595c..bcb7b954f 100644 --- a/po/no.po +++ b/po/no.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2001-06-27 12:24+0200\n" "Last-Translator: Kjartan Maraas \n" "Language-Team: Norwegian \n" @@ -2784,7 +2784,7 @@ msgid "cannot open Solve database in %s\n" msgstr "kan ikke åpne database i %s\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "henter liste over monterte filsystemer\n" diff --git a/po/pl.po b/po/pl.po index bb7fa2feb..78501e307 100644 --- a/po/pl.po +++ b/po/pl.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 1999-05-25 17:00+0100\n" "Last-Translator: Pawe³ Dziekoñski \n" "Language-Team: Polish \n" @@ -2868,7 +2868,7 @@ msgid "cannot open Solve database in %s\n" msgstr "nie mo¿na otworzyæ %s/packages.rpm\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/pt.po b/po/pt.po index 5e216621f..eb34095c6 100644 --- a/po/pt.po +++ b/po/pt.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2002-02-14 10:51+0000\n" "Last-Translator: José Nuno Coelho Sanarra Pires \n" "Language-Team: pt \n" "Language-Team: Romanian \n" @@ -2726,7 +2726,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/rpm.pot b/po/rpm.pot index da5c72b77..70e4ad735 100644 --- a/po/rpm.pot +++ b/po/rpm.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2732,7 +2732,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/ru.po b/po/ru.po index 8df545ec7..1f6e87019 100644 --- a/po/ru.po +++ b/po/ru.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2002-04-09 16:44-0400\n" "Last-Translator: Eugene Kanter, \n" "Language-Team: Black Cat Linux Team \n" @@ -2813,7 +2813,7 @@ msgid "cannot open Solve database in %s\n" msgstr "ÎÅ×ÏÚÍÏÖÎÏ ÏÔËÒÙÔØ ÂÁÚÕ ÄÁÎÎÙÈ RPM × %s\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/sk.po b/po/sk.po index d290fbca8..864c66e1c 100644 --- a/po/sk.po +++ b/po/sk.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 1999-04-08 21:37+02:00\n" "Last-Translator: Stanislav Meduna \n" "Language-Team: Slovak \n" @@ -2864,7 +2864,7 @@ msgid "cannot open Solve database in %s\n" msgstr "nie je mo¾né otvori» %s/packages.rpm\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/sl.po b/po/sl.po index 977e3ccdd..9d99a278d 100644 --- a/po/sl.po +++ b/po/sl.po @@ -1,12 +1,12 @@ # -*- mode:po; coding:iso-latin-2; -*- Slovenian messages for Redhat pkg. mngr. # Copyright (C) 2000 Free Software Foundation, Inc. # Primo¾ Peterlin , 2000. -# $Id: sl.po,v 1.309 2002/08/08 22:21:11 jbj Exp $ +# $Id: sl.po,v 1.310 2002/08/09 22:26:04 jbj Exp $ # msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2000-10-08 19:05+0200\n" "Last-Translator: Grega Fajdiga \n" "Language-Team: Slovenian \n" @@ -2867,7 +2867,7 @@ msgid "cannot open Solve database in %s\n" msgstr "datoteke %s/packages.rpm ni mogo¾no odpreti\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "zbiranje seznama priklopljenih datoteènih sistemov.\n" diff --git a/po/sr.po b/po/sr.po index 47a03a05d..e61396565 100644 --- a/po/sr.po +++ b/po/sr.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "Content-Type: text/plain; charset=\n" "Date: 1998-05-02 21:41:47-0400\n" @@ -2855,7 +2855,7 @@ msgid "cannot open Solve database in %s\n" msgstr "gre¹ka: ne mogu da otvorim %s%s/packages.rpm\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/sv.po b/po/sv.po index 4f0e04b20..3fd99c8bf 100644 --- a/po/sv.po +++ b/po/sv.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.1\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2002-07-11 22:49+0200\n" "Last-Translator: Göran Uddeborg \n" "Language-Team: Swedish \n" @@ -2771,7 +2771,7 @@ msgid "cannot open Solve database in %s\n" msgstr "kan inte öppna paketdatabas i %s\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "hämtar lista över monterade filsystem\n" diff --git a/po/tr.po b/po/tr.po index c341b7f70..fee55e143 100644 --- a/po/tr.po +++ b/po/tr.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: 2001-07-05 08:02+300\n" "Last-Translator: Nilgun Belma Buguner \n" "Language-Team: Turkish \n" @@ -2827,7 +2827,7 @@ msgid "cannot open Solve database in %s\n" msgstr "%s dizininde rpm veritabaný açýlamýyor\n" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "baðlý dosya sistemlerinin listesi alýnýyor\n" diff --git a/po/uk.po b/po/uk.po index 10d8e4a26..e8bb766e4 100644 --- a/po/uk.po +++ b/po/uk.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2731,7 +2731,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/wa.po b/po/wa.po index 10d8e4a26..e8bb766e4 100644 --- a/po/wa.po +++ b/po/wa.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2731,7 +2731,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/zh.po b/po/zh.po index 10d8e4a26..e8bb766e4 100644 --- a/po/zh.po +++ b/po/zh.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2731,7 +2731,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/po/zh_CN.GB2312.po b/po/zh_CN.GB2312.po index 10d8e4a26..e8bb766e4 100644 --- a/po/zh_CN.GB2312.po +++ b/po/zh_CN.GB2312.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: rpm 4.0.3\n" -"POT-Creation-Date: 2002-08-08 18:03-0400\n" +"POT-Creation-Date: 2002-08-09 18:19-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2731,7 +2731,7 @@ msgid "cannot open Solve database in %s\n" msgstr "" #. Get available space on mounted file systems. -#: lib/rpmts.c:797 +#: lib/rpmts.c:809 msgid "getting list of mounted filesystems\n" msgstr "" diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 1eba25acc..9864279e3 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -12,9 +12,9 @@ #include #include +#include #include "header-py.h" -#include "rpmdb-py.h" #include "rpmds-py.h" /* XXX for rpmdsNew */ #include "rpmfi-py.h" /* XXX for rpmfiNew */ #include "rpmmi-py.h" @@ -142,6 +142,16 @@ static int _rpmts_debug = 0; * - rpm.RPMPROB_FILTER_DISKSPACE - */ +/** \ingroup python + */ +struct rpmtsCallbackType_s { + PyObject * cb; + PyObject * data; + rpmtsObject * tso; + int pythonError; + PyThreadState *_save; +}; + /** \ingroup python */ static PyObject * @@ -265,6 +275,43 @@ fprintf(stderr, "*** rpmts_AddErase(%p) ts %p\n", s, s->ts); return Py_None; } +/** \ingroup python + */ +static int +rpmts_SolveCallback(rpmts ts, rpmds ds, void * data) + /*@*/ +{ + struct rpmtsCallbackType_s * cbInfo = data; + PyObject * args, * result; + int res = 1; + +if (_rpmts_debug) +fprintf(stderr, "*** rpmts_SolveCallback(%p,%p,%p) %s\n", ts, ds, data, rpmdsDNEVR(ds)); + + if (cbInfo->tso == NULL) return res; + if (cbInfo->pythonError) return res; + if (cbInfo->cb == Py_None) return res; + + PyEval_RestoreThread(cbInfo->_save); + + args = Py_BuildValue("(Oissi)", cbInfo->tso, + rpmdsTagN(ds), rpmdsN(ds), rpmdsEVR(ds), rpmdsFlags(ds)); + result = PyEval_CallObject(cbInfo->cb, args); + Py_DECREF(args); + + if (!result) { + cbInfo->pythonError = 1; + } else { + if (PyInt_Check(result)) + res = PyInt_AsLong(result); + Py_DECREF(result); + } + + cbInfo->_save = PyEval_SaveThread(); + + return res; +} + /** \ingroup python */ static PyObject * @@ -275,20 +322,40 @@ rpmts_Check(rpmtsObject * s, PyObject * args) rpmps ps; rpmProblem p; PyObject * list, * cf; + struct rpmtsCallbackType_s cbInfo; int i; - int allSuggestions = 0; int xx; + pemset(&cbInfo, 0, sizeof(cbInfo)); + if (!PyArg_ParseTuple(args, "|O:Check", &cbInfo.cb)) + return NULL; + + if (cbInfo.cb != NULL) { + if (!PyCallable_Check(cbInfo.cb)) { + PyErr_SetString(PyExc_TypeError, "expected a callable"); + return NULL; + } + xx = rpmtsSetSolveCallback(s->ts, rpmts_SolveCallback, (void *)&cbInfo); + } + if (_rpmts_debug) -fprintf(stderr, "*** rpmts_Check(%p) ts %p\n", s, s->ts); +fprintf(stderr, "*** rpmts_Check(%p) ts %p cb %p\n", s, s->ts, cbInfo.cb); - if (!PyArg_ParseTuple(args, "|i:Check", &allSuggestions)) return NULL; + cbInfo.tso = s; + cbInfo.pythonError = 0; + cbInfo._save = PyEval_SaveThread(); - Py_BEGIN_ALLOW_THREADS - xx = rpmtsCheck(s->ts); + if (cbInfo.cb) + xx = rpmtsCheck(s->ts); ps = rpmtsProblems(s->ts); - Py_END_ALLOW_THREADS + + if (cbInfo.cb) { + xx = rpmtsSetSolveCallback(s->ts, rpmtsSolve, NULL); + } + + PyEval_RestoreThread(cbInfo._save); + if (ps) { list = PyList_New(0); @@ -830,15 +897,6 @@ fprintf(stderr, "*** rpmts_GetKeys(%p) ts %p\n", s, s->ts); return tuple; } -/** \ingroup python - */ -struct rpmtsCallbackType_s { - PyObject * cb; - PyObject * data; - int pythonError; - PyThreadState *_save; -}; - /** \ingroup python */ static void * @@ -916,19 +974,30 @@ static PyObject * rpmts_Run(rpmtsObject * s, PyObject * args) &cbInfo.data)) return NULL; + cbInfo.tso = s; cbInfo.pythonError = 0; cbInfo._save = PyEval_SaveThread(); - (void) rpmtsSetNotifyCallback(s->ts, rpmtsCallback, (void *) &cbInfo); + if (cbInfo.cb != NULL) { + if (!PyCallable_Check(cbInfo.cb)) { + PyErr_SetString(PyExc_TypeError, "expected a callable"); + return NULL; + } + (void) rpmtsSetNotifyCallback(s->ts, rpmtsCallback, (void *) &cbInfo); + } + (void) rpmtsSetFlags(s->ts, flags); if (_rpmts_debug) fprintf(stderr, "*** rpmts_Run(%p) ts %p flags %x ignore %x\n", s, s->ts, s->ts->transFlags, ignoreSet); rc = rpmtsRun(s->ts, NULL, ignoreSet); - ps = rpmtsProblems(s->ts); + if (cbInfo.cb) { + (void) rpmtsSetNotifyCallback(s->ts, NULL, NULL); + } + PyEval_RestoreThread(cbInfo._save); if (cbInfo.pythonError) { diff --git a/rpm.spec.in b/rpm.spec.in index 376b4a5e8..59309f809 100644 --- a/rpm.spec.in +++ b/rpm.spec.in @@ -517,9 +517,10 @@ fi %{__prefix}/include/popt.h %changelog -* Thu Aug 8 2002 Jeff Johnson 4.1-0.76 +* Fri Aug 9 2002 Jeff Johnson 4.1-0.76 - python: add return codes for rollbacks and fooDB methods. - avoid generating fingerprints for locale/zoneinfo sub-directories. +- python: add (optional) ts.check() callback. * Wed Aug 7 2002 Jeff Johnson 4.1-0.75 - fix: src.rpm installs need fd pos at payload. -- cgit v1.2.3