Unverified Commit f0b872bd authored by numinit's avatar numinit Committed by GitHub
Browse files

androidenv.composeAndroidPackages: fix eval when minor versions are specified (#458654)

parents 0462958b 988d4bec
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ let
  # Coerces a string to an int.
  coerceInt = val: if lib.isInt val then val else lib.toIntBase10 val;

  coerceIntVersion = v: coerceInt (lib.versions.major v);

  # Parses a single version, substituting "latest" with the latest version.
  parseVersion =
    repo: key: version:
@@ -97,8 +99,8 @@ in
  platformVersions ?
    if minPlatformVersion != null && maxPlatformVersion != null then
      let
        minPlatformVersionInt = coerceInt (parseVersion repo "platforms" minPlatformVersion);
        maxPlatformVersionInt = coerceInt (parseVersion repo "platforms" maxPlatformVersion);
        minPlatformVersionInt = coerceIntVersion (parseVersion repo "platforms" minPlatformVersion);
        maxPlatformVersionInt = coerceIntVersion (parseVersion repo "platforms" maxPlatformVersion);
      in
      lib.range (lib.min minPlatformVersionInt maxPlatformVersionInt) (
        lib.max minPlatformVersionInt maxPlatformVersionInt
@@ -109,10 +111,8 @@ in
          if minPlatformVersion == null then
            1
          else
            coerceInt (parseVersion repo "platforms" minPlatformVersion);
        latestPlatformVersionInt = lib.max minPlatformVersionInt (
          coerceInt (lib.versions.major repo.latest.platforms)
        );
            coerceIntVersion (parseVersion repo "platforms" minPlatformVersion);
        latestPlatformVersionInt = lib.max minPlatformVersionInt (coerceIntVersion repo.latest.platforms);
        firstPlatformVersionInt = lib.max minPlatformVersionInt (
          latestPlatformVersionInt - (lib.max 1 numLatestPlatformVersions) + 1
        );