mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 17:51:22 +03:00
transaction: remove checks for installed
Transactions cannot contain installed jobs anymore. Remove the now pointless checks.
This commit is contained in:
parent
656bbffc6c
commit
d6a093d098
@ -83,14 +83,13 @@ void job_free(Job *j) {
|
|||||||
|
|
||||||
void job_uninstall(Job *j) {
|
void job_uninstall(Job *j) {
|
||||||
assert(j->installed);
|
assert(j->installed);
|
||||||
|
assert(j->unit->job == j);
|
||||||
/* Detach from next 'bigger' objects */
|
/* Detach from next 'bigger' objects */
|
||||||
|
|
||||||
bus_job_send_removed_signal(j);
|
bus_job_send_removed_signal(j);
|
||||||
|
|
||||||
if (j->unit->job == j) {
|
j->unit->job = NULL;
|
||||||
j->unit->job = NULL;
|
unit_add_to_gc_queue(j->unit);
|
||||||
unit_add_to_gc_queue(j->unit);
|
|
||||||
}
|
|
||||||
|
|
||||||
hashmap_remove(j->manager->jobs, UINT32_TO_PTR(j->id));
|
hashmap_remove(j->manager->jobs, UINT32_TO_PTR(j->id));
|
||||||
j->installed = false;
|
j->installed = false;
|
||||||
|
@ -11,8 +11,7 @@ static void transaction_delete_job(Transaction *tr, Job *j, bool delete_dependen
|
|||||||
|
|
||||||
transaction_unlink_job(tr, j, delete_dependencies);
|
transaction_unlink_job(tr, j, delete_dependencies);
|
||||||
|
|
||||||
if (!j->installed)
|
job_free(j);
|
||||||
job_free(j);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void transaction_delete_unit(Transaction *tr, Unit *u) {
|
static void transaction_delete_unit(Transaction *tr, Unit *u) {
|
||||||
@ -279,7 +278,7 @@ static void transaction_drop_redundant(Transaction *tr) {
|
|||||||
LIST_FOREACH(transaction, k, j) {
|
LIST_FOREACH(transaction, k, j) {
|
||||||
|
|
||||||
if (tr->anchor_job != k &&
|
if (tr->anchor_job != k &&
|
||||||
(k->installed || job_type_is_redundant(k->type, unit_active_state(k->unit))) &&
|
job_type_is_redundant(k->type, unit_active_state(k->unit)) &&
|
||||||
(!k->unit->job || !job_type_is_conflicting(k->type, k->unit->job->type)))
|
(!k->unit->job || !job_type_is_conflicting(k->type, k->unit->job->type)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -349,7 +348,6 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
|
|||||||
log_info("Walked on cycle path to %s/%s", k->unit->id, job_type_to_string(k->type));
|
log_info("Walked on cycle path to %s/%s", k->unit->id, job_type_to_string(k->type));
|
||||||
|
|
||||||
if (!delete &&
|
if (!delete &&
|
||||||
!k->installed &&
|
|
||||||
!unit_matters_to_anchor(k->unit, k)) {
|
!unit_matters_to_anchor(k->unit, k)) {
|
||||||
/* Ok, we can drop this one, so let's
|
/* Ok, we can drop this one, so let's
|
||||||
* do so. */
|
* do so. */
|
||||||
@ -478,7 +476,6 @@ static int transaction_is_destructive(Transaction *tr, DBusError *e) {
|
|||||||
assert(!j->transaction_next);
|
assert(!j->transaction_next);
|
||||||
|
|
||||||
if (j->unit->job &&
|
if (j->unit->job &&
|
||||||
j->unit->job != j &&
|
|
||||||
!job_type_is_superset(j->type, j->unit->job->type)) {
|
!job_type_is_superset(j->type, j->unit->job->type)) {
|
||||||
|
|
||||||
dbus_set_error(e, BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE, "Transaction is destructive.");
|
dbus_set_error(e, BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE, "Transaction is destructive.");
|
||||||
@ -576,9 +573,6 @@ static int transaction_apply(Transaction *tr, Manager *m, JobMode mode) {
|
|||||||
assert(!j->transaction_prev);
|
assert(!j->transaction_prev);
|
||||||
assert(!j->transaction_next);
|
assert(!j->transaction_next);
|
||||||
|
|
||||||
if (j->installed)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
r = hashmap_put(m->jobs, UINT32_TO_PTR(j->id), j);
|
r = hashmap_put(m->jobs, UINT32_TO_PTR(j->id), j);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto rollback;
|
goto rollback;
|
||||||
@ -587,11 +581,6 @@ static int transaction_apply(Transaction *tr, Manager *m, JobMode mode) {
|
|||||||
while ((j = hashmap_steal_first(tr->jobs))) {
|
while ((j = hashmap_steal_first(tr->jobs))) {
|
||||||
Job *installed_job;
|
Job *installed_job;
|
||||||
|
|
||||||
if (j->installed) {
|
|
||||||
/* log_debug("Skipping already installed job %s/%s as %u", j->unit->id, job_type_to_string(j->type), (unsigned) j->id); */
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clean the job dependencies */
|
/* Clean the job dependencies */
|
||||||
transaction_unlink_job(tr, j, false);
|
transaction_unlink_job(tr, j, false);
|
||||||
|
|
||||||
@ -614,12 +603,8 @@ static int transaction_apply(Transaction *tr, Manager *m, JobMode mode) {
|
|||||||
|
|
||||||
rollback:
|
rollback:
|
||||||
|
|
||||||
HASHMAP_FOREACH(j, tr->jobs, i) {
|
HASHMAP_FOREACH(j, tr->jobs, i)
|
||||||
if (j->installed)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
hashmap_remove(m->jobs, UINT32_TO_PTR(j->id));
|
hashmap_remove(m->jobs, UINT32_TO_PTR(j->id));
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user