Class: RPM::Transaction
- Inherits:
-
Data
- Object
- Data
- RPM::Transaction
- Defined in:
- ext/rpm/db.c
Instance Method Summary (collapse)
-
- (Object) abort
To abort the transaction.
- - (Object) available
-
- (Array<Dependency>, +nil+) check
Check the dependencies.
-
- (Object) commit {|CallbackData| ... }
Performs the transaction.
-
- (RPM::DB) db
The database associated with this transaction.
-
- (Object) delete
Add a delete operation to the transaction.
-
- (Object) install
Add a install operation to the transaction.
-
- (Array<String>) keys
An array of keys corresponding to all transactions that have been added.
-
- (Object) order
To determine the processing order.
-
- (File) script_file
Get transaction script file handle i.e stdout/stderr on scriptlet execution.
-
- (Object) script_file=
Set the transaction script file handle.
-
- (Object) upgrade
Add a upgrade operation to the transaction.
Instance Method Details
- (Object) abort
To abort the transaction. Database is not changed.
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_abort(VALUE trans)
{
rb_ivar_set(trans, id_aborted, Qtrue);
rb_throw("abort", Qnil);
return Qnil; /* NOT REACHED */
}
|
- (Object) available
- (Array<Dependency>, +nil+) check
Check the dependencies.
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_check(VALUE trans)
{
#if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
rpmDependencyConflict conflicts;
int num;
rpmdepCheck(RPM_TRANSACTION(trans), &conflicts, &num);
if (num) {
VALUE list = rb_ary_new();
register int i;
for (i = 0; i < num; i++) {
VALUE dep;
switch (conflicts[i].sense) {
case RPMDEP_SENSE_REQUIRES:
dep = rpm_require_new(conflicts[i].needsName,
rpm_version_new(conflicts[i].needsVersion),
conflicts[i].needsFlags,
rpm_package_new_from_header(conflicts[i].byHeader));
break;
case RPMDEP_SENSE_CONFLICTS:
dep = rpm_conflict_new(conflicts[i].needsName,
rpm_version_new(conflicts[i].needsVersion),
conflicts[i].needsFlags,
rpm_package_new_from_header(conflicts[i].byHeader));
break;
}
|
- (Object) commit {|CallbackData| ... }
Performs the transaction.
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_commit(int argc, VALUE* argv, VALUE trans)
{
#if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
rpmProblemSet probset;
int flags = RPMTRANS_FLAG_NONE;
int ignores = RPMPROB_FILTER_NONE;
int rc;
VALUE db;
db = rb_ivar_get(trans, id_db);
if (OBJ_FROZEN(db)) {
rb_error_frozen("RPM::DB");
}
|
- (RPM::DB) db
The database associated with this transaction
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_get_db(VALUE trans)
{
return rb_ivar_get(trans, id_db);
}
|
- (Object) delete
Add a delete operation to the transaction
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_delete(VALUE trans, VALUE pkg)
{
VALUE db;
VALUE mi;
db = rb_ivar_get(trans, id_db);
if (TYPE(pkg) == T_STRING)
mi = rpm_db_init_iterator(db, INT2NUM(RPMDBI_LABEL), pkg);
else if (rb_obj_is_kind_of(pkg, rpm_cPackage) != Qfalse) {
VALUE sigmd5 = rpm_package_aref(pkg,INT2NUM(RPMTAG_SIGMD5));
if (sigmd5 != Qnil){
mi = rpm_db_init_iterator(db, INT2NUM(RPMTAG_SIGMD5), sigmd5);
}
|
- (Object) install
Add a install operation to the transaction
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_install(VALUE trans, VALUE pkg, VALUE key)
{
VALUE keys;
if (rb_obj_is_kind_of(pkg, rpm_cPackage) == Qfalse ||
TYPE(key) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
|
- (Array<String>) keys
An array of keys corresponding to all transactions that have been added.
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_keys(VALUE trans)
{
return rb_ivar_get(trans, id_keys);
}
|
- (Object) order
To determine the processing order.
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_order(VALUE trans)
{
#if RPM_VERSION_CODE < RPM_VERSION(4,1,0)
rpmdepOrder(RPM_TRANSACTION(trans));
#else
rpmtsOrder(RPM_TRANSACTION(trans));
#endif
return Qnil;
}
|
- (File) script_file
Get transaction script file handle i.e stdout/stderr on scriptlet execution
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_get_script_file(VALUE trans)
{
return rb_ivar_get(trans, id_sf);
}
|
- (Object) script_file=
Set the transaction script file handle
i.e stdout/stderr on scriptlet execution
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_set_script_file(VALUE trans, VALUE file)
{
if (TYPE(file) != T_FILE) {
rb_raise(rb_eTypeError, "illegal argument type");
}
|
- (Object) upgrade
Add a upgrade operation to the transaction
|
# File 'ext/rpm/db.c'
VALUE
rpm_transaction_upgrade(VALUE trans, VALUE pkg, VALUE key)
{
VALUE keys;
if (rb_obj_is_kind_of(pkg, rpm_cPackage) == Qfalse ||
TYPE(key) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
|