Commit Graph

494 Commits

Author SHA1 Message Date
petervo
c0d15a66ad daemon: Start of work on daemon 2015-09-09 22:00:04 -04:00
Colin Walters
60ed86228f compose: Don't do container stuff if we're in a container already
This helps avoid some failures.  See:
fbdb15cd95
2015-08-24 16:16:52 -04:00
Colin Walters
07310f4f1d Merge pull request #164 from cgwalters/composetree-requires-root
compose: Require being run as root
2015-08-03 16:11:12 -04:00
Colin Walters
6daf713d8e compose: Fix "too old" error for "old" file:/// repos
Bodhi points rpm-ostree at the "gold" Fedora repo via `file:///`, and
libhif is brokenly checking the mtime on `file://` repos.

Work around that here by just ignoring cache ages, because at present
we don't actually cache really - we drop the RPMs in the tempdir.

(Long term having actual caching of the RPMs would be nice, but
 we can revisit this when we get there)

Closes #156
2015-07-24 16:28:52 -04:00
Colin Walters
5f8fdc7940 compose: Require being run as root
Someday we'll enhance RPM; see
https://github.com/rpm-software-management/rpm/issues/8

But anyways right now at least a few people have tried,
and we get all the way past downloading packages and then bomb
out when doing the actual transaction with a useless error
message.

So let's be up front about this.
2015-07-23 22:14:54 -04:00
Colin Walters
536cec3a53 compose: Error out if specified repositories aren't found
This is being friendly for configuration errors.  The failure mode
here of not finding repos and silently continuing was quite bad.
2015-07-22 16:46:09 -04:00
Micah Abbott
a5a2b90dad Sort subcommands alphabetically
This change causes the subcommands to be sorted alphabetically when
'rpm-ostree' is invoked without an argument or with '--help'.  This
matches the behavior of the 'ostree' command.
2015-07-15 14:57:39 -04:00
Colin Walters
84d2d51576 postprocess: Don't use absolute paths for helpers like dracut
It moved from `/usr/sbin` -> `/usr/bin`, which obviously broke
rpm-ostree.

No reason to hardcode absolute paths here.
2015-06-15 13:44:52 -04:00
Dusty Mabe
4d6985c92c Fix version number output on upgrade/rollback.
Resolves #153
2015-06-02 10:34:24 -04:00
Colin Walters
385303e3f8 compose: Disable yumdb by default
This API was added to libhif a while ago.  I'm adding this now because
libhif was changed recently to write the dnf copy of the yumdb, and we
didn't have code to remove it explicitly.

It's better not to write it in the first place.
2015-05-30 15:48:17 -04:00
Colin Walters
370c5e5b63 compose: Make use of hif_source_set_required()
We noticed that tree composes failed with a missing `atomic` package,
when really what happend is Fedora 22 was released and the repo
metadata moved from `development/` to `released/`.

See https://github.com/hughsie/libhif/pull/47
2015-05-26 10:43:33 -04:00
Colin Walters
b8ac0f7caf libpriv: Introduce an rpmostree_mkdtemp()
- Can also give you a file descriptor
 - Takes a constant string as input, returning a mutated string as a
   separate variable which means that one can check whether the variable
   is `NULL` to know whether or not one needs to `rm -rf` it on error
   paths.
2015-05-23 09:32:28 -04:00
Colin Walters
bfe801b77e libpriv: Fix memory leak 2015-05-23 09:32:23 -04:00
Colin Walters
1aa0e37cc9 libpriv: Teach RpmRevisionData to use new RefTs API
More code de-duplication.
2015-05-23 09:30:57 -04:00
Colin Walters
70f5b535e4 libpriv: Add RpmOstreeRefTs and API to create one from a commit
This API is intended for use by the caching framework to hold open an
rpmdb for the previous commit.
2015-05-23 09:30:57 -04:00
Colin Walters
b378386e98 Prefer rpmostree_ for internal API over _rpm_ostree
The refsack code was using the latter, and it stood out.  Now that
we're making use of explicit export markers, there's no need to uglify
internal APIs with a leading `_`.
2015-05-22 09:38:55 -04:00
Colin Walters
07871a08fd libpriv: Further centralize (commit | root) -> (sack | rpmdb) code
While `rpm-util.c` may not best describe this, it's where most
of this code is ending up.  Let's further centralize things.

We more consistently return an `RpmOstreeRefSack` instead of a
`HySack`, where the former supports refcounting and knows how to clean
up its temporary directory if it was allocated from a commit.
2015-05-22 09:32:03 -04:00
Colin Walters
3c3947564d db: Use internal rpmdb-in-tempdir API
And now, finally the actual goal is achieved.  \o/

Only one code path dealing with extracting the rpm database from an
OSTree commit.

An astute reader would notice that the `root` member of the struct was
actually only necessary as of a few commits ago.  But said astute
reader would also realize it's kind of late in the evening and not
worth rebasing it to where it would properly go.
2015-05-21 21:27:38 -04:00
Colin Walters
0756708f24 db: Create var/lib/rpm -> ../../usr/share/rpm in tempdir
hawkey and libsolv are both patched to look in `usr/share/rpm` if the
db can't be found in `/var/lib/rpm`.  However, librpm itself isn't.
One *can* override it with a macro...which is process global.  Yuck.
Needs fixing.

Anyways, we can just make a symlink.  That's a lot easier than writing
a patch for librpm and waiting a billion years to be able to use it
everywhere we care about.

This will help unify the librpm tempdir code with the hawkey tempdir
code.
2015-05-21 21:25:27 -04:00
Colin Walters
60d68f6e24 db: Make RpmRevisionData an opaque struct
This allows us to more cleanly encapsulate things.
2015-05-21 21:16:21 -04:00
Colin Walters
349dd45679 db: Remove --rpmdbdir option
As far as I can tell, this is basically a way to specify the temporary
directory.  That significantly complicates the code as it now
needs to keep track of whether or not it owns the temporary directory.

This hinders unifying this code with the hawkey query path.

Because of this, and since I'm not aware of a use case for specifying
this tempdir, let's remove it.
2015-05-21 21:16:21 -04:00
Colin Walters
bd9b9eac0a Drop root arguments from internal rpmdb API
It was only used to access the yumdb, which we don't use because:

 - It badly exacerbates the OSTree one-HTTP-request-per-object issue
 - We're assembling multiple repos on the server side, so things like
   who took the action aren't relevant.

But the reason I did this patch at the moment is because I want to
unify the code that's creating tempdirs from commits so we can feed
real files to librpm.
2015-05-21 20:34:01 -04:00
Colin Walters
5de58aae9c libpriv: Split out an internal API to get a tempdir with just the rpmdb
For a future patch, I want to add an API to get an rpmts for a commit,
instead of a hawkey Sack, because libsolv doesn't expose some
optimized queries that we can get by just going directly to librpm,
such as package file owners.
2015-05-21 20:15:08 -04:00
Alexander Larsson
79cdcd1817 Support container: true in treefile
If this is set we don't do anything special for kernel or /boot, as
such things are not needed when running in a container.
2015-05-21 12:00:20 +02:00
Colin Walters
cf89acb74c (cleanup): Move the refsack and root loading code into libpriv
We had `src/lib` having its own little private library; I wanted to
use some of it inside `src/libpriv`, so let's consistently have all
private utility code in `src/libpriv`.

