summaryrefslogtreecommitdiff
path: root/lib/chef/provider/package/apt.rb
Commit message (Collapse)AuthorAgeFilesLines
* Avoid the need to parse nil versions in the package providerTim Smith2017-11-031-4/+8
| | | | | | | | | | | | | | | | | If we don't have a version installed yet we shouldn't go do a version comparison with nil. No matter what that's a waste of time and in dpkg/apt it's going to require shelling out now. Instead just do the install. This also adds the same version comparison method to the dpkg resource. At the moment it doesn't look like this is going to get called since our upgrade action there is a bit broken (doesn't actually compare versions), but that's going to get fixed next. This also cleans up the version comparison to make sure we're always dealing with strings Signed-off-by: Tim Smith <tsmith@chef.io>
* Fix the invalid version comparison of apt packages.pr/6554Takuto Komazaki2017-11-021-4/+9
| | | | | | | | | | | | | | | The strings of dpkg versions are more complex than the Gem::Version and not compatible with it. Using Gem::Version to compare versions of dpkg packages will cause mistakes or raise the exeption of 'Malformed version number..'. please see a simple example: https://gist.github.com/komazarari/c6b33b29a0e31e9c62bbc2f0b2091647 Prefer to use the dpkg cli. https://debian-handbook.info/browse/en-US/stable/sect.manipulating-packages-with-dpkg.html Signed-off-by: Takuto Komazaki <komazarari@gmail.com>
* Fixes to package upgrade behaviourJon Cowie2017-09-221-0/+7
| | | | | | | | | | | | This commit introduces fixes to the behaviour of the various providers of the "package" resource (and subtypes like dnf_package etc) when a more recent version of the package has been installed than that present in an available repository or file source and "action :upgrade" is called against the package. Currently, a number of package providers will attempt to downgrade a package under this scenario, where the desired action should be to recognise that a more up to date version is already installed and do nothing. I've introduced a ```version_compare``` method to the package superclass which by default uses ```Gem::Version``` comparison with spaceship-operator semantics to ensure that an upgrade is attempted only when the candidate version is not older than the current version. Additionally, this commit introduces a method called ```version_equals?``` which is functionally identical to ```target_version_already_installed?``` (and that method now in fact calls ```version_equals?```. This has been done to clarify the purpose and functionality of that method, but since it's a public API, deprecation of the old method name will have to be done more gradually. Signed-off-by: Jon Cowie <jcowie@chef.io>
* package provider cleanuplcg/package-cleanupLamont Granquist2017-02-111-13/+15
| | | | | | | | | - cleans up a lot of ivar usage - converts most providers to shell_out_compact_timeout! - almost deprecates a few APIs, but can't quite yet - windows providers need mixlib-shellout to take an argv Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
* fixed apt-mark commandsEike Waldt2016-09-291-2/+2
|
* added package_locked Method for aptEike Waldt2016-09-291-0/+12
|
* fixed styleEike Waldt2016-09-281-2/+2
|
* added (un)lock_package for apt and zypperc52275322016-09-281-0/+8
|
* handle purging and removing virtual packagesLamont Granquist2016-05-031-3/+9
|
* add check for passing nil candidate_version to superclassLamont Granquist2016-05-031-3/+0
|
* make private things privateLamont Granquist2016-05-031-60/+60
|
* lazier assembly of data, more multipackagingLamont Granquist2016-05-031-42/+34
|
* code is much less brain-hurty nowLamont Granquist2016-05-031-25/+41
| | | | | | i think i fixed a bug here where now we expect the superclass to raise on candidate_version = nil when installing, so now we can remove packages that do not have a candidate_version
* vastly simplify extracting the installed versionLamont Granquist2016-05-031-4/+1
|
* this variable does nothingLamont Granquist2016-05-031-9/+0
|
* multipackage apt providerLamont Granquist2016-05-031-34/+29
|
* Update all auth email address from opscode.com and getchef.com to chef.io.Noah Kantrowitz2016-02-021-1/+1
| | | Generated via git ls-files | xargs perl -pi -e "s/(Author.*?<[^@]+@)(?:opscode\\.com|getchef\\.com)(>)/\\1chef.io\\2/gi"
* Replace all Opscode copyrights with Chef Software.Noah Kantrowitz2016-02-021-1/+1
| | | Created via git ls-files | xargs perl -pi -e "s/(Copyright.*?), Opscode(,)? Inc(\.)?/\\1, Chef Software Inc./gi"
* Copyright year update for 2016 and massive cleanup.Noah Kantrowitz2016-02-021-1/+1
| | | Generated via git ls-files | xargs perl -pi -e "s/[Cc]opyright (?:\([Cc]\) )?((?\!$(date +%Y))\\d{4})(-\\d{4})?([, ][ \d]+)*(,|(?= ))/Copyright \\1-$(date +%Y),/g"
* Use double quotes by defaultThom May2016-01-141-10/+10
| | | | | | | This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
* Re-separate priority map and DSL handler map so that provides has veto power ↵John Keiser2015-07-061-0/+1
| | | | over priority
* fix package timeout attributeLamont Granquist2015-06-021-3/+3
| | | | | | | | | | updates all the shell_out calls to respect the timeout which is passed on the new_resource. the old `Chef::Config` yum timeout values are still respected and will override the default. the default of 900 seconds is preserved.
* fix virtual package logic in check_package_stateLamont Granquist2015-02-171-88/+78
| | | | | | | | | | | | | | | | since check_package_state calls itself to check virtual packages the array building it does was getting indexed incorrectly as the virtual packages were getting inserted into arrays that were supposed to be indexed by the package arguments the user gave. there was also a bug which broke idempotency with virtual packages and would cause virtual packages to get reinstalled every time (installed_version not geting correctly inherited from the virtual package). WIP2 remove debug fix specs
* use scalar pkg not array packageLamont Granquist2015-02-171-1/+1
| | | | the names in this class are a bit confusing and need to be cleaned up
* convert is_virtual_package to hashLamont Granquist2015-02-171-4/+13
| | | | | | | | | make this a hash based on name so that when we pass an array of names to install_package we can look up the right one and do not have to synchronize arrays. we should probably convert the arrays in the superclass to hashes based on name as well.
* Minor cleanupPhil Dibowitz2015-02-031-2/+0
|
* Merge in the cleanups from reverted array diff.Phil Dibowitz2015-02-031-9/+7
|
* Revert "Make yum always use arrays internally"Phil Dibowitz2015-02-031-7/+9
| | | | | | | | This reverts commit a88c852e7166c2d209d0670f668cf67feab19222. We can't easily do this without changing a LOT of other assumptions. Since all the consumer sites already call `as_array` functions, it's easier to keep those safe.
* Make yum always use arrays internallyPhil Dibowitz2015-02-031-9/+7
| | | | Also handle a lot more corner casses consistently and cleanup more code.
* Multipackge supportPhil Dibowitz2015-02-031-44/+93
| | | | | | | | | | | | | | | | Allow the `package` provider to take an array of packages to handle in one transaction. This solves two large problems: * There are times when you cannot install two packages in sequence, like when a binary is moving between two packages - they *must* be done in the same transaction. * When using Chef to install the vast majority of your base system, it can make imaging take a very, very long time because executing yum or apt once for every single package is painfully slow. This solves both. The scaffolding is all there in the Package HWRP, plus the underlying implementation for both apt and yum, the two I have access to test.
* fix apt default_release attribute broken in 12.0Lamont Granquist2014-12-151-2/+2
| | | | | | | | | | | | | the apt provider attempts to check if it has a provider that responds to :default_release (i.e. a real apt_package resource) via if the provider attribute is explicitly set or not, which is relying on a side-effect which broke in 12.0. the correct behavior is just to duck-type the new_resource object and see if it respond_to?(:default_release) and then use it if it does. Also the unit tests were not testing the apt_provider against both the package and apt_package resources. Added some hacky spec code (which needs a cleanup) to at least exercise the use cases.
* Chef-12 RC Provider ResolverLamont Granquist2014-10-241-0/+2
| | | | | makes resource and provider class resolution more dynamic. begins deprecation of Chef::Platform static mapping.
* fixing all the extra blank linesLamont Granquist2014-07-291-1/+0
| | | | yes, i just used rubocop on the chef sourcecode...
* add shell_out to base provider codeLamont Granquist2014-07-291-2/+0
|
* Revert the provider indirection logic while keeping the timeout ↵sersut2014-07-021-2/+2
| | | | functionality to fix resource notifications and ChefSpec stubs.
* Merge pull request #1462 from pdf/CHEF-5168Claire McQuin2014-06-101-5/+5
|\ | | | | [CHEF-5168] Apt Package provider times out
| * [CHEF-5168] Apt Package provider times outPeter Fern2014-05-281-5/+5
| | | | | | | | | | - Convert APT package resource to use `provides :package` - Add timeout parameter
* | Raise exception when using apt package with sourceChulki Lee2014-06-051-0/+9
|/
* CHEF-4568: Make apt showpkg regex more friendly to differing whitespaceBryan McLellan2013-09-261-1/+2
|
* Add inline doc for private apt package methoddanielsdeleo2013-08-021-0/+3
|
* Convert apt package provider to shelloutdanielsdeleo2013-08-021-30/+11
| | | | | | - Convert apt package provider to shellout. Improves content of error messages when apt fails. - Refactor tests to avoid stubbing value objects
* [OC-3564] move core Chef to the repo root \o/ \m/Seth Chisamore2012-10-301-0/+147
| | | | The opscode/chef repository now only contains the core Chef library code used by chef-client, knife and chef-solo!
* big refactor of the repo layout. move to a chef gem and a chef-server gem ↵Ezra Zygmuntowicz2008-10-081-89/+0
| | | | all with proper deps
* Also needs to be one more directory down for the requiresAdam Jacob2008-10-021-1/+1
|
* Package is now beneath AptAdam Jacob2008-10-021-1/+1
|
* Moving provider/apt to provider/package/apt.rbAdam Jacob2008-10-021-0/+89