Beispiel #1
0
        for file in uploaded_files:
            # build file names
            asc = "%s.asc" % file
            abs_file = os.path.abspath(os.path.join(upload_dir, file))
            abs_asc = os.path.abspath(os.path.join(upload_dir, asc))

            sha_file = get_file_sha256(abs_file)

            # build links
            link_file = client.share(file, short_url=False)
            # if someone finds how to do this with the API, please tell me!
            link_file[u'url'] = link_file[u'url'].replace('?dl=0', '?dl=1')
            link_asc = client.share(asc, short_url=False)
            link_asc[u'url'] = link_asc[u'url'].replace('?dl=0', '?dl=1')
            if p1.match(file):
                osys, arch, lc = get_bundle_info(file, 'linux')
            elif p2.match(file):
                osys, arch, lc = get_bundle_info(file, 'windows')
            elif p3.match(file):
                osys, arch, lc = get_bundle_info(file, 'osx')

            link = "%s$%s$%s$" % (link_file[u'url'], link_asc[u'url'], sha_file)

            # note that you should only upload bundles for supported locales
            core.add_link('Dropbox', osys, lc, link)
    except (ValueError, RuntimeError) as e:
        print str(e)
    except dropbox.rest.ErrorResponse as e:
        print str(e)
Beispiel #2
0
        for file in uploaded_files.keys():
            # only run for tor browser installers
            if p4.match(file):
                continue
            asc = "%s.asc" % file
            abs_file = os.path.abspath(os.path.join(upload_dir, file))
            abs_asc = os.path.abspath(os.path.join(upload_dir, asc))

            sha_file = get_file_sha256(abs_file)

            # build links
            link_file = share_file(drive_service, uploaded_files[file])

            link_asc = share_file(drive_service,
                                  uploaded_files["%s.asc" % file])

            if p1.match(file):
                osys, arch, lc = get_bundle_info(file, 'linux')
            elif p2.match(file):
                osys, arch, lc = get_bundle_info(file, 'windows')
            elif p3.match(file):
                osys, arch, lc = get_bundle_info(file, 'osx')

            link = "%s$%s$%s$" % (link_file, link_asc, sha_file)

            # note that you should only upload bundles for supported locales
            core.add_link('Drive', osys, lc, link)
    except (ValueError, RuntimeError) as e:
        print str(e)
Beispiel #3
0
        print('Uploading release, please wait, this might take a while!')
        # Upload the latest browser bundles to a new release
        release = upload_new_release(target_repo, version, tb_path)

        # Upload success, publish the release
        release.edit(draft=False)

    # Create the links file for this release
    core = gettor.core.Core(os.path.abspath('../core.cfg'))

    # Erase old links if any and create a new empty one
    core.create_links_file('GitHub', readable_fp)

    print("Creating links file")
    for asset in release.assets:
        url = asset.browser_download_url
        if url.endswith('.asc'):
            continue

        osys, arch, lc = get_bundle_info(asset.name)
        sha256 = get_file_sha256(
            os.path.abspath(os.path.join(tb_path, asset.name))
        )

        link = "{}${}${}$".format(url, url + ".asc", sha256)

        print("Adding {}".format(url))
        core.add_link('GitHub', osys, lc, link)

    print "Github links updated!"
Beispiel #4
0
    readable = ' '.join(fp[i:i+4] for i in xrange(0, len(fp), 4))

    try:
        uploaded_files = upload_files(upload_dir, client)
        # use default config
        core = gettor.core.Core()
        
        # erase old links
        core.create_links_file('Dropbox', readable)

        for file in uploaded_files:            
            # build file names
            asc = file + '.asc'
            abs_file = os.path.abspath(os.path.join(upload_dir, file))
            abs_asc = os.path.abspath(os.path.join(upload_dir, asc))
            
            sha_file = get_file_sha256(abs_file)
            
            # build links
            link_file = client.share(file)
            link_asc = client.share(asc)
            link = link_file[u'url'] + ' ' + link_asc[u'url'] + ' ' + sha_file
            
            # add links
            operating_system, locale = get_bundle_info(file)
            core.add_link('Dropbox', operating_system, locale, link)
    except (ValueError, RuntimeError) as e:
        print str(e)
    except dropbox.rest.ErrorResponse as e:
        print str(e)