Closes: https://github.com/projectatomic/rpm-ostree/pull/147
2015-05-20 20:51:42 -04:00
Matthew Barnes
03b886dae0 lib: Add rpm_ostree_package_cmp()
Equivalent to hy_package_cmp(), but works for comparing packages from
different memory pools.

This a stop gap measure in light of
https://github.com/rpm-software-management/hawkey/pull/90

If and when that pull request gets merged, then this function could at
some later point simply call hy_package_cmp().
2015-05-13 11:31:30 -04:00
Colin Walters
1c3a549ef9 postprocess: Handle Fedora rawhide kernel installation
The vmlinuz binary has moved to /usr/lib/modules, which is a change
mostly for the better, but we need to adapt.

Closes: https://github.com/projectatomic/rpm-ostree/pull/143
2015-05-12 13:51:12 -04:00
Colin Walters
f115d0276f db: Remove query parameter to diff
Matthew argues we can add this at a later time.
2015-04-23 16:30:18 -04:00
Colin Walters
8bf8d71f99 db: Remove query argument, rename to query_all()
Matthew argues that we can add this later.

https://github.com/projectatomic/rpm-ostree/pull/139#issuecomment-95327428
2015-04-23 16:30:18 -04:00
Colin Walters
c16058b66a libpriv: Move rpm/hawkey util functions into -rpm-util
`treepkgdiff` no longer describes the function of the file; as a baby
step towards unifying the db and hawkey code, move the functions into
that file.
2015-04-23 16:30:18 -04:00
Colin Walters
e414be8ae2 Move diff printing code into client
This is a step forward to deduplicating; the client tooling now calls
into the public API for diffs, rather than using the older internal
function.

Note: this patch also links the client against the public library.
2015-04-23 16:30:18 -04:00
Colin Walters
3326e13481 lib: Add diff API
This is a *third* implementation of rpm database diffs in the code,
but it is now a public introspectable shared library API.

Further commits will change the command line tools to use this, and
then after that we'll further deduplicate the `db diff` from this
code.
2015-04-23 16:30:18 -04:00
Colin Walters
28ab27caf7 db: Refactor internal helpers in preparation for diff API
This will make it easier to query two commits at once.  Note that
`RpmOstreeRefSack` now can hold a reference to a temporary directory.
2015-04-23 16:30:18 -04:00
Colin Walters
7b45f13a62 Link lib/ against libpriv/, use it to share sack loading function
On the plus side, we share some code between the library and the
binary now.  On the downside, because `librpmostreepriv.la` is a
noinst library, its code text is duplicated between the shared library
and binary, at least until we either:

 - Have the binary solely use the public shared library (like ostree does)
 - Install `librpmostreepriv.so` to e.g. `/usr/lib64/rpm-ostree/librpmostreepriv.so`
   without the headers being public
2015-04-23 16:30:17 -04:00
Colin Walters
f3600e922e libpriv: Adjust internal package diff API to be fd-relative
We presently have 3 internal code paths that are doing rpmdb
inspection.  This conversion to fd-relative for one of them is a
generic cleanup preparatory to de-duplicating.

Note this bumps libglnx to include
381ca54ee3
2015-04-23 16:30:17 -04:00
Giuseppe Scrivano
3bf7926adc postprocess: do not hardcode /etc/machine-id
The file is automatically populated by systemd when it is empty.

Apparently it doesn't work when the file is missing (as of
systemd-219-9.fc22).

https://bugzilla.redhat.com/show_bug.cgi?id=1198700

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-23 11:37:50 +02:00
Matthew Barnes
347a5003e0 status: Print any GPG signatures for deployments
In pretty mode (--pretty), print signatures for each listed deployment.

Otherwise, just print signatures for the booted deployment at the end to
preserve the tabular formatting of the deployment list.
2015-04-17 12:32:35 -04:00
Matthew Barnes
750a8889f0 upgrade: Print any GPG signatures while upgrading 2015-04-17 12:30:04 -04:00
Colin Walters
3e6f877282 lib: Add RpmOstreePackage
The `QueryResult` class ended up being too awkward; having NEVRA
strings meant for example that clients would have to parse them.  It
would be harder to present something like the current `rpm-ostree
upgrade` package diff output.

Now...I debated quite a while before doing this patch.  The thing
that's really awful about creating this library is there are *SO MANY*
layers.  rpm-ostree → libhif → hawkey → libsolv → librpm.  It's enough
to make one question whether one is actually accomplishing anything or
just contributing to a collective insanity...

Let's pretend for now it's the former.

Closes: https://github.com/projectatomic/rpm-ostree/pull/136
2015-04-16 13:26:58 -04:00
Colin Walters
be9de3a7df Merge pull request #130 from cgwalters/lib
build: Use -fvisibility=hidden and explicit exports
2015-04-14 16:28:40 -04:00
Giuseppe Scrivano
cab58e37ea compose: honor --proxy again
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-14 14:57:14 +02:00
Colin Walters
792da457db build: Use -fvisibility=hidden and explicit exports
This avoids symbol leakage.  Previously we were at risk of exporting
other random API from libpriv, as well as libglnx.
2015-04-13 21:25:05 -04:00
Colin Walters
de47c23450 doc: Add gtk-doc for new library 2015-04-13 14:39:06 -04:00
Colin Walters
8a5730525e Add a public shared library, with "rpm -qa" for commit functionality
This will help build release engineering and other types of tools;
for example, rather than parsing the output of `db diff`, one
should be able to call an API.

Initially, this adds the generic infrastructure for a public shared
library, with a new function call to do the equivalent of `rpm -qa` on
a particular OSTree commit.

Closes: https://github.com/projectatomic/rpm-ostree/issues/117
Closes: https://github.com/projectatomic/rpm-ostree/pull/124
2015-04-13 14:39:06 -04:00
Giuseppe Scrivano
7d86f72c79 do not crash when no selinux tag is present
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-13 10:43:24 +02:00
Colin Walters
f051d8f2b8 compose: Drop internal containerization for now
It breaks at least `/etc/resolv.conf` inside Docker.  The right thing
here is to run all things involving networking (librepo) as an
unprivileged process with different constraints than the rpm installs.
2015-04-10 16:48:36 -04:00
Colin Walters
a8a2049443 build: Split up src into app/ and libpriv/
We currently have an internal-only library, but the sources for it are
in the same dir as the app.  For future work on a public shared
library, we'll need a clearer source structure.

Start by just renaming the app files into `src/app/`, and the internal
private library into `src/libpriv/`, with the appropriate
`Makefile.am` changes.

