def get_app_info(appinfo, args): """ Returns a dict with all the info about the omaha app that we will need to perform the upload """ chrome_major = get_chrome_version().split('.')[0] chrome_minor = get_chrome_version().split('.')[1] appinfo['appguid'] = get_appguid(release_channel(), appinfo['platform']) appinfo['channel'] = release_channel() appinfo['chrome_version'] = get_chrome_version() appinfo['platform_id'] = get_platform_id(appinfo['platform']) appinfo['preview'] = args.preview if appinfo['platform'] in 'win32': # By default enable the win32 version on upload appinfo['is_enabled'] = True # The win32 version is the equivalent of the 'short_version' on darwin appinfo['version'] = chrome_major + '.' + get_upload_version() if appinfo['platform'] in 'darwin': appinfo['short_version'] = chrome_major + '.' + get_upload_version() appinfo['version'] = appinfo['short_version'].split('.')[2] + \ '.' + appinfo['short_version'].split('.')[3] appinfo['release_notes'] = 'Brave Browser Channel: {}; Version: {}; Uploaded by omaha-upload.py script.'\ .format(release_channel(), appinfo['version']) return appinfo
def get_app_info(appinfo, args): """ Returns a dict with all the info about the omaha app that we will need to perform the upload """ changelog_url = "https://github.com/brave/brave-browser/blob/master/CHANGELOG.md" chrome_major = get_chrome_version().split('.')[0] chrome_minor = get_chrome_version().split('.')[1] appinfo['appguid'] = get_appguid(release_channel(), appinfo['platform']) appinfo['channel'] = release_channel() appinfo['chrome_version'] = get_chrome_version() appinfo['platform_id'] = get_platform_id(appinfo['platform']) appinfo['preview'] = args.preview if appinfo['platform'] in 'win32': # By default enable the win32 version on upload appinfo['is_enabled'] = True # The win32 version is the equivalent of the 'short_version' on darwin appinfo['version'] = chrome_major + '.' + get_upload_version() if appinfo['platform'] in 'darwin': appinfo['short_version'] = chrome_major + '.' + get_upload_version() appinfo['version'] = appinfo['short_version'].split('.')[2] + \ '.' + appinfo['short_version'].split('.')[3] appinfo['release_notes'] = 'Brave Browser version: {}\n\n<a href="{}">Brave Changelog</a>'\ .format(appinfo['version'] if appinfo['platform'] in 'win32' else appinfo['short_version'], changelog_url) return appinfo
def get_app_info(appinfo, args): ''' Returns a dict with all the info about the omaha app that we will need to perform the upload ''' changelog_url = 'https://github.com/brave/brave-browser/blob/master/CHANGELOG_DESKTOP.md' if args.version: version_values = args.version.split('.') chrome_major = version_values[0] brave_version = '.'.join(version_values[1:3]) version = args.version else: chrome_major = get_chrome_version().split('.')[0] brave_version = get_upload_version() version = chrome_major + '.' + brave_version version_values = version.split('.') # The Sparkle CFBundleVersion is no longer tied to the Chrome version, # instead we derive it from the package.json['version'] string. The 2nd # digit is adjusted, and then we utilize that combined with the 3rd digit as # the CFBundleVersion. (This is also used in build/mac/tweak_info_plist.py) if int(version_values[1]) >= 1: adjusted_minor = int( version_values[2]) + (100 * int(version_values[1])) else: # Fall back to returning the actual minor value adjusted_minor = int(version_values[2]) appinfo['platform'] = 'darwin' if 'darwin' in args.platform else 'win32' appinfo['arch'] = 'ia32' if 'win32' in args.platform else 'x64' appinfo['appguid'] = get_appguid(release_channel(), appinfo['platform']) appinfo['channel'] = release_channel() appinfo['platform_id'] = get_platform_id(appinfo['platform']) appinfo['internal'] = args.internal appinfo['full'] = args.full appinfo['previous'] = args.previous if appinfo['platform'] in 'win32': # By default enable the win32 version on upload appinfo['is_enabled'] = True # The win32 version is the equivalent of the 'short_version' on darwin appinfo['version'] = version if appinfo['platform'] in 'darwin': appinfo['short_version'] = version appinfo['version'] = str(adjusted_minor) + '.' + version_values[3] appinfo['release_notes'] = 'Release notes at <a href="{0}">{0}</a>'.format( changelog_url) return appinfo
def get_app_info(appinfo, args): """ Returns a dict with all the info about the omaha app that we will need to perform the upload """ changelog_url = "https://github.com/brave/brave-browser/blob/master/CHANGELOG.md" chrome_major = get_chrome_version().split('.')[0] chrome_minor = get_chrome_version().split('.')[1] # The Sparkle CFBundleVersion is no longer tied to the Chrome version, # instead we derive it from the package.json['version'] string. The 2nd # digit is adjusted, and then we utilize that combined with the 3rd digit as # the CFBundleVersion. (This is also used in build/mac/tweak_info_plist.py) version_values = get_upload_version().split('.') if int(version_values[0]) >= 1: adjusted_minor = int( version_values[1]) + (100 * int(version_values[0])) else: # Fall back to returning the actual minor value adjusted_minor = int(version_values[1]) appinfo['appguid'] = get_appguid(release_channel(), appinfo['platform']) appinfo['channel'] = release_channel() appinfo['chrome_version'] = get_chrome_version() appinfo['platform_id'] = get_platform_id(appinfo['platform']) appinfo['preview'] = args.preview if appinfo['platform'] in 'win32': # By default enable the win32 version on upload appinfo['is_enabled'] = True # The win32 version is the equivalent of the 'short_version' on darwin appinfo['version'] = chrome_major + '.' + get_upload_version() if appinfo['platform'] in 'darwin': appinfo['short_version'] = chrome_major + '.' + get_upload_version() appinfo['version'] = str(adjusted_minor) + \ '.' + version_values[2] appinfo['release_notes'] = 'Brave Browser version: {}\n\n<a href="{}">Brave Changelog</a>'\ .format(appinfo['version'] if appinfo['platform'] in 'win32' else appinfo['short_version'], changelog_url) return appinfo
def test_win_omaha_channel(self, mock_get_platform, mock_get_host_arch): PLATFORM = 'win32' os.environ['PLATFORM'] = 'win32' mock_get_platform.return_value = PLATFORM # print("DEBUG: PLATFORM: {}".format(PLATFORM)) for CHANNEL in ['beta', 'dev', 'release']: os.environ['CHANNEL'] = CHANNEL # print("DEBUG: CHANNEL: {}".format(CHANNEL)) for TARGET_ARCH in ['x64', 'ia32']: os.environ['TARGET_ARCH'] = TARGET_ARCH if TARGET_ARCH == 'ia32': mock_get_host_arch.return_value = 'x86' else: mock_get_host_arch.return_value = TARGET_ARCH # print("DEBUG: TARGET_ARCH: {}".format(TARGET_ARCH)) # print("DEBUG: omaha_channel(): {}".format(omaha_channel())) if release_channel() in ['beta']: chan = release_channel()[0:2] elif release_channel() in ['release', 'dev']: chan = release_channel()[0:3] self.assertEquals('{}-{}'.format(mock_get_host_arch.return_value, chan), omaha_channel())
def test_win_omaha_channel(self, mock_get_platform, mock_get_host_arch): PLATFORM = 'win32' os.environ['PLATFORM'] = 'win32' mock_get_platform.return_value = PLATFORM # print("DEBUG: PLATFORM: {}".format(PLATFORM)) for CHANNEL in ['nightly', 'dev', 'beta', 'release']: os.environ['CHANNEL'] = CHANNEL # print("DEBUG: CHANNEL: {}".format(CHANNEL)) for TARGET_ARCH in ['x64', 'ia32']: os.environ['TARGET_ARCH'] = TARGET_ARCH if TARGET_ARCH == 'ia32': mock_get_host_arch.return_value = 'x86' else: mock_get_host_arch.return_value = TARGET_ARCH # print("DEBUG: TARGET_ARCH: {}".format(TARGET_ARCH)) # print("DEBUG: omaha_channel(): {}".format(omaha_channel())) if release_channel() in ['nightly', 'beta']: chan = release_channel()[0:2] elif release_channel() in ['dev', 'release']: chan = release_channel()[0:3] self.assertEquals('{}-{}'.format(mock_get_host_arch.return_value, chan), omaha_channel(PLATFORM, TARGET_ARCH, False))