rpm-ostree/src/libpriv/rpmostree-unpacker.h
Jonathan Lebon 81c43e81fb PkgChange: add support for layering local RPMs
Allow users to directly specify an RPM file on the command-line. The
"packages_added" array of the PkgChange() method can now contain
absolute paths to RPM files.

Grow the origin format to have a new "requested-local" key. This is
similar to the "requested" key, except that the packages are always
installed from cache. The "requested-local" array values also embed the
SHA-256 of the header we expect.

There is now a new "LocalPackages" line in the status. These packages
are a subset of the "packages" element (which are printed as
"LayeredPackages") and represent the packages that are explicitly marked
for installing from cache.

Interesting design choices/notes:
  - Just as before, even with foo-1.0-1.x86_64 installed from RPM, a
    user can still request "/usr/bin/foo": it will be made dormant. As
    soon as foo stops being explicitly layered from the RPM, it will try
    to fulfill the request by going to the repos. This allows users to
    "pin" a layered package to a certain RPM, and then unpin it.
  - The strings/NEVRAs in "requested" and "requested-local" are strictly
     distinct. This allows us to be able to tell what the user means
     exactly when they do "rpm-ostree uninstall".

Closes: #657
Approved by: cgwalters
2017-03-10 18:35:11 +00:00

83 lines
3.0 KiB
C

/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
*
* Copyright (C) 2015 Colin Walters <walters@verbum.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2 of the licence or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
#pragma once
#include <ostree.h>
#include "libglnx.h"
#include <rpm/rpmlib.h>
#include <libdnf/libdnf.h>
typedef struct RpmOstreeUnpacker RpmOstreeUnpacker;
#define RPMOSTREE_TYPE_UNPACKER (rpmostree_unpacker_get_type ())
#define RPMOSTREE_UNPACKER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), RPMOSTREE_TYPE_UNPACKER, RpmOstreeUnpacker))
#define RPMOSTREE_IS_UNPACKER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), RPMOSTREE_TYPE_UNPACKER))
GType rpmostree_unpacker_get_type (void);
/**
* RpmOstreeUnpackerFlags:
* @RPMOSTREE_UNPACKER_FLAGS_OSTREE_CONVENTION: Move files to follow ostree convention
* @RPMOSTREE_UNPACKER_FLAGS_UNPRIVILEGED: Ignore file ownership and setuid modes
*/
typedef enum {
RPMOSTREE_UNPACKER_FLAGS_OSTREE_CONVENTION = (1 << 0),
RPMOSTREE_UNPACKER_FLAGS_UNPRIVILEGED = (1 << 1)
} RpmOstreeUnpackerFlags;
RpmOstreeUnpacker*
rpmostree_unpacker_new_fd (int fd,
DnfPackage *pkg,
RpmOstreeUnpackerFlags flags,
GError **error);
RpmOstreeUnpacker*
rpmostree_unpacker_new_at (int dfd,
const char *path,
DnfPackage *pkg, /* for metadata */
RpmOstreeUnpackerFlags flags,
GError **error);
gboolean
rpmostree_unpacker_read_metainfo (int fd,
Header *out_header,
gsize *out_cpio_offset,
rpmfi *out_fi,
GError **error);
const char*
rpmostree_unpacker_get_ostree_branch (RpmOstreeUnpacker *unpacker);
gboolean
rpmostree_unpacker_unpack_to_ostree (RpmOstreeUnpacker *unpacker,
OstreeRepo *repo,
OstreeSePolicy *sepolicy,
char **out_commit,
GCancellable *cancellable,
GError **error);
char *
rpmostree_unpacker_get_nevra (RpmOstreeUnpacker *self);
const char *
rpmostree_unpacker_get_header_sha256 (RpmOstreeUnpacker *self);