Closes: https://github.com/projectatomic/rpm-ostree/pull/123
2015-04-08 16:17:06 -04:00
devop-mmcgrath
b93c64a7d5 rollback: Fix spelling of 'successfully'
Closes: https://github.com/projectatomic/rpm-ostree/pull/125
2015-04-07 17:35:47 -04:00
Colin Walters
e79c73de20 build: Remove last vestiges of hawkey/libsolv compat
We can assume the versions we care about have propagated everywhere
that supports the libhif version we support.
2015-03-20 14:55:32 -04:00
Colin Walters
ddf2227ae9 compose: Optionally make use of rpmsqSetInterruptSafety
See http://lists.rpm.org/pipermail/rpm-maint/2015-February/003863.html
2015-03-19 22:25:04 -04:00
Colin Walters
fc7483b7bc rpmutil: Make use of libglnx console APIs
Less code duplication.
2015-03-19 21:57:00 -04:00
Colin Walters
79a89f90d5 rebase: Also end status line after pull is complete
This is what `upgrade` does.  Otherwise we end up not printing a
newline, and the next line gets glommed on, and we look silly.
2015-03-16 21:22:26 -04:00
Colin Walters
c7e437a281 postprocess: Drop the version checking code
This breaks things when I add automatic_version_prefix and am using a
local repository - it's not buying me anything, and makes it harder to
hack.
2015-03-12 21:45:11 -04:00
Giuseppe Scrivano
38d34e757a configure.ac: improve detection of hy_sack_create ABI change
Fedora 21 seems to use the old ABI with the version 0.5.3.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-03-06 14:30:02 +01:00
Colin Walters
4b19dd1266 Move the little "libcontainer" code into libglnx
I want to share it with ostree, and potentially xdg-app.
2015-03-04 18:29:55 -05:00
Matthew Barnes
deef74e7a0 compose: Sort the goal before printing 2015-02-24 10:15:20 -05:00
Colin Walters
f50e19dfd1 compose: Print the goal
It's useful to see what's going to be installed before we do it.
2015-02-19 18:42:53 -05:00
Colin Walters
392acdf963 Move console code to libglnx
The main goal is to be able to share this with OSTree.
2015-02-17 16:54:54 -05:00
Colin Walters
3190eff276 Start using libglnx
The high level goal is to deprecate libgsystem.  I was trying to share
code between ostree/rpm-ostree, but it was too painful to commit to
forver frozen ABI for new utility APIs.

The git submodule approach will much more easily allow breaking
API/ABI, and iterate on APIs until they either land in GLib or not.

Note that libglnx will not use GFile*, so a full port to it will
involve also not using that.  Thus, it will be necessarily
incremental; in the meantime we'll link to both libgsystem and
libglnx.
2015-02-15 14:01:13 -05:00
Colin Walters
5268cdf776 treepkgdiff: Adapt to Hawkey 0.5.3 API break
We will work on both old and new versions.

See 8ce3ce754f
2015-02-05 09:21:07 -05:00
Giuseppe Scrivano
6547fbc84f build: replace libhif/hif-context-private.h with libhif/hif-utils.h
The header was renamed in newer versions of libhif.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-02-03 11:07:54 +01:00
Colin Walters
fcd1b43249 compose-tree: Add --touch-if-changed
This is a convenient way for external tools to integrate rpm-ostree
better into automation.  With the caching, it's now cheaper to
just rerun rpm-ostree if you know an input yum repository changed,
or just on a timer.

Then one can use this flag to determine whether or not to launch any
further processes after rpm-ostree, such as disk image generation,
test suites, etc.
2015-02-02 16:39:26 -05:00
Colin Walters
9c8dcbe98c [libhif] Update to support "documentation" flag 2015-02-02 16:39:26 -05:00
Colin Walters
5f61945302 [libhif] Actually honor --force-nocache option 2015-02-02 16:39:26 -05:00
Colin Walters
172ff5712b [libhif] Port to new hif_error_set_from_hawkey()
And drop our internal copy.
2015-02-02 16:39:26 -05:00
Colin Walters
53f0c191ac [libhif]: Use the new proxy API to honor http_proxy
For the obvious reasons, this helps avoid redownloading packages
continuously.
2015-02-02 16:39:26 -05:00
Colin Walters
aa190edfbf [libhif] Rework compose caching with new packaging APIs
With yum, we would have had to make a custom Python app to cleanly
separate the fetch metadata/depsolve phases from installation.

Now that libhif/hawkey gives us that, make use of it by exiting after
depsolve if the previous compose has the same package set, and the
treefile is the same.  This saves a fairly substantial amount of time
and I/O, and makes it much more palatable to simply run the compose
tool on demand in response to say repo regeneration notifications.

A further important note; --cachedir is no longer used; we store the
inputhash in the OSTree commit metadata itself.
2015-02-02 16:39:26 -05:00
Colin Walters
0ff3d1de33 [libhif] Exit again on SIGINT/SIGTERM
A major (if not the biggest) point of this endeavor is to support
atomic/idempotent operation.
2015-02-02 16:39:26 -05:00
Colin Walters
7e0a55cd64 [libhif]: Add initial progress reporting
This requires open-coding the 3 steps that hif_context_run() was
doing.  Which is fine, because ultimately we want to have more control
over that.
2015-02-02 16:39:26 -05:00
Colin Walters
01772d67ad [libhif] Implement support for install-langs 2015-02-02 16:39:25 -05:00
Colin Walters
2263bb35f6 [libhif] compose: Initial port to libhif instead of yum
There are a lot of advantages to this.  See the linked issue
for more details, but briefly:

 - Lays the groundwork for package layering
 - Better caching (exit compose after depsolve if no changes)
 - Better error handling
 - Potential for unprivileged package downloads
 - Potential to better containerize installs

TODO:
 - langs handling
 - progress output

Closes: https://github.com/projectatomic/rpm-ostree/issues/53
2015-02-02 16:39:25 -05:00
Colin Walters
4511a1d8ac consoleprogress: New class for writing to the console
Some influence from both systemd and packagekit-glib2.
2015-02-02 16:39:25 -05:00
James Antill
e120675b82 passwd: Use check-* file json config. entries to migrate data across commits 2015-01-22 15:13:50 -05:00
James Antill
834e62826d compose: Add documentation json config. for nodocs yum/rpm transaction flag 2015-01-16 00:33:22 -05:00
James Antill
b49a489f9f Merge pull request #94 from james-antill/master
compose: Add automatic_version_prefix to json config.
2015-01-12 15:14:49 -05:00
Colin Walters
dca6e9b1e8 passwd-util: Drop unnecessary #include
This was breaking the

    make -C packaging -f Makefile.dist-packaging dist-snapshot-without-compose-tooling

build.
2015-01-12 11:40:30 -05:00
James Antill
feb4c7ce52 compose: Create _rpmostree_util_next_version for testing 2015-01-12 00:07:33 -05:00
Colin Walters
9e9f1d0512 passwd: Avoid EINVAL if previous passwd data is empty somehow
Maybe we should make this into an explicit error, but anyways
I somehow ended up with an empty /usr/etc/passwd in the tree
contents, I think due to bugs in earlier work there.

