All the information that contributes to a package's hash, and thus its InstalledPackageId.
Modulecabal-install-3.12.1.0Haskell2010
Distribution.Client.PackageHash
Functions to calculate nix-style hashes for package ids.
The basic idea is simple, hash the combination of:
the package tarball
the ids of all the direct dependencies
other local configuration (flags, profiling, etc)
See PackageHashInputs for a detailed list of what determines the hash.
- 3 types
- 5 values
- Packagecabal-install-3.12.1.0
- Exports8
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourcePackageHash.hs
Calculating package hashes
6 declarationsThose parts of the package configuration that contribute to the package hash.
Constructors
PackageHashConfigInputspkgHashCompilerId :: CompilerIdpkgHashCompilerABI :: AbiTagpkgHashPlatform :: PlatformpkgHashFlagAssignment :: FlagAssignmentpkgHashConfigureScriptArgs :: [String]pkgHashVanillaLib :: BoolpkgHashDynExe :: BoolpkgHashFullyStaticExe :: BoolpkgHashGHCiLib :: BoolpkgHashProfLib :: BoolpkgHashProfExe :: BoolpkgHashProfLibDetail :: ProfDetailLevelpkgHashProfExeDetail :: ProfDetailLevelpkgHashCoverage :: BoolpkgHashOptimization :: OptimisationLevelpkgHashSplitObjs :: BoolpkgHashSplitSections :: BoolpkgHashStripLibs :: BoolpkgHashStripExes :: BoolpkgHashDebugInfo :: DebugInfoLevelpkgHashProgramArgs :: Map String [String]pkgHashExtraLibDirs :: [FilePath]pkgHashExtraLibDirsStatic :: [FilePath]pkgHashExtraFrameworkDirs :: [FilePath]pkgHashExtraIncludeDirs :: [FilePath]pkgHashProgPrefix :: Maybe PathTemplatepkgHashProgSuffix :: Maybe PathTemplatepkgHashPackageDbs :: [Maybe PackageDB]pkgHashDocumentation :: BoolpkgHashHaddockHoogle :: BoolpkgHashHaddockHtml :: BoolpkgHashHaddockHtmlLocation :: Maybe StringpkgHashHaddockForeignLibs :: BoolpkgHashHaddockExecutables :: BoolpkgHashHaddockTestSuites :: BoolpkgHashHaddockBenchmarks :: BoolpkgHashHaddockInternal :: BoolpkgHashHaddockCss :: Maybe FilePathpkgHashHaddockLinkedSource :: BoolpkgHashHaddockQuickJump :: BoolpkgHashHaddockContents :: Maybe PathTemplatepkgHashHaddockIndex :: Maybe PathTemplatepkgHashHaddockBaseUrl :: Maybe StringpkgHashHaddockLib :: Maybe StringpkgHashHaddockOutputDir :: Maybe FilePath
Instances1Show
Show PackageHashConfigInputsDefined in cabal-install-3.12.1.0 · Distribution.Client.PackageHash
Calculate a InstalledPackageId for a package using our nix-style inputs hashing method.
Note that due to path length limitations on Windows, this function uses a different method on Windows that produces shorted package ids. See hashedInstalledPackageIdLong vs hashedInstalledPackageIdShort.
Calculate the overall hash to be used for an InstalledPackageId.
Render a textual representation of the PackageHashInputs.
The hashValue of this text is the overall package hash.
Platform-specific variations
Calculate a InstalledPackageId for a package using our nix-style inputs hashing method.
This produces large ids with big hashes. It is only suitable for systems without significant path length limitations (ie not Windows).
On Windows we have serious problems with path lengths. Windows imposes a maximum path length of 260 chars, and even if we can use the windows long path APIs ourselves, we cannot guarantee that ghc, gcc, ld, ar, etc etc all do so too.
So our only choice is to limit the lengths of the paths, and the only real way to do that is to limit the size of the InstalledPackageIds that we generate. We do this by truncating the package names and versions and also by truncating the hash sizes.
Truncating the package names and versions is technically ok because they are just included for human convenience, the full source package id is included in the hash.
Truncating the hash size is disappointing but also technically ok. We rely on the hash primarily for collision avoidance not for any security properties (at least for now).