2015-04-02 09:59:27 +08:00
|
|
|
/*
|
2018-01-04 09:35:30 +08:00
|
|
|
* Copyright (C) 2015-2018 VMware, Inc. All Rights Reserved.
|
2015-04-16 05:10:08 +08:00
|
|
|
*
|
|
|
|
* Licensed under the GNU Lesser General Public License v2.1 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License. The terms
|
|
|
|
* of the License are located in the COPYING file of this distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Module : client.c
|
|
|
|
*
|
|
|
|
* Abstract :
|
|
|
|
*
|
|
|
|
* tdnfclientlib
|
|
|
|
*
|
|
|
|
* client library
|
|
|
|
*
|
|
|
|
* Authors : Priyesh Padmavilasom (ppadmavilasom@vmware.com)
|
|
|
|
*/
|
|
|
|
|
2015-04-02 09:59:27 +08:00
|
|
|
#include "includes.h"
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
TDNFApplyScopeFilter(
|
2017-05-16 08:32:45 +08:00
|
|
|
PSolvQuery pQuery,
|
2015-04-02 09:59:27 +08:00
|
|
|
TDNF_SCOPE nScope
|
|
|
|
)
|
|
|
|
{
|
|
|
|
uint32_t dwError = 0;
|
|
|
|
|
2017-05-16 08:32:45 +08:00
|
|
|
if(!pQuery || nScope == SCOPE_NONE)
|
2015-04-02 09:59:27 +08:00
|
|
|
{
|
|
|
|
dwError = ERROR_TDNF_INVALID_PARAMETER;
|
|
|
|
BAIL_ON_TDNF_ERROR(dwError);
|
|
|
|
}
|
|
|
|
|
2018-01-04 09:35:30 +08:00
|
|
|
pQuery->nScope = nScope;
|
|
|
|
|
2015-04-02 09:59:27 +08:00
|
|
|
switch(nScope)
|
|
|
|
{
|
|
|
|
case SCOPE_INSTALLED:
|
2017-05-16 08:32:45 +08:00
|
|
|
dwError = SolvAddSystemRepoFilter(pQuery);
|
|
|
|
BAIL_ON_TDNF_ERROR(dwError);
|
2015-04-02 09:59:27 +08:00
|
|
|
break;
|
|
|
|
|
|
|
|
case SCOPE_AVAILABLE:
|
2017-05-16 08:32:45 +08:00
|
|
|
dwError = SolvAddAvailableRepoFilter(pQuery);
|
|
|
|
BAIL_ON_TDNF_ERROR(dwError);
|
2015-11-01 23:04:02 +08:00
|
|
|
break;
|
2015-04-02 09:59:27 +08:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup:
|
|
|
|
return dwError;
|
|
|
|
|
|
|
|
error:
|
|
|
|
goto cleanup;
|
|
|
|
}
|