This causes fmemopen to return EINVAL, which errors out the
compose.  Let's stumble forwards here.

Now that I think about it, it might be a valid case to have an
existant but empty /usr/etc/passwd in the tree - when we migrate to
systemd-sysusers, I think we'll want an empty file there by default.
2015-01-09 11:51:38 -05:00
James Antill
687643d2eb compose: Add automatic_version_prefix to json config. 2015-01-09 10:52:09 -05:00
James Antill
504d3885bb db: Fix version output formatting 2015-01-08 00:23:02 -05:00
Colin Walters
61a288fa0d Rework passwd/group migration to deduplicate
Due to an intersection of #79 and #69, we ended up continually
accumulating copies in /usr/lib/{passwd,group}.  The fix here is to
deduplicate when constructing the temporary /etc/passwd that the RPM
install will operate on.

Closes: https://github.com/projectatomic/rpm-ostree/issues/92
2015-01-07 17:52:22 -05:00
Colin Walters
60b279ce48 compose: Move the passwd/group migration code to passwd-util
Pure code motion; no functional changes.  Trying to get all of the
passwd/group code in the same place so I can fix bugs in the
interaction between them more easily.
2015-01-07 17:52:07 -05:00
Colin Walters
a960c6ed9d Merge pull request #91 from cgwalters/hoist-previous-tree-read
compose: Raise up the code to read the previous (OSTree) commit
2015-01-07 17:50:28 -05:00
Colin Walters
3c55021a72 compose: Raise up the code to read the previous (OSTree) commit
I'm planning to replace the caching code with something that inspects
the previous commit rather than a lookaside cache, so raise this code
up to a higher level.
2015-01-07 12:31:10 -05:00
Colin Walters
85414e4119 Merge pull request #89 from cgwalters/metadata-builder
compose: Convert metadata handling into builder
2015-01-07 10:38:32 -05:00
Colin Walters
ccd6bedac4 compose: Convert metadata handling into builder
We're going to start adding our own metadata, so take this initial
step of having the user-specified metadata accumulated into a builder.
2015-01-07 10:35:56 -05:00
Colin Walters
2e5962b6aa Merge pull request #87 from cgwalters/previous-etc-passwd-continued
compose: Fix lookup of previous /etc/passwd
2015-01-07 08:01:34 -05:00
Colin Walters
5345c85642 compose: Fix lookup of previous /etc/passwd
I swear I tested this, but anyways
https://github.com/projectatomic/rpm-ostree/pull/79
wasn't quite right.  We need to look at /usr/etc/{passwd,group}
for previous data.

We happily noticed there was no /etc/passwd in the tree, then
proceeded to do the merge and split again, with the result
of an empty /usr/etc/passwd in the new tree.

That in turn resulted in an empty /etc/passwd in an installed system,
i.e. with no "root" user, with obvious bad consequences, namely in my
case crashing Anaconda.

(Yes, I will write a testsuite for this)
2015-01-06 22:10:56 -05:00
Colin Walters
aefc0f99f9 Use gs_fd_close instead of internal _cleanup_close_
Another one that's now in libgsystem 2014.3.
2015-01-06 09:29:55 -05:00
Colin Walters
22ac2dfd1f Use gsystem GKeyFile cleanups
This is now in 2014.3.
2015-01-06 09:28:29 -05:00
Colin Walters
4875b1e8f9 compose: Use *at() relative lookups for xattrs
This matches recent work in OSTree to use *at() - it's faster and less
prone to error.  In the case of directories which are mutable by
processes in different security domains, it's more secure too.  (That's
not the case here though).
2015-01-05 08:02:07 -05:00
Colin Walters
6d9e4e08d7 postprocess: Don't g_critical if previous commit doesn't have version
I sometimes run "rpm-ostree compose tree" directly, mainly so I can
use gdb and/or nonstandard options.  In this case I don't get
version numbers injected.

That happens to trigger a bug in this code.
2015-01-03 22:19:26 -05:00
Colin Walters
f9e9c06648 compose: Support "preserve-passwd" option (enabled by default)
The checking code from #56 landed, and started triggering for me on
the `dockerroot` user. It's nice to know it works. Then the issue
is... "what now"?

It turns out in the case of `dockerroot` it's actually unused, so we
could fix this by deleting it. But in general we need to support
dynamic uids/gids/. And we can't yet take a hard dep on #49.

So this patch changes things so we take a copy of the passwd/group
data from the previous commit.  Any users subsequently added in the
*new* commit will be additive.

Closes: https://github.com/projectatomic/rpm-ostree/issues/78
2014-12-23 16:28:53 -05:00
Matthew Barnes
31cd8297e7 Merge pull request #77 from mbarnes/pull-progress
Use ostree_repo_pull_default_console_progress_changed()
2014-12-18 23:02:26 -05:00
Matthew Barnes
7b36814441 Use ostree_repo_pull_default_console_progress_changed()
Remove redundant function _rpmostree_pull_progress().

Bumped ostree requirement to 2014.13, but this isn't quite right because
we actually need (unreleased) 2014.14.  Post-release version bumps would
be useful here.
2014-12-18 21:37:22 -05:00
James Antill
855ab9ad01 compose: Add check-passwd/group JSON options, fails compose if uids/gids change
Verify uid/gid on files, directories and symlinks
Just output a msg when user/group is removed with no files

json-parsing: Add functions for strictly dealing with ints
passwd/json: Add simple scripts to convert passwd/group files to json data

docs: Check-passwd/groups and ignore-remove-users/groups JSON config. entries
2014-12-18 16:59:33 -05:00
Colin Walters
58e5089f09 Merge pull request #71 from cgwalters/s-update-upgrade
upgrade: s/update/upgrade/ in text
2014-12-18 14:05:07 -05:00
Ed Santiago
f8badc8c69 status: Show version field if any commits have versions
It is confusing if you pull from an unversioned tree and suddenly
status loses versions.  This comes at a cost of increased horizontal
space.

Closes #73
From #74
2014-12-15 17:54:55 -05:00
Matthew Barnes
5973ea42d7 Fix error handling in rpmhdrs_rpmdbv()
Letting GErrors pile up is wrong; either exit the function or clear the
GError (perhaps with a console warning).

In this case we tolerate missing database files (because users are free
to delete them), and build the checksum from whatever data is available.
Seems weird, but that's how I'm told it's meant to work.  Bail out on
any other type of error.
2014-12-10 11:09:01 -05:00
Colin Walters
dc2a126acd upgrade: s/update/upgrade/ in text
The command name is upgrade, so use that term consistently.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1163989
2014-12-05 13:33:37 -05:00
Colin Walters
3e84cb249a postprocess: Write preserved groups to *both* /etc/group and /usr/lib/group
Otherwise, upgraded systems which have modified /etc/group (by e.g.
adding a human user), will actually see the group drop out with bad
consequences.

It's harmless to have it in both, /etc will override /usr.

