google / macops

Utilities, tools, and scripts for managing and tracking a fleet of Macintoshes in a corporate environment
Apache License 2.0
819 stars 86 forks source link

Fixing version comparison & adding support for build comparisons #69

Open pudquick opened 5 years ago

pudquick commented 5 years ago

This is both a bug fix and a new feature.

First the bug fix - here's an example situation:

This logic: https://github.com/google/macops/blob/master/deprecation_notifier/DeprecationNotifier/DNAppDelegate.m#L60-L63

  } else if (([expectedVersionArray[0] intValue] <= [systemVersionArray[0] intValue]) &&
             ([expectedVersionArray[1] intValue] <= [systemVersionArray[1] intValue]) &&
             ([expectedVersionArray[2] intValue] <= [systemVersionArray[2] intValue])) {
    NSLog(@"Exiting: OS is already %@ or greater", expectedVersion);

10 <= 10: true 14 <= 15: true 3 <= 1: false

The comparison will fail when it shouldn't.

This PR includes better comparison logic.

It additionally adds support for a new optional Localizable string value: expectedBuilds

The value of this string should be a comma delimited string (no spaces) of allowed builds.

If the OS is detected to be exactly the expectedVersion, then:

Use case: for environments that are supporting a major OS version which has now gone into Security Updates, Deprecation Notifier is unable to tell a "fully patched" OS version without looking at the build information.

googlebot commented 5 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
pudquick commented 5 years ago

I signed it!

googlebot commented 5 years ago

CLAs look good, thanks!