From ae9c6ab759d9dc1c7e72159092539444ca03cf33 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Fri, 29 Sep 2017 10:16:47 +1000 Subject: [PATCH] Use "pip list" in check_libs_from_git As described in the change, "pip freeze" has issues with the way zuulv3 clones repos without a remote. This is an attempt to use "pip list" to check for local install Change-Id: I33d25f86b6afcadb4b190a0f6c53311111c64521 --- inc/python | 15 ++++++++++++++- stack.sh | 6 +----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/inc/python b/inc/python index 5e7f742d48..4bc1856fbd 100644 --- a/inc/python +++ b/inc/python @@ -386,7 +386,20 @@ function use_library_from_git { # determine if a package was installed from git function lib_installed_from_git { local name=$1 - pip freeze 2>/dev/null | grep -- "$name" | grep -q -- '-e git' + # Note "pip freeze" doesn't always work here, because it tries to + # be smart about finding the remote of the git repo the package + # was installed from. This doesn't work with zuul which clones + # repos with no remote. + # + # The best option seems to be to use "pip list" which will tell + # you the path an editable install was installed from; for example + # in response to something like + # pip install -e 'git+http://git.openstack.org/openstack-dev/bashate#egg=bashate' + # pip list shows + # bashate (0.5.2.dev19, /tmp/env/src/bashate) + # Thus we look for "path after a comma" to indicate we were + # installed from some local place + pip list 2>/dev/null | grep -- "$name" | grep -q -- ', .*)$' } # check that everything that's in LIBS_FROM_GIT was actually installed diff --git a/stack.sh b/stack.sh index f5aa7659f9..c545c56de3 100755 --- a/stack.sh +++ b/stack.sh @@ -1389,11 +1389,7 @@ service_check # ensure that all the libraries we think we installed from git, # actually were. -# -# NOTE(ianw) 2017-09-27 : "pip freeze" is currently having issues -# with zuulv3 and the way it clones remotes. We will restore this -# with a slightly different check soon -#check_libs_from_git +check_libs_from_git # Configure nova cellsv2