Fixes #67
2014-12-05 11:36:42 -05:00
Colin Walters
1da351d088 db list: Fix command line parsing regression
This broke with https://github.com/projectatomic/rpm-ostree/pull/64 I
believe.

The argument parsing here was rather hairy, and I think this patch
clarifies things, in addition to fixing the bug.
2014-12-03 19:07:44 -05:00
Colin Walters
3a41c65c8a treecompose: Add initramfs-args to treefile
We're building generic initramfs images on the server side, but dracut
has logic to pick up some things from the host, like filesystems.

In the absence of host-specific initramfs images, it needs to be up to
the generating system what kernel modules end up in the initramfs.
Provide a generic option to passthrough dracut arguments.
2014-12-02 17:12:34 -05:00
Matthew Barnes
b8c26805d3 Split up rpmostree-builtin-db.c
As a followup to renaming the "rpm" command to "db", split the "db"
subcommands into separate source files in the style of "ostree admin"
and "rpm-ostree compose".

Also create rpmostree-rpm-util.[ch] as a place for common rpm-related
functions needed by the "db" subcommands.

No intentional functional changes here, just a bunch of copy-n-paste
and minor cleanup.
2014-12-01 20:03:12 -05:00
Matthew Barnes
8336e504e1 Rename "rpm" command to "db"
Eliminates some confusion between "rpm-ostree rpm" (or "atomic rpm")
commands versus actual "rpm" commands.

The "rpm" subcommand is retained as a hidden alias for the "db"
subcommand for backward-compatibility.  It is not listed in --help
output.

Fixes #22
2014-12-01 20:03:11 -05:00
Matthew Barnes
b827a398a7 RpmOstreeCommand: Remove unused 'flags' member
There are currently no command flags defined, but if we need any they
would likely be passed to the custom GOptionContext parse function as
in OSTree.
2014-12-01 09:25:53 -05:00
Matthew Barnes
ae37329f99 Remove some unnecessary function parameters
Starting with pkg_yumdb_strdup(), the GError parameter is unused and
therefore (arguably) the GCancellable parameter is also not needed.
Remove them both, and clean up other functions that now have unused
parameters as a result.

Note that none of the callers of these functions were checking for
errors anyway.
2014-12-01 09:25:53 -05:00
Matthew Barnes
2d21a9a621 Refactor command-line parsing for "rpm" command.
Similar to the previous commit, but the "rpm" command needed some extra
attention.

I stopped short of splitting the subcommands into separate files (like
for "compose"), but refactored the parsing as though they were separate.
2014-12-01 09:25:53 -05:00
Matthew Barnes
9b413dad5d Refactor command-line parsing.
Refactor command-line parsing to better utilize GOptionContext.  This
eliminates most of the manual parsing and global options are now shown
in the help output.

Some of the changes here are not strictly necessary for rpm-ostree,
but are done for consistency with ostree's command-line parsing.

The "rpm" subcommand needs some extra attention, so that's been split
into a separate commit.
2014-12-01 09:25:53 -05:00
Matthew Barnes
a7b04e2276 Simple help output corrections. 2014-12-01 09:24:21 -05:00
Kenjiro Nakayama
c62ad4d691 Show capability list with --version option 2014-11-26 14:09:15 -05:00
Colin Walters
308c994d82 libcontainer: Fix inverted logic
=/

Originally it was "container_disabled" but the double negatives
started being awkward, I missed converting this negation.

This should really make us work again on RHEL6.
2014-11-24 21:53:25 -05:00
Colin Walters
4f01e7b63c postprocess: Make use of _prefix_error for format printing
Followup from https://github.com/projectatomic/rpm-ostree/pull/55
2014-11-21 13:18:45 -05:00
Colin Walters
389c36ab7c postprocess: Use run_sync_in_root() for other subprocesses
Let's use these new libcontainer bits instead of invoking chroot().
It's stronger security.
2014-11-21 13:16:49 -05:00
Colin Walters
901917ff85 compose: Introduce a little 'libcontainer', use it for the post script
The current motivation for this is that

https://github.com/fedora-infra/fedmsg-atomic-composer

started using mock --new-chroot (which uses systemd-nspawn) to run
rpm-ostree, which in turn uses systemd-nspawn to run the post script.
Now systemd-nspawn is not really nestable (it wants to link up
journald, resolv.conf handling, etc).

First, dropping nspawn and going to raw containers fixes the nesting
problem.

Second, we don't need all the features of systemd-nspawn.  We are ok
with log messages going to stdout, and we don't use networking, so no
resolv.conf is needed.

Third, this sets a bit of a stage for more sandboxing internally when
run on real systems.  I already have a prototype branch which runs
librepo as an unprivileged user, that could be combined with this for
even stronger security.

Why not use systemd?  Well...I'm still debating that.  But the core
problem is systemd isn't a library in the C sense - to use its
sandboxing features we have to use unit files.  It's harder to have a
daemon that looks like a single service from a management perspective,
but uses sandboxing internally.
2014-11-21 13:16:49 -05:00
Colin Walters
bedf113636 util: Move _rpmostree_perror_fatal here
Will be used in other places in later commits.
2014-11-21 13:16:13 -05:00
Colin Walters
6faaf1fd65 cleanup: Add a _cleanup_close_
Matching systemd.
2014-11-21 13:16:13 -05:00
Colin Walters
2a1f4f6dca compose: Refactor sync waitpid into helper
Will be used for a future commit.
2014-11-21 13:16:13 -05:00
Colin Walters
e021bc2951 util: Add helper function to set GError from errno
Really this should be in libgsystem (or possibly glib-unix.h), we have
a copy in ostree.  But we can refactor to use a shared version later.
2014-11-21 13:16:13 -05:00
Colin Walters
7bc1e08c7d ostree-nspawn: Obsolete, delete
It's useful as a demo, but doesn't need to live here.
2014-11-19 15:57:43 -05:00
Matthew Barnes
5f5a5823ab Fix help output for "rpm-ostree compose"
"rpm-ostree compose {tree,sign} --help" acted as if no subcommand was
given.  But the compose subcommands each have a good number of options
so it's particularly important to list them.
2014-11-19 15:17:45 -05:00
Colin Walters
cb5681a4f4 Delete rpmqa-sorted-and-clean
This is no longer needed now that we use hawkey for this.
2014-11-17 17:46:40 -05:00
Colin Walters
9ad31df1ee jsonutil: Remove useless GCancellable
Spotted by mbarnes from review of
https://github.com/projectatomic/rpm-ostree/pull/52/commits
2014-11-17 16:08:25 -05:00
Colin Walters
15216eacda compose: Make 'bootstrap_packages' actually optional now
It has in practice been optional since:
827e711eb7

Now let's let people write treefiles without it.
2014-11-17 15:48:08 -05:00
Colin Walters
9a20073893 compose: Add 'etc-group-members'
Currently adding human users to a system group such as 'wheel' does
not work with shadow-utils as it exists now.  This is admittedly
a hack; basically we single out "wheel" as going in /etc/group, via:

    "etc-group-members": ["wheel"],

