1 --- PackageKit-0.8.15/backends/hawkey/hif-keyring.c.orig 2013-12-05 14:36:16.000000000 +0100
2 +++ PackageKit-0.8.15/backends/hawkey/hif-keyring.c 2014-01-19 17:21:44.407060059 +0100
7 -#include <rpm/rpmlib.h>
8 +#include "rpmorg-compat.h"
9 +#include <rpm/rpmcli.h>
10 +#include <rpm/rpmio.h>
11 +#include <rpm/rpmps.h>
12 #include <rpm/rpmts.h>
13 +#include <rpm/rpmpgp.h>
15 #include "hif-keyring.h"
16 #include "hif-utils.h"
18 * hif_keyring_add_public_key:
21 -hif_keyring_add_public_key (rpmKeyring keyring,
22 +hif_keyring_add_public_key (const rpmts ts,
23 const gchar *filename,
32 - rpmPubkey pubkey = NULL;
35 /* ignore symlinks and directories */
36 @@ -56,13 +57,8 @@ hif_keyring_add_public_key (rpmKeyring k
37 if (g_file_test (filename, G_FILE_TEST_IS_SYMLINK))
41 - ret = g_file_get_contents (filename, &data, &len, error);
45 /* rip off the ASCII armor and parse it */
46 - armor = pgpParsePkts (data, &pkt, &len);
47 + armor = pgpReadPkts (filename, &pkt, &len);
51 @@ -85,7 +81,7 @@ hif_keyring_add_public_key (rpmKeyring k
55 - pubkey = rpmPubkeyNew (pkt, len);
56 +/* pubkey = rpmPubkeyNew (pkt, len);
60 @@ -94,19 +90,19 @@ hif_keyring_add_public_key (rpmKeyring k
61 "failed to parse public key for %s",
67 /* does the key exist in the keyring */
68 - dig = rpmPubkeyDig (pubkey);
69 +/* dig = rpmPubkeyDig (pubkey);
70 rc = rpmKeyringLookup (keyring, dig);
73 g_debug ("%s is already present", filename);
78 /* add to rpmdb automatically, without a prompt */
79 - rc = rpmKeyringAddKey (keyring, pubkey);
80 + rc = rpmcliImportPubkey (ts, pkt, len);
83 g_debug ("%s is already added", filename);
84 @@ -128,11 +124,6 @@ hif_keyring_add_public_key (rpmKeyring k
87 free (pkt); /* yes, free() */
89 - rpmPubkeyFree (pubkey);
96 @@ -140,7 +131,7 @@ out:
97 * hif_keyring_add_public_keys:
100 -hif_keyring_add_public_keys (rpmKeyring keyring, GError **error)
101 +hif_keyring_add_public_keys (rpmts ts, GError **error)
103 const gchar *filename;
104 const gchar *gpg_dir = "/etc/pki/rpm-gpg";
105 @@ -159,7 +150,7 @@ hif_keyring_add_public_keys (rpmKeyring
106 if (filename == NULL)
108 path_tmp = g_build_filename (gpg_dir, filename, NULL);
109 - ret = hif_keyring_add_public_key (keyring, path_tmp, error);
110 + ret = hif_keyring_add_public_key (ts, path_tmp, error);
114 @@ -172,8 +163,7 @@ out:
115 * hif_keyring_check_untrusted_file:
118 -hif_keyring_check_untrusted_file (rpmKeyring keyring,
119 - const gchar *filename,
120 +hif_keyring_check_untrusted_file (const gchar *filename,
124 @@ -216,10 +206,10 @@ hif_keyring_check_untrusted_file (rpmKey
127 /* convert and upscale */
128 - headerConvert (hdr, HEADERCONV_RETROFIT_V3);
129 + /* headerConvert (hdr, HEADERCONV_RETROFIT_V3); */
133 + td = malloc (sizeof (*td) );
137 @@ -243,7 +233,7 @@ hif_keyring_check_untrusted_file (rpmKey
140 /* make it into a digest */
141 - dig = pgpNewDig ();
142 + dig = rpmtsDig (ts);
143 rc = pgpPrtPkts (td->data, td->count, dig, 0);
146 @@ -255,7 +245,7 @@ hif_keyring_check_untrusted_file (rpmKey
149 /* does the key exist in the keyring */
150 - rc = rpmKeyringLookup (keyring, dig);
151 + rc = rpmtsFindPubkey (ts, dig);
152 if (rc != RPMRC_OK) {
153 g_set_error_literal (error,
155 @@ -269,18 +259,18 @@ hif_keyring_check_untrusted_file (rpmKey
160 + dig = pgpDigFree (dig);
168 + ts = rpmtsFree (ts);
171 + hdr = headerFree (hdr);
175 - headerFree (header);
176 + header = headerFree (header);
179 --- PackageKit-0.8.15/backends/hawkey/hif-keyring.h.orig 2013-12-05 14:36:16.000000000 +0100
180 +++ PackageKit-0.8.15/backends/hawkey/hif-keyring.h 2014-01-19 16:52:38.130466677 +0100
185 -#include <rpm/rpmkeyring.h>
186 +#include <rpm/rpmts.h>
188 -gboolean hif_keyring_add_public_key (rpmKeyring keyring,
189 +gboolean hif_keyring_add_public_key (const rpmts ts,
190 const gchar *filename,
192 -gboolean hif_keyring_add_public_keys (rpmKeyring keyring,
193 +gboolean hif_keyring_add_public_keys (rpmts ts,
195 -gboolean hif_keyring_check_untrusted_file (rpmKeyring keyring,
196 +gboolean hif_keyring_check_untrusted_file (
197 const gchar *filename,
200 --- PackageKit-0.8.15/backends/hawkey/hif-rpmts.c.orig 2013-12-12 16:08:37.000000000 +0100
201 +++ PackageKit-0.8.15/backends/hawkey/hif-rpmts.c 2014-01-19 17:35:21.507025769 +0100
206 -#include <rpm/rpmlib.h>
207 +#include <rpm/rpm46compat.h>
208 +#include <rpm/pkgio.h>
209 #include <rpm/rpmlog.h>
210 #include <rpm/rpmdb.h>
211 +#include <rpm/rpmio.h>
213 #include "hif-rpmts.h"
214 #include "hif-utils.h"
215 @@ -212,10 +214,17 @@ hif_rpmts_get_problem_str (rpmProblem pr
219 - case RPMPROB_OBSOLETES:
220 - str = g_strdup_printf ("package %s is obsoleted by %s",
223 + case RPMPROB_RDONLY:
224 + str = g_strdup_printf ("tried to install package on read-only filesystem");
226 + case RPMPROB_BADPRETRANS:
227 + str = g_strdup_printf ("bad %%pretrans?"); // unimplemented acc. to rpmps.h
229 + case RPMPROB_BADPLATFORM:
230 + str = g_strdup_printf ("package %s is for a different platform", pkg_nevr);
232 + case RPMPROB_NOREPACKAGE:
233 + str = g_strdup_printf ("re-packaged package %s is missing", pkg_nevr);
237 @@ -273,7 +282,7 @@ hif_rpmts_look_for_problems (rpmts ts, G
240 g_string_free (string, TRUE);
242 + probs = rpmpsFree (probs);
246 @@ -349,7 +358,7 @@ hif_rpmts_find_package (rpmts ts, HyPack
251 + hdr = headerLink (hdr);
253 rpmlogSetCallback (NULL, NULL);
254 if (rpm_error != NULL)
255 @@ -388,6 +397,6 @@ hif_rpmts_add_remove_pkg (rpmts ts, HyPa
260 + hdr = headerFree (hdr);
263 --- PackageKit-0.8.15/backends/hawkey/hif-state.c.orig 2013-12-12 16:07:44.000000000 +0100
264 +++ PackageKit-0.8.15/backends/hawkey/hif-state.c 2014-01-19 17:36:10.177023726 +0100
267 #include <glib-unix.h>
269 -#include <rpm/rpmsq.h>
271 #include "hif-utils.h"
272 #include "hif-state.h"
273 --- PackageKit-0.8.17/backends/hawkey/pk-backend-hawkey.c.orig 2014-03-21 12:37:15.000000000 +0100
274 +++ PackageKit-0.8.17/backends/hawkey/pk-backend-hawkey.c 2014-03-27 20:41:39.122471856 +0100
276 #include <hawkey/version.h>
277 #include <hawkey/util.h>
278 #include <librepo/librepo.h>
279 -#include <rpm/rpmlib.h>
280 +#include "rpmorg-compat.h"
281 #include <rpm/rpmdb.h>
282 +#include <rpm/rpmio.h>
283 #include <rpm/rpmlog.h>
284 +#include <rpm/rpmmacro.h>
285 #include <rpm/rpmps.h>
286 +#include <rpm/rpmrc.h>
287 #include <rpm/rpmts.h>
288 -#include <rpm/rpmkeyring.h>
291 #include "hif-goal.h"
292 @@ -79,7 +81,6 @@ typedef struct {
296 - rpmKeyring keyring;
297 GPtrArray *packages_to_download;
298 PkBitfield transaction_flags;
300 @@ -289,29 +290,32 @@ pk_backend_initialize (PkBackend *backen
301 G_CALLBACK (pk_backend_yum_repos_changed_cb), backend);
303 /* get info from RPM */
304 - rpmGetOsInfo (&value, NULL);
305 + value = rpmExpand ("%{_target_os}", NULL);
306 g_key_file_set_string (priv->config,
307 HIF_CONFIG_GROUP_NAME,
309 - rpmGetArchInfo (&value, NULL);
310 + value = rpmExpand ("%{_target_cpu}", NULL);
311 g_key_file_set_string (priv->config,
312 HIF_CONFIG_GROUP_NAME,
314 - rpmGetArchInfo (&value, NULL);
315 priv->native_arches = g_new0 (gchar *, 3);
316 priv->native_arches[0] = g_strdup (value);
317 priv->native_arches[1] = g_strdup ("noarch");
318 - if (g_strcmp0 (value, "i486") == 0 ||
319 - g_strcmp0 (value, "i586") == 0 ||
320 - g_strcmp0 (value, "i686") == 0) {
321 + if (strcmp (value, "i486") == 0 ||
322 + strcmp (value, "i586") == 0 ||
323 + strcmp (value, "i686") == 0 ||
324 + strcmp (value, "athlon") == 0 ||
325 + strcmp (value, "pentium2") == 0 ||
326 + strcmp (value, "pentium3") == 0 ||
327 + strcmp (value, "pentium4") == 0) {
329 - } else if (g_strcmp0 (value, "armv7l") == 0 ||
330 - g_strcmp0 (value, "armv6l") == 0 ||
331 - g_strcmp0 (value, "armv5tejl") == 0 ||
332 - g_strcmp0 (value, "armv5tel") == 0) {
333 + } else if (strcmp (value, "armv7l") == 0 ||
334 + strcmp (value, "armv6l") == 0 ||
335 + strcmp (value, "armv5tejl") == 0 ||
336 + strcmp (value, "armv5tel") == 0) {
338 - } else if (g_strcmp0 (value, "armv7hnl") == 0 ||
339 - g_strcmp0 (value, "armv7hl") == 0) {
340 + } else if (strcmp (value, "armv7hnl") == 0 ||
341 + strcmp (value, "armv7hl") == 0) {
344 g_key_file_set_string (priv->config,
345 @@ -458,7 +462,6 @@ pk_backend_start_job (PkBackend *backend
348 job_data->ts = rpmtsCreate ();
349 - job_data->keyring = rpmtsGetKeyring (job_data->ts, 1);
352 job_data->packages_to_download =
353 @@ -530,8 +533,7 @@ pk_backend_stop_job (PkBackend *backend,
354 g_ptr_array_unref (job_data->packages_to_download);
355 if (job_data->goal != NULL)
356 hy_goal_free (job_data->goal);
357 - rpmtsFree (job_data->ts);
358 - rpmKeyringFree (job_data->keyring);
359 + job_data->ts = rpmtsFree (job_data->ts);
360 g_object_unref (job_data->db);
362 pk_backend_job_set_user_data (job, NULL);
363 @@ -1989,7 +1991,7 @@ out:
364 * pk_backend_transaction_check_untrusted:
367 -pk_backend_transaction_check_untrusted (rpmKeyring keyring,
368 +pk_backend_transaction_check_untrusted (
372 @@ -2035,7 +2037,7 @@ pk_backend_transaction_check_untrusted (
376 - ret = hif_keyring_check_untrusted_file (keyring,
377 + ret = hif_keyring_check_untrusted_file (
381 @@ -2123,15 +2125,6 @@ hif_commit_rpmcb_type_to_string (const r
382 case RPMCALLBACK_SCRIPT_ERROR:
383 type = "script-error";
385 - case RPMCALLBACK_SCRIPT_START:
386 - type = "script-start";
388 - case RPMCALLBACK_SCRIPT_STOP:
389 - type = "script-stop";
391 - case RPMCALLBACK_INST_STOP:
392 - type = "install-stop";
397 @@ -2407,7 +2400,6 @@ hif_commit_ts_progress_cb (const void *a
398 /* don't do anything */
401 - case RPMCALLBACK_INST_STOP:
402 case RPMCALLBACK_UNINST_STOP:
405 @@ -2422,8 +2414,6 @@ hif_commit_ts_progress_cb (const void *a
406 case RPMCALLBACK_UNPACK_ERROR:
407 case RPMCALLBACK_CPIO_ERROR:
408 case RPMCALLBACK_SCRIPT_ERROR:
409 - case RPMCALLBACK_SCRIPT_START:
410 - case RPMCALLBACK_SCRIPT_STOP:
411 case RPMCALLBACK_UNKNOWN:
412 case RPMCALLBACK_REPACKAGE_PROGRESS:
413 case RPMCALLBACK_REPACKAGE_START:
414 @@ -2816,14 +2806,14 @@ pk_backend_transaction_commit (PkBackend
417 /* import all GPG keys */
418 - ret = hif_keyring_add_public_keys (job_data->keyring, error);
419 + ret = hif_keyring_add_public_keys (job_data->ts, error);
423 /* find any packages without valid GPG signatures */
424 if (pk_bitfield_contain (job_data->transaction_flags,
425 PK_TRANSACTION_FLAG_ENUM_ONLY_TRUSTED)) {
426 - ret = pk_backend_transaction_check_untrusted (job_data->keyring,
427 + ret = pk_backend_transaction_check_untrusted (
431 @@ -2843,15 +2833,7 @@ pk_backend_transaction_commit (PkBackend
432 /* setup the transaction */
433 commit = g_new0 (HifTransactionCommit, 1);
434 commit->timer = g_timer_new ();
435 - rc = rpmtsSetRootDir (job_data->ts, "/");
438 - g_set_error_literal (error,
440 - PK_ERROR_ENUM_INTERNAL_ERROR,
441 - "failed to set root");
444 + rpmtsSetRootDir (job_data->ts, "/");
445 rpmtsSetNotifyCallback (job_data->ts,
446 hif_commit_ts_progress_cb,
448 --- PackageKit-0.8.15/backends/hawkey/rpmorg-compat.h.orig 1970-01-01 01:00:00.000000000 +0100
449 +++ PackageKit-0.8.15/backends/hawkey/rpmorg-compat.h 2014-01-19 19:40:00.416711909 +0100
451 +#ifndef RPMORG_COMPAT_H
452 +#define RPMORG_COMPAT_H
454 +#include <rpm/rpm46compat.h>
456 +#define _RPMVSF_NOSIGNATURES (RPMVSF_NODSAHEADER | RPMVSF_NORSAHEADER | RPMVSF_NODSA | RPMVSF_NORSA)
457 +#define _RPMVSF_NODIGESTS (RPMVSF_NOSHA1HEADER | RPMVSF_NOMD5HEADER | RPMVSF_NOSHA1 | RPMVSF_NOMD5)
459 +static inline const char * headerGetString(Header h, int32_t tag)
461 + const char *res = NULL;
464 + if (headerGet(h, tag, &td, HEADERGET_MINMEM)) {
465 + if (rpmtdCount(&td) == 1) {
466 + res = rpmtdGetString(&td);
468 + rpmtdFreeData(&td);
473 +static inline uint64_t rpmtdGetNumber(rpmtd td)
477 + assert(td != NULL);
478 + ix = (td->ix >= 0 ? td->ix : 0);
480 + switch (td->type) {
481 + case RPM_INT64_TYPE:
482 + val = *((uint64_t *) td->data + ix);
484 + case RPM_INT32_TYPE:
485 + val = *((uint32_t *) td->data + ix);
487 + case RPM_INT16_TYPE:
488 + val = *((uint16_t *) td->data + ix);
490 + case RPM_INT8_TYPE:
491 + case RPM_CHAR_TYPE:
492 + val = *((uint8_t *) td->data + ix);
500 +static inline uint64_t headerGetNumber(Header h, int32_t tag)
505 + if (headerGet(h, tag, &td, HEADERGET_EXT)) {
506 + if (rpmtdCount(&td) == 1) {
507 + res = rpmtdGetNumber(&td);
509 + rpmtdFreeData(&td);
514 +#endif /* RPMORG_COMPAT_H */