Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix package pinning when package is also pkg mngr
Since the addition of language package managers, the Dockerfile lock functionality was getting confused when trying to pin packages that also double as language package managers. This commit does the following to resolve the issue: 1) In analyze.py, instead of comparing each of the packages in the layer to see if they are installed in the RUN line, first gather the list of packages being installed in the dockerfile RUN line and then compare those against the packages installed in the layer. This prevents unnecessary comparisons and duplicate pinnings. 2) Add a 'should_pin' method to dockerfile.py that checks whether the package in the RUN line should be pinned or not. Use this function in the existing 'expand_package' function in dockerfile.py to determine if we should expand/pin the package or not. 3) Modify the way 'expand_package' in dockerfile.py actually pins the package and version in the dockerfile object. Instead of using the replace method, which was expanding non-exact matches of a package name, we go word by word in the RUN line to determine if a package should be pinned. 4) Modify the 'package_in_dockerfile' function to return the list of packages being installed in a given RUN line instead of returning true or false. Also change the name of the function to more accurately reflect its purpose. The function is now called 'get_install_packages'. Resolves #702 Signed-off-by: Rose Judge <rjudge@vmware.com>
- Loading branch information