A more comprehensive solution to this will be:
https://github.com/projectatomic/rpm-ostree/issues/49
2014-11-17 12:40:38 -05:00
Colin Walters
3380682cc8 compose: Move boot-location handling to postprocessing
Originally I was trying to have all of the treefile parsing
in treecompose, and then call other functions as API.  But that
turns out to be unrealistic.  We'll need finer grained control
over this in the future.

Therefore, let's move the boot-location handling down, in preparation
for further commits which parse the treefile in the commit phase.
2014-11-17 09:18:02 -05:00
Colin Walters
d32d35500d compose: Move 'workdir' to be 'self' member
This avoids passing another parameter around.
2014-11-16 20:05:47 -05:00
Colin Walters
51fbd8c920 compose: Support 'postprocess-script'
This is obviously a total cop-out.  However, without glibc fixes, we
can't do better.  See:

https://bugzilla.redhat.com/show_bug.cgi?id=156477
2014-11-14 14:12:15 -05:00
Colin Walters
6f959fd20f compose: Support 'remove-from-packages' entry
This is the equivalent of the 'removefrom' verb in Lorax's templating.
It's a lot more robust than a generic "rm-rf" type thing, because most
often you only want to remove files from particular packages.
2014-11-14 14:11:55 -05:00
Colin Walters
80300ba7c8 compose: Support 'install-langs'
This should exist for the same reason the yum and RPM options do; some
people want to construct more minimal systems.
2014-11-14 07:47:29 -05:00
Colin Walters
e2db99a1fb compose: Move content processing code into -postprocess
It seems clearer to me if all code which is operating on the content
(such as enabling systemd units) is under -postprocess.  The "compose
tree" code should be tying everything together and calling out to
sub-components.

This is prep for adding more postprocessing code.
2014-11-13 15:17:08 -05:00
Colin Walters
421fb94ab2 compose: Split out JSON helpers into separate file
In preparation for using some of them in the postprocessing code too.

Yeah, parsing JSON in C sucks =( Oh well.
2014-11-13 15:08:16 -05:00
Colin Walters
b393cfb727 compose: Rename _postprocess function to _prepare_rootfs_for_commit()
It's a lot clearer what we're doing.  This is preparation for further
work in cleaning up how we do content processing.
2014-11-13 14:39:46 -05:00
Colin Walters
571fa8ddec Centralize cleanup function definitions
We might as well do what systemd does and have a big header which
defines all of them, to more conveniently share them for libraries
that don't include them (like hawkey/librepo, as well as things that
libgsystem doesn't yet cover).
2014-11-11 18:40:58 -05:00
Colin Walters
a06ccfed05 Cleanup by using libgsystem cleanup functions
For some reason we ended up defining our own macro to define cleanup
functions, when libgsystem has a usable one.  Switch to that, fewer
lines of code, more consistency.
2014-11-11 18:35:24 -05:00
Colin Walters
4c405bf62f compose: Protect the system during treecompose using container APIs
I was looking again at using hawkey/librepo, and realized just how
much I'd have to fight all of these libraries to avoid affecting
the running system.

What we really want to do with librepo/hawkey is run them effectively
unprivileged, and to hide the system's RPM database from them.  This
is a baby step towards that, by confining our existing yum.

- /usr, /etc, and /var/lib/rpm are mounted read-only
- yum is now run under CLONE_NEWPID, to avoid stray %post scripts
  affecting system processes
2014-11-10 12:13:44 -05:00
Colin Walters
4ecce5884d treecompose: Replace shell callout for package caching with builtin C
This is taking us closer to deeper integration in the treecompose side
with RPM instead of forking out to things.

It works except...we end up with the dreaded __db.001, .dbenv.lock
files =/ Best option would be to teach RPM how to open a database
really read-only.  Failing that, could use the immutable bit?
2014-11-03 16:42:16 -05:00
Colin Walters
e8c53640e3 postprocess: Clean up rpmdb detritus
These lock and dbenv files are created by RPM when it accesses the
database read-write, but we only want read-only.  Sadly that turns out
to be very, very hard to plumb through all the layers in
hawkey/libsolv etc.

So let's just forcibily remove them after postprocessing.
2014-11-03 15:49:32 -05:00
Colin Walters
004f46508a treecompose: Hoist rpmdb processing into function
In preparation for future work.
2014-11-03 08:39:49 -05:00
Colin Walters
d1504d32ac treepkgdiff: Don't create hawkey cache by default
Since we're only quering the database once (and at least
one of the locations is going to be read-only), don't
create the cache.

Noted while just reading the code while working on something else.
2014-11-02 16:47:27 -05:00
James Antill
c48caca122 status: Print the version, using timestamp column if we have all versions 2014-10-24 02:03:08 -04:00
James Antill
ee1cd0d898 Workaround false GCC warning for uninit variable 2014-10-24 01:34:17 -04:00
Colin Walters
e6c42cb884 compose tree: Add --output-repodata-dir
This could be used by higher level tools like fedmsg-atomic-composer
that want to merge the yum repodata used for input with the tree
content.
2014-10-23 17:14:14 -04:00
Colin Walters
161324d73b compose: Add "remove-files" verb
I'd been resisting this for a long time - I really wanted the tree to
be a reflection of the packages; and not go down the path of
"forking".

The lorax model has shown that while you can definitely get a large
space reduction that way, you're going to be perpetually chasing
changes in the packages.  No matter how good your templates are.

Furthermore, lorax is just to generate the installer - it's an OS that
runs a single app.  Whereas here we're generating the target runtime
system; we can't add bugs.

Nevertheless, reality is that sometimes it's just too hard to change
the input package set - there's a risk of breaking things.  Namely,
we're introducing a new update system here, but obviously there's a
previous one: yum.  Upstream packages keep growing a dependency on it.

Note this patch allows *not* removing all files from the package,
because it's possible that other things (e.g. subscription-manager)
import it as a library.

So in the meantime while we're iterating on this, let's support:

  "remove-files": ["usr/bin/yum"],

The code is generic beyond yum for obvious reasons, but I don't
think we should use it for a lot more than that.
2014-10-23 11:42:52 -04:00
Colin Walters
850ad5ae6b upgrade: Honor pull flags
A user noticed --allow-downgrade wasn't actually working.
2014-10-17 13:42:25 -04:00
James Antill
5cd4a1d39b treecompose: Add --add-metadata-string argument for versioning
This will be used by rpm-ostree-toolbox to inject version numbers for
the trees.
2014-10-16 19:10:42 -04:00
James Antill
c4ac1edeae rebase: Cleanup dead variables and origin references 2014-10-16 19:10:13 -04:00
Colin Walters
9e2f6e0c40 rpm: Check out rpmdb in user mode
We may be running as non-root against a root-owned repository; in that
case, there's no need to try to copy the SELinux context or chown()
the files.
2014-10-16 14:22:11 -04:00
Colin Walters
15ecaacd36 compose: Support 'boot_location' to facilitate GRUB2
Having content in /boot in OSTree was always ugly, because we ended up
mounting over it in the deployment location at boot.

