~sil2100/ubuntu-system-image/server_special-case_core_archs

« back to all changes in this revision

Viewing changes to lib/systemimage/generators.py

  • Committer: Stéphane Graber
  • Date: 2015-03-11 20:55:00 UTC
  • Revision ID: stgraber@ubuntu.com-20150311205500-2m6y8826hvav1r50
Fix styling

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
 
130
130
    with open(path.replace(".tar.xz", ".json"), "w+") as fd:
131
131
        fd.write("%s\n" % json.dumps(metadata, sort_keys=True,
132
 
                                     indent=4, separators=(',', ': ')))
 
132
                                     indent=4, separators=(",", ": ")))
133
133
    gpg.sign_file(conf, "image-signing", path.replace(".tar.xz", ".json"))
134
134
 
135
135
    return path
259
259
            continue
260
260
 
261
261
        hash_string = "%s/%s/%s" % (boot_hash, recovery_hash, system_hash)
262
 
        global_hash = sha256(hash_string.encode('utf-8')).hexdigest()
 
262
        global_hash = sha256(hash_string.encode("utf-8")).hexdigest()
263
263
 
264
264
        # Generate the path
265
265
        path = os.path.join(conf.publish_path, "pool",
336
336
 
337
337
        with open(path.replace(".tar.xz", ".json"), "w+") as fd:
338
338
            fd.write("%s\n" % json.dumps(metadata, sort_keys=True,
339
 
                                         indent=4, separators=(',', ': ')))
 
339
                                         indent=4, separators=(",", ": ")))
340
340
        gpg.sign_file(conf, "image-signing", path.replace(".tar.xz", ".json"))
341
341
 
342
342
        # Cleanup
556
556
 
557
557
        with open(path.replace(".tar.xz", ".json"), "w+") as fd:
558
558
            fd.write("%s\n" % json.dumps(metadata, sort_keys=True,
559
 
                                         indent=4, separators=(',', ': ')))
 
559
                                         indent=4, separators=(",", ": ")))
560
560
        gpg.sign_file(conf, "image-signing", path.replace(".tar.xz", ".json"))
561
561
 
562
562
        # Cleanup
673
673
 
674
674
        with open(path.replace(".tar.xz", ".json"), "w+") as fd:
675
675
            fd.write("%s\n" % json.dumps(metadata, sort_keys=True,
676
 
                                         indent=4, separators=(',', ': ')))
 
676
                                         indent=4, separators=(",", ": ")))
677
677
        gpg.sign_file(conf, "image-signing", path.replace(".tar.xz", ".json"))
678
678
 
679
679
        # Cleanup
790
790
        metadata['series'] = series
791
791
        metadata['raw_device_path'] = raw_device_path
792
792
        metadata['raw_device_checksum'] = raw_device_hash
793
 
        metadata['device'] = environment.get('device_name', 'none')
 
793
        metadata['device'] = environment.get("device_name", "none")
794
794
 
795
795
        with open(path.replace(".tar.xz", ".json"), "w+") as fd:
796
796
            fd.write("%s\n" % json.dumps(metadata, sort_keys=True,
797
 
                                         indent=4, separators=(',', ': ')))
 
797
                                         indent=4, separators=(",", ": ")))
798
798
        gpg.sign_file(conf, "image-signing", path.replace(".tar.xz", ".json"))
799
799
 
800
800
        # Cleanup
871
871
 
872
872
        # Build the path, hasing together the URL and version
873
873
        hash_string = "%s:%s" % (url, version)
874
 
        global_hash = sha256(hash_string.encode('utf-8')).hexdigest()
 
874
        global_hash = sha256(hash_string.encode("utf-8")).hexdigest()
875
875
        path = os.path.realpath(os.path.join(conf.publish_path, "pool",
876
876
                                             "%s-%s.tar.xz" %
877
877
                                             (options.get("name", "http"),
952
952
 
953
953
    with open(path.replace(".tar.xz", ".json"), "w+") as fd:
954
954
        fd.write("%s\n" % json.dumps(metadata, sort_keys=True,
955
 
                                     indent=4, separators=(',', ': ')))
 
955
                                     indent=4, separators=(",", ": ")))
956
956
    gpg.sign_file(conf, "image-signing", path.replace(".tar.xz", ".json"))
957
957
 
958
958
    # Cleanup
991
991
        hash_signature = sha256(fd.read()).hexdigest()
992
992
 
993
993
    hash_string = "%s/%s" % (hash_tarball, hash_signature)
994
 
    global_hash = sha256(hash_string.encode('utf-8')).hexdigest()
 
994
    global_hash = sha256(hash_string.encode("utf-8")).hexdigest()
995
995
 
996
996
    # Build the path
997
997
    path = os.path.realpath(os.path.join(conf.publish_path, "pool",
1035
1035
 
1036
1036
    with open(path.replace(".tar.xz", ".json"), "w+") as fd:
1037
1037
        fd.write("%s\n" % json.dumps(metadata, sort_keys=True,
1038
 
                                     indent=4, separators=(',', ': ')))
 
1038
                                     indent=4, separators=(",", ": ")))
1039
1039
    gpg.sign_file(conf, "image-signing", path.replace(".tar.xz", ".json"))
1040
1040
 
1041
1041
    # Cleanup
1286
1286
 
1287
1287
    with open(path.replace(".tar.xz", ".json"), "w+") as fd:
1288
1288
        fd.write("%s\n" % json.dumps(metadata, sort_keys=True,
1289
 
                                     indent=4, separators=(',', ': ')))
 
1289
                                     indent=4, separators=(",", ": ")))
1290
1290
    gpg.sign_file(conf, "image-signing", path.replace(".tar.xz", ".json"))
1291
1291
 
1292
1292
    # Cleanup