update readme output, fix ok packages crashing

This commit is contained in:
Felix Pankratz 2023-07-02 16:11:46 +02:00
parent c64e239dd2
commit 33c9cdec7e
2 changed files with 8 additions and 5 deletions

View File

@ -20,12 +20,11 @@ Version mismatch for darcyclarke-manifest-pkg!
Reported version: 2.1.15 Reported version: 2.1.15
Actual version: 3.0.0 Actual version: 3.0.0
Dependency mismatch detected for darcyclarke-manifest-pkg! Dependency mismatch detected for darcyclarke-manifest-pkg!
Reported dependencies: {} {'dictionary_item_added': {"root['sleepover']": '*'}}
Actual dependencies: {'sleepover': '*'}
Scripts mismatch detected for darcyclarke-manifest-pkg! Scripts mismatch detected for darcyclarke-manifest-pkg!
Reported scripts: {} { 'dictionary_item_added': { "root['install']": 'touch ./bad-pkg-write && echo '
Actual scripts: {'install': 'touch ./bad-pkg-write && echo "bad pkg exec!"\n'} '"bad pkg exec!"\n'}}
Name mismatch detected for darcyclarke-manifest-pkg! Name mismatch detected for Package(name='darcyclarke-manifest-pkg', reported_manifest=Manifest(name='darcyclarke-manifest-pkg', version='2.1.15', dependencies={}, scripts={}), actual_manifest=Manifest(name='express', version='3.0.0', dependencies={'sleepover': '*'}, scripts={'install': 'touch ./bad-pkg-write && echo "bad pkg exec!"\n'}))!
Reported name: darcyclarke-manifest-pkg Reported name: darcyclarke-manifest-pkg
Actual name: express Actual name: express
``` ```

View File

@ -94,6 +94,7 @@ def parse_actual_manifest(pkg, ver):
return Manifest(name, version, dependencies, scripts) return Manifest(name, version, dependencies, scripts)
def compare_manifests(pkg): def compare_manifests(pkg):
mismatch = False
if pkg.reported_manifest.version != pkg.actual_manifest.version: if pkg.reported_manifest.version != pkg.actual_manifest.version:
mismatch = True mismatch = True
print('Version mismatch for {}!'.format(pkg.name)) print('Version mismatch for {}!'.format(pkg.name))
@ -120,6 +121,9 @@ def compare_manifests(pkg):
print('Reported name: {}'.format(pkg.reported_manifest.name)) print('Reported name: {}'.format(pkg.reported_manifest.name))
print('Actual name: {}'.format(pkg.actual_manifest.name)) print('Actual name: {}'.format(pkg.actual_manifest.name))
if not mismatch:
print('No mismatch detected for {}.'.format(pkg.name))
return mismatch return mismatch