This was even worse in the anaconda rpmostreepayload code, because of
the juggling of the mount point that needed to take place.

Trying to add a GRUB2 backend to OSTree is what finally forced this
change.  Now, we put kernels (in the tree) by default in *both* /boot
and /usr/lib/ostree-boot.

OSTree itself knows to look in both locations.  Anaconda is going to
just hard require trees with the new location though.
2014-10-15 22:10:15 -04:00
Colin Walters
2d2a27e6de rebase: Fix status line ending
This was fixed in ostree commit 4d04b148d8b6abad6b6ebc2685e67fc9421b308f
where this code was adapted from.
2014-10-15 22:06:29 -04:00
Colin Walters
03c368fec4 compose: Fix setting of default.target
This would probably be best if we invoked systemctl in the compose
tooling, but at the moment we don't have any execution of target code
on the host.  It's fine to assume that it's in /usr/lib.

We can revisit this if we start doing chrooted/containerized
execution.
2014-10-14 08:28:17 -04:00
Colin Walters
c9219181c4 status: Consistently use malloc'd() memory for status
This crashed when "atomic status" on an origin that didn't have a
refspec, which happened via my new atomic-pkglayer demo script.
2014-10-04 15:08:49 -04:00
Colin Walters
8dab8d551c rebase: Make use of new upgrader API to ignore unconfigured state
"atomic rebase" is mostly a copy of "ostree admin switch", so let's
also pick up the changes in ostree admin switch for the new
unconfigured state flag.

This allows a user to "atomic rebase" on an unconfigured system.

Related: #31
2014-10-03 20:02:24 -04:00
Colin Walters
d3babd8a93 compose: Serialize treefile early
This way we don't emit a critical if we exit due to having already
cached content.
2014-09-29 16:25:36 -04:00
Colin Walters
963f2082cc treepkgdiff: Don't require a booted deployment
For the test suite, we're doing an upgrade offline of another OS root.
What we should maybe do is print the package diff from the merge
deployment, if not the booted one.

However, I think this is OK for now.
2014-09-29 16:25:36 -04:00
Colin Walters
0f16e2e252 Add --disable-compose-tooling build option
Some downstreams want the ability to separate the compose tooling from
the client, for e.g. support reasons.

This approach supports generating a tarball without the source for the
compose command, and requires specifying a config option to disable
it.
2014-09-16 21:45:30 -04:00
Colin Walters
297dbb0c73 compose: Put the expanded treefile content in /usr/share/rpm-ostree/treefile.json
Since the treefile format now supports includes, we would need to
either include the whole chain, or just the expanded portion we use in
the compose.  This patch does the latter.

This should allow a client to take the same treefile and generate a
similar tree (if they want to reproduce with the same RPMs, those can
be extracted from the RPM database inside the tree).
2014-09-07 12:48:05 -04:00
Anne LoVerso
00162a2eea upgrade: Download only /usr/share/rpm in check-diff
This improves on the check-diff option by only downloading the
/usr/share/rpm directory to do a package diff.  This prevents downloading
the whole deployment and the necessity to do a cleanup later.
2014-08-22 15:57:27 -04:00
Colin Walters
acfb219c36 Merge remote-tracking branch 'james/master' 2014-07-31 14:53:17 -04:00
James Antill
a436d47e90 rpm: Change default diff format to block, from diff 2014-07-30 02:11:36 -04:00
James Antill
e9fdbd16bb rpm: Add changelog entries to block diff. output
Diff. output in block mode is now very similar to repodiff.
2014-07-30 02:10:05 -04:00
Colin Walters
e17419b978 compose: Add a --add-override-pkg-repo argument
As a developer, a workflow I have for testing things is to create
an RPM, toss it into a local yum repository, then do a compose.

However at the moment to add the local overrides I have to edit the
treefile, which is annoying.  Let's add a commandline override for
this.

Note this also deletes the old "repos_data" code which was not being
used.
2014-07-28 17:16:09 -04:00
Dusty Mabe
48e8c126f2 compose: Delete dead code that copies aside yum repos
In 827e711 we stopped running two yum transactions. This means the
code that detects if the repodir exists in the yum installroot will
always return false and the code is dead.
2014-07-28 13:55:17 -04:00
James Antill
6ae8462398 rpm: Add --format=block mode format for diff command. 2014-07-24 23:38:51 -04:00
James Antill
9af4822bbd Split diff into algo./print functions. 2014-07-24 23:13:18 -04:00
James Antill
0b6bc7d243 Fix pkg_yumdb_strdup leaking error, and returning NULL. 2014-07-24 22:58:32 -04:00
James Antill
a7e86812f2 rpm: automatically turn fsync off when using mkdtemp dirs. 2014-07-21 00:55:39 -04:00
Colin Walters
7ab2325081 ostree-nspawn: Correctly shift initial root argument 2014-07-20 07:33:47 -04:00
James Antill
c547c8a3f6 Give the user a nice rpm init failure message. 2014-07-18 00:46:17 -04:00
James Antill
cb91fb9494 Fix the error paths for ost_get_commit_hashes.
Simplyfy the code.
 Stop leaking parent/beg_commit.
 Give a real error when a user specified range is bad, and thus. insta.
 fail from callers.
2014-07-18 00:27:28 -04:00
James Antill
23ad6c0310 Use ostree_commit_get_parent in ost_get_prev_commit. 2014-07-17 23:54:50 -04:00
Colin Walters
711745bbc6 Add: --sysroot and --os arguments
These match OSTree.  There are a variety of use cases here.  One is
for test suites; we can stand up a temporary sysroot directory, and
operate on content inside there.

Another is doing virtual machine upgrades offline from a host system,
or upgrading a different OS.

The duplication here is a bit unfortunate; if we add a lot more
commands we should revisit this and perhaps have a common option
group.
2014-07-17 12:59:38 -04:00
Colin Walters
f642512ae6 status: Don't require a booted deployment
I'm working on a patch to add --sysroot support, and for testing
OSTree stuff I often work from a "traditional" host workstation, and
then I have OSTree content in /.

This makes "atomic status" just work for that; I simply have no booted
deployment.
2014-07-16 16:17:59 -04:00
James Antill
634541f722 Allow sequence REFSPECs for version/list.
API probably needs to move to ostree library. Allows us to get a "list"
of REFSPECs, Eg.

"<newest>..<oldest>"

...as a REFSPEC will turn into a list of all the commits, inclusive.
2014-07-16 01:00:36 -04:00
James Antill
c88545d272 Fix 64bit problem when int != gsize to printf. 2014-07-16 01:00:30 -04:00
James Antill
3d85ab99dc Don't leak subtree when /usr/lib/rpm doesn't exist. 2014-07-16 00:59:57 -04:00
James Antill
8a67101de7 Namespace and share DEFINE_TRIVIAL_CLEANUP_FUNC via. rpmostree-util.h
Conflicts:
	src/rpmostree-builtin-rpm.c
