static rc_t vdi_report_repo_vector( const KRepositoryMgr * repomgr, const KRepCategory cat, int32_t select, bool full ) { rc_t rc = 0; catfunc f = vdi_get_catfunc( cat ); if ( f != NULL ) { KRepositoryVector v; rc = f( repomgr, &v ); if ( rc == 0 ) { const char * prefix = KRepCategory_to_prefix( cat ); uint32_t idx, len = VectorLength( &v ); bool disabled = KRepositoryMgrCategoryDisabled( repomgr, cat ); rc = KOutMsg( "repo.%s --> disabled: %s, %d subrepositories )\n", prefix, yes_or_no( disabled ), len ); for ( idx = 0; rc == 0 && idx < len; ++idx ) { if ( select == idx || !full ) rc = vdi_report_repository( VectorGet( &v, idx ), prefix, idx, full ); } KRepositoryVectorWhack( &v ); } } return rc; }
static rc_t report_repo( visit_ctx * octx, KRepCategory category ) { rc_t rc, rc1; KRepositoryVector repos; const char * hint; VectorInit ( &repos, 0, 5 ); switch ( category ) { case krepUserCategory : hint = MAIN_CAT_USER; rc = KRepositoryMgrUserRepositories( octx->repo_mgr, &repos ); break; case krepSiteCategory : hint = MAIN_CAT_SITE; rc = KRepositoryMgrSiteRepositories( octx->repo_mgr, &repos ); break; case krepRemoteCategory : hint = MAIN_CAT_REMOTE; rc = KRepositoryMgrRemoteRepositories( octx->repo_mgr, &repos ); break; } if ( rc != 0 ) { if ( rc == SILENT_RC( rcKFG, rcNode, rcOpening, rcPath, rcNotFound ) ) { KOutMsg("\n%s:\n", hint); KOutMsg("\tnot found in configuration\n"); rc = 0; } else { PLOGERR( klogErr, ( klogErr, rc, "KRepositoryMgr<$(hint)>repositories() failed in $(func)", "hint=%s,func=%s", hint, __func__ ) ); } } else { uint32_t idx; bool disabled = KRepositoryMgrCategoryDisabled ( octx->repo_mgr, category ); rc = KOutMsg( "\n%s:\n", hint ); if ( rc == 0 && disabled ) rc = KOutMsg( "\tglobally disabled\n" ); for ( idx = 0; idx < VectorLength( &repos ) && rc == 0; ++idx ) { const KRepository *repo = VectorGet( &repos, idx ); if ( repo != NULL ) { char repo_name[ 1024 ]; rc = KRepositoryDisplayName ( repo, repo_name, sizeof repo_name, NULL ); if ( rc != 0 ) { PLOGERR( klogErr, ( klogErr, rc, "KRepositoryName() for $(hint) failed in $(func)", "hint=%s,func=%s", hint, __func__ ) ); } else { KRepSubCategory sub_cat = KRepositorySubCategory ( repo ); bool disabled = KRepositoryDisabled ( repo ); bool cache_enabled = KRepositoryCacheEnabled ( repo ); const char * sub_cat_ptr = SUB_CAT_UNKNOWN; switch( sub_cat ) { case krepMainSubCategory : sub_cat_ptr = SUB_CAT_MAIN; break; case krepAuxSubCategory : sub_cat_ptr = SUB_CAT_AUX; break; case krepProtectedSubCategory : sub_cat_ptr = SUB_CAT_PROT; break; default : sub_cat_ptr = SUB_CAT_UNKNOWN; break; } rc = KOutMsg( "\t%s.%s: %s, cache-%s", sub_cat_ptr, repo_name, ( disabled ? "disabled" : "enabled" ), ( cache_enabled ? "enabled" : "disabled" ) ); if ( rc == 0 ) { if ( octx->options->detailed ) { /* it is OK if we cannot find the root of a repository... */ char where[ 4096 ]; rc1 = KRepositoryRoot ( repo, where, sizeof where, NULL ); if ( rc1 == 0 ) rc = KOutMsg( ", at %s", where ); else { rc1 = KRepositoryResolver ( repo, where, sizeof where, NULL ); if ( rc1 == 0 ) rc = KOutMsg( ", at %s", where ); } } } if ( rc == 0 ) rc = KOutMsg( "\n" ); } } } } { rc1 = KRepositoryVectorWhack ( &repos ); if ( rc1 != 0 ) { PLOGERR( klogErr, ( klogErr, rc1, "KRepositoryVectorWhack() for $(hint) failed in $(func)", "hint=%s,func=%s", hint, __func__ ) ); } } return rc; }