-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #291 from sshedi/refactor-locking-stable-3.2
Move instance running check to TDNFOpenHandle()
- Loading branch information
Showing
16 changed files
with
459 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
FROM fedora:34 | ||
|
||
RUN dnf -q -y upgrade | ||
RUN dnf -q -y install gcc make cmake libcurl-devel rpm-devel rpm-build libsolv-devel \ | ||
popt-devel sed createrepo_c glib2-devel libxml2 findutils \ | ||
python3-pytest python3-requests python3-urllib3 python3-pyOpenSSL \ | ||
python3 python3-devel valgrind gpgme-devel libxml2-devel \ | ||
openssl-devel rpm-sign which | ||
RUN dnf -y upgrade | ||
RUN dnf -y install gcc make cmake libcurl-devel rpm-devel rpm-build \ | ||
libsolv-devel popt-devel sed createrepo_c glib2-devel libxml2 \ | ||
findutils python3-pytest python3-requests python3-urllib3 \ | ||
python3-pyOpenSSL python3 python3-devel valgrind gpgme-devel \ | ||
libxml2-devel openssl-devel rpm-sign which python3-pip | ||
|
||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
FROM photon:latest | ||
|
||
MAINTAINER [email protected] | ||
|
||
RUN tdnf update -q -y | ||
RUN tdnf remove -q -y toybox | ||
RUN tdnf install -q -y --enablerepo=photon-debuginfo \ | ||
build-essential cmake curl-devel rpm-build libsolv-devel \ | ||
popt-devel sed createrepo_c glib libxml2 findutils \ | ||
python3 python3-pip python3-setuptools python3-devel \ | ||
valgrind gpgme-devel glibc-debuginfo libxml2-devel \ | ||
openssl-devel zlib-devel which | ||
RUN tdnf update -y | ||
RUN tdnf remove -y toybox | ||
RUN tdnf install -y --enablerepo=photon-debuginfo \ | ||
build-essential cmake curl-devel rpm-build \ | ||
libsolv-devel popt-devel sed createrepo_c glib libxml2 \ | ||
findutils python3 python3-pip python3-setuptools \ | ||
python3-devel valgrind gpgme-devel glibc-debuginfo \ | ||
libxml2-devel openssl-devel zlib-devel which \ | ||
python3-requests python3-urllib3 python3-pyOpenSSL | ||
|
||
# python build/test dependencies | ||
RUN pip3 install -q requests urllib3 pyOpenSSL pytest | ||
RUN pip3 install -q pytest | ||
|
||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,16 @@ | ||
FROM photon:3.0 | ||
|
||
MAINTAINER [email protected] | ||
RUN tdnf update -y | ||
RUN tdnf remove -y toybox | ||
RUN tdnf install -y --enablerepo=photon-debuginfo \ | ||
build-essential cmake curl-devel rpm-build \ | ||
libsolv-devel popt-devel sed createrepo_c glib libxml2 \ | ||
findutils python3 python3-setuptools python3-devel \ | ||
valgrind gpgme-devel glibc-debuginfo libxml2-devel \ | ||
openssl-devel zlib-devel which python3-requests \ | ||
python3-urllib3 python3-pyOpenSSL python3-pip | ||
|
||
RUN tdnf update -q -y | ||
RUN tdnf remove -q -y toybox | ||
RUN tdnf install -q -y --enablerepo=photon-debuginfo \ | ||
build-essential cmake curl-devel rpm-build libsolv-devel \ | ||
popt-devel sed createrepo_c glib libxml2 findutils \ | ||
python3 python3-pip python3-setuptools python3-devel \ | ||
valgrind gpgme-devel glibc-debuginfo libxml2-devel \ | ||
openssl-devel zlib-devel which | ||
|
||
# python build/test dependencies | ||
RUN pip3 install -q requests urllib3 pyOpenSSL pytest | ||
# TODO: we need to fix pytest in Ph3, after that this can be removed | ||
RUN pip3 install -q pytest | ||
|
||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,21 +18,36 @@ | |
* Authors : Priyesh Padmavilasom ([email protected]) | ||
*/ | ||
|
||
#include <ftw.h> | ||
#include "includes.h" | ||
#include "config.h" | ||
|
||
static TDNF_ENV gEnv = {0}; | ||
|
||
uint32_t | ||
TDNFInit( | ||
void | ||
) | ||
static tdnflock instance_lock; | ||
|
||
static void TdnfExitHandler(void); | ||
static void IsTdnfAlreadyRunning(void); | ||
|
||
static void TdnfExitHandler(void) | ||
{ | ||
tdnflockFree(instance_lock); | ||
} | ||
|
||
static void IsTdnfAlreadyRunning(void) | ||
{ | ||
instance_lock = tdnflockNewAcquire(TDNF_INSTANCE_LOCK_FILE, | ||
"tdnf_instance"); | ||
if (!instance_lock) | ||
{ | ||
pr_err("Failed to acquire tdnf_instance lock\n"); | ||
} | ||
} | ||
|
||
uint32_t TDNFInit(void) | ||
{ | ||
uint32_t dwError = 0; | ||
int nLocked = 0; | ||
uint32_t dwError = 0; | ||
|
||
pthread_mutex_lock (&gEnv.mutexInitialize); | ||
pthread_mutex_lock(&gEnv.mutexInitialize); | ||
nLocked = 1; | ||
if(!gEnv.nInitialized) | ||
{ | ||
|
@@ -640,6 +655,10 @@ TDNFOpenHandle( | |
BAIL_ON_TDNF_ERROR(dwError); | ||
} | ||
|
||
IsTdnfAlreadyRunning(); | ||
|
||
GlobalSetQuiet(pArgs->nQuiet); | ||
|
||
dwError = TDNFAllocateMemory(1, sizeof(TDNF), (void**)&pTdnf); | ||
BAIL_ON_TDNF_ERROR(dwError); | ||
|
||
|
@@ -1469,7 +1488,7 @@ TDNFRepoQuery( | |
BAIL_ON_TDNF_ERROR(dwError); | ||
} | ||
|
||
/* get results in list */ | ||
/* get results in list */ | ||
dwError = SolvGetQueryResult(pQuery, &pPkgList); | ||
BAIL_ON_TDNF_ERROR(dwError); | ||
|
||
|
@@ -1930,6 +1949,7 @@ TDNFCloseHandle( | |
TDNFFreePlugins(pTdnf->pPlugins); | ||
TDNFFreeMemory(pTdnf); | ||
} | ||
TdnfExitHandler(); | ||
} | ||
|
||
const char* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ add_library(${LIB_TDNF_COMMON} | |
strings.c | ||
utils.c | ||
log.c | ||
lock.c | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.