2014-07-11 16:47:05 -04:00
James Antill
b65365ac31 Move from using user commit name, to found commit checksum.
We don't want dirs. for branch names etc. so always use the checksum.
2014-07-11 02:35:34 -04:00
James Antill
60ade7d146 Add two column output for rpm list/diff, to look more like yum list. 2014-07-11 02:31:49 -04:00
James Antill
0e7ba9077f Namespace and share DEFINE_TRIVIAL_CLEANUP_FUNC via. rpmostree-util.h 2014-07-11 02:07:31 -04:00
James Antill
b7dbabe065 Add "rpm" command, for doing rpm/yum queries on commits.
It currently has the following sub-commands:

diff COMMIT COMMIT
 for rpmtree diff.
list [prefix...] COMMIT...
 for "yum list" like command.
version COMMIT...
 for "yum version" like command.

...bunch of FIXME's, UI output isn't great, needs docs.
 We also don't use the same code as the treediff on upgrade atm.
2014-07-11 02:01:41 -04:00
Colin Walters
827e711eb7 compose: Migrate content of /etc/{passwd,group} to /usr/lib more sanely
I had an epiphany today while working on
https://bugzilla.redhat.com/show_bug.cgi?id=1098304 - I realized that
I can just do an install, and then copy over everything except the
root entries from /etc/passwd into /usr/lib/passwd.

No need for a patched shadow-utils.  No need to modify the
/etc/nsswitch.conf before doing the install root.  It totally works.
I have no idea why I originally overcomplicated this.

The thing that sucks a bit about this code is that I have to drop to
the FILE * APIs so that I can use the glibc APIs for processing
group/shadow.

Also, the way I deduplicated the code paths for processing
passwd/group is crappy, but I think it's better than duplicating them
(as systemd-sysusers does).

The good: We don't need a two-step RPM transaction, we don't need
          a patch for shadow-utils, it's just saner
The bad: Code is not the most beautiful?  Not really bad.
The ugly: I didn't think of this in the first place and spent
          months beating my head against the wall of shadow-utils...
2014-07-10 18:50:54 -04:00
Colin Walters
aa5ae877de compose: Set SHADOW_USE_USRLIB
See https://bugzilla.redhat.com/show_bug.cgi?id=1098304
2014-07-09 17:29:28 -04:00
Colin Walters
fdb4724d69 compose tree: Read in security.capability xattrs
Per http://fedoraproject.org/wiki/Features/RemoveSETUID
many programs (famously /usr/bin/ping) switched to using
"file capabilities" instead of setuid.

rpm-ostree had code to specially handle SELinux labels, but was
discarding other xattrs.  Let's just whitelist reading in
security.capability.

Closes #14
2014-07-03 15:14:53 -04:00
Colin Walters
19d093a496 compose: Add --workdir-tmpfs
This ~halves the write traffic to my SSD when doing local composes.
My laptop has 12GiB of RAM, plenty for this.
2014-07-02 08:43:59 -04:00
Colin Walters
d63bc65a06 compose: Tell yum not to cache packages locally
They get deleted anyways since we blow away the tmpdir, but we expect
people to be using a local HTTP proxy.  We stopped trying to cache
packages internally as that caused conflicts with the yum lock with
concurrently executing composes.
2014-06-19 11:57:33 -04:00
Anne LoVerso
e498016ff6 status: Rework format into columns
After a discussion on what the status command should offer a
sysadmin, we decided to try a column output format similar to that
of systemctl or docker images.  This will print the timestamp,
a truncated checksum, the osname, and the refspec of each
deployment.  It also includes a --pretty option to print
the information formatted in rows with the full checksum and a
title to specify the default and the rollback target.
2014-06-17 14:47:01 -04:00
Anne LoVerso
7ef1108a96 status: Rework code organization and readability
This includes several changes to format the code to follow GNU Coding Standards as per
the restof rpm-ostree.  This includes fixing indentations, adding spaces between
identifers and parentheses, replacing "goto print" with an else structure, and
reformatting print statements into complete sentences for internationalization.
2014-06-17 14:47:01 -04:00
Anne LoVerso
489b2e301f status: New builtin for system administrators to see deployments
This allows administrators to configure between deployments and easily see which deployment
they are booted into as well as indicating which is chronologically most recent.  This makes
the process more user-friendly, rather than requiring the user to remember which deployment
checksum corresponds to the most recent upgrade.
2014-06-17 14:47:01 -04:00
Colin Walters
227137ed41 compose: Add support for "default_target"
Currently the systemd RPM ships with default.target ->
graphical.target, which is either itself changed by Anaconda (via
parsing /etc/sysconfig/desktop, which...anyways let's stop here).

Or anaconda might set it directly to multi-user.target.

For rpm-ostree, we perform some minimal level of "preconfiguration"
per tree, so they are directly usable without an intervening
installer.

As an example for fedora-atomic/base/core, we just want
multi-user.target.  Thus, this patch provides the treefile author a
declarative mechanism to set it.
2014-06-17 13:49:15 -04:00
Colin Walters
c151b56595 compose tree: Cleanup workdir always
Particularly if we hit the cached case, but we might as well always do
it.
2014-06-11 07:27:31 -04:00
Colin Walters
87a00befe2 compose-tree: Auto-create cache directory
It's just more friendly.
2014-06-06 18:25:08 -04:00
Colin Walters
1613435f7d tree compose: Delete .dbenv.lock and __db.* files from /usr/share/rpm
Currently on an Atomic compose, I'm seeing abrtd trying to write to
/usr/share/rpm/.dbenv.lock, which is denied by policy because it's
usr_t.  There are multiple ways to address this, but there's no good
reason to leave the lock files and __db* files around.

rpm appears to operate correctly without them if calling process
merely gets EROFS.
2014-06-06 16:28:19 -04:00
Colin Walters
c8c54d5095 Delete repoquery-sorted script
This was used previously by the caching infrastructure, but is no
longer used.
2014-06-06 14:57:54 -04:00
Anne LoVerso
bbbf28db30 rollback: Add comment 2014-06-05 16:51:12 -04:00
Colin Walters
976c68542b Add a "rebase" builtin
This is exactly the code from "ostree admin switch", except it's
called "rebase" because in the future it will also carry along any
locally layered packages.
2014-05-29 18:00:11 -04:00
Colin Walters
7ba1a9b46f compose-tree: Fix location of rpmdb querying for caching
We were just repeatedly hitting the cache...oops.

Also add an assertion that the returned data isn't empty.
2014-05-29 14:57:55 -04:00
Colin Walters
7c71fbc077 Add new "compose" builtin, rename "treecompose" -> "compose tree"
And do the same for "sign".  This way we can have the compose server
utilities cleanly separated from what most people will see, which is
the client side tools.
2014-05-26 15:05:08 -04:00
Colin Walters
9d954d433a treecompose: s/create/treecompose/ in help text 2014-05-20 21:37:51 -04:00
Colin Walters
6fd8515f2e treecompose: Look for yum repo configs in same directory as treefiles
This is significantly easier than requiring mutation of the host yum
configuration.
2014-05-18 14:13:31 -04:00