Beispiel #5
0
        # Remove any drafts to clean broken uploads
        print('Uploading release, please wait, this might take a while!')
        # Upload the latest browser bundles to a new release
        release = upload_new_release(target_repo, version, tb_path)

        # Upload success, publish the release
        release.edit(draft=False)

    # Create the links file for this release
    core = gettor.core.Core(core_path)

    # Erase old links if any and create a new empty one
    core.create_links_file('GitHub', readable_fp)

    print("Creating links file")
    for asset in release.assets():
        url = asset.browser_download_url
        if url.endswith('.asc'):
            continue

        osys, arch, lc = get_bundle_info(asset.name)
        sha256 = get_file_sha256(
            os.path.abspath(os.path.join(tb_path, asset.name)))

        link = "{}${}${}$".format(url, url + ".asc", sha256)

        print("Adding {}".format(url))
        core.add_link('GitHub', osys, lc, link)

    print "Github links updated!"
Beispiel #6
0
            if p4.match(file):
               continue
            asc = "%s.asc" % file
            abs_file = os.path.abspath(os.path.join(upload_dir, file))
            abs_asc = os.path.abspath(os.path.join(upload_dir, asc))

            sha_file = get_file_sha256(abs_file)

            # build links
            link_file = share_file(drive_service,
                                   uploaded_files[file])
            link_asc  = share_file(drive_service,
                                   uploaded_files["%s.asc" % file])

            if p1.match(file):
                osys, arch, lc = get_bundle_info(file, 'linux')
            elif p2.match(file):
                osys, arch, lc = get_bundle_info(file, 'windows')
            elif p3.match(file):
                osys, arch, lc = get_bundle_info(file, 'osx')

            link = "Package (%s-bit): %s\nASC signature (%s-bit): %s\n"\
                   "Package SHA256 checksum (%s-bit): %s\n" %\
                   (arch, link_file, arch, link_asc,
                    arch, sha_file)

            # note that you should only upload bundles for supported locales
            core.add_link('Drive', osys, lc, link)
    except (ValueError, RuntimeError) as e:
        print str(e)
Beispiel #7
0
        for file in uploaded_files:
            # build file names
            asc = "%s.asc" % file
            abs_file = os.path.abspath(os.path.join(upload_dir, file))
            abs_asc = os.path.abspath(os.path.join(upload_dir, asc))

            sha_file = get_file_sha256(abs_file)

            # build links
            link_file = client.share(file, short_url=False)
            # if someone finds how to do this with the API, please tell me!
            link_file[u'url'] = link_file[u'url'].replace('?dl=0', '?dl=1')
            link_asc = client.share(asc, short_url=False)
            link_asc[u'url'] = link_asc[u'url'].replace('?dl=0', '?dl=1')
            if p1.match(file):
                osys, arch, lc = get_bundle_info(file, 'linux')
            elif p2.match(file):
                osys, arch, lc = get_bundle_info(file, 'windows')
            elif p3.match(file):
                osys, arch, lc = get_bundle_info(file, 'osx')

            link = "%s$%s$%s$" % (link_file[u'url'], link_asc[u'url'],
                                  sha_file)

            # note that you should only upload bundles for supported locales
            core.add_link('Dropbox', osys, lc, link)
    except (ValueError, RuntimeError) as e:
        print str(e)
    except dropbox.rest.ErrorResponse as e:
        print str(e)
Beispiel #8
0
            # get bundle info according to its OS
            if re.match(".*\.exe$", filename):
                osys, arch, lc = get_bundle_info(filename, "windows")
                filename_asc = filename.replace("exe", "exe.asc")

            elif re.match(".*\.dmg$", filename):
                osys, arch, lc = get_bundle_info(filename, "osx")
                filename_asc = filename.replace("dmg", "dmg.asc")

            elif re.match(".*\.tar.xz$", filename):
                osys, arch, lc = get_bundle_info(filename, "linux")
                filename_asc = filename.replace("tar.xz", "tar.xz.asc")

            else:
                # don't care about other files (asc or txt)
                continue

            sha256 = get_file_sha256(os.path.abspath("%s/%s/%s" % (repo, version, filename)))

            # since the url is easy to construct and it doesn't involve any
            # kind of unique hash or identifier, we get the link for the
            # asc signature just by adding '.asc'
            link_asc = file[u"download_url"].replace(filename, filename_asc)

            link = "%s$%s$%s$" % (file[u"download_url"], link_asc, sha256)

            print "Adding %s" % file[u"download_url"]
            core.add_link("GitHub", osys, lc, link)

    print "Github links updated!"