Last active
August 28, 2019 19:28
Revisions
-
minexew revised this gist
Aug 28, 2019 . 3 changed files with 109 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ #!/usr/bin/env python # Convert a generic manifest to a repo manifest # Example usage: mf-generic-to-repo PkgBin/Wget.MF packages/wget packages/files/Wget.ISO.C from __future__ import print_function import os import sys if len(sys.argv) < 4: print('usage: mf-local-to-repo.py <manifest-in> <manifest-out> <installable>') sys.exit(-1) MANIFEST_IN = sys.argv[1] MANIFEST_OUT = sys.argv[2] INSTALLABLE = sys.argv[3] manifest = {} with open(MANIFEST_IN, 'rb') as in_: for line in in_: (key, value) = line.rstrip().split('\t') manifest[key] = value #print(manifest) manifest['iso.c'] = os.path.relpath(INSTALLABLE, os.path.dirname(MANIFEST_OUT)) manifest['size'] = os.stat(INSTALLABLE).st_size with open(MANIFEST_OUT, 'wb') as out: for key in sorted(manifest): print(key, manifest[key], sep='\t', file=out) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ #!/usr/bin/env python from __future__ import print_function import os import sys if len(sys.argv) < 6: print('usage: update-package.py <dir> <name> <release> <version> <filename>') sys.exit(-1) DIR = sys.argv[1] PKGNAME = sys.argv[2] RELEASE = sys.argv[3] VERSION = sys.argv[4] FILENAME = sys.argv[5] MANIFEST = os.path.join(DIR, PKGNAME) TMP = 'package.tmp' manifest = {} with open(MANIFEST, 'rb') as in_: for line in in_: (key, value) = line.rstrip().split('\t') manifest[key] = value #print(manifest) manifest['iso.c'] = FILENAME manifest['release'] = RELEASE manifest['version'] = VERSION manifest['size'] = os.stat(os.path.join(DIR, FILENAME)).st_size with open(TMP, 'wb') as out: for k, v in manifest.iteritems(): print(k, v, sep='\t', file=out) os.rename(TMP, MANIFEST) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ #!/usr/bin/env python from __future__ import print_function import os import sys if len(sys.argv) < 5: print('usage: update-package2.py <dir> <name> <manifest> <filename>') sys.exit(-1) DIR = sys.argv[1] PKGNAME = sys.argv[2] MANIFEST = sys.argv[3] FILENAME = sys.argv[4] MANIFEST_OUT = os.path.join(DIR, PKGNAME) TMP = 'package.tmp' manifest = {} with open(MANIFEST, 'rb') as in_: for line in in_: (key, value) = line.rstrip().split('\t') manifest[key] = value #print(manifest) manifest['iso.c'] = FILENAME manifest['size'] = os.stat(os.path.join(DIR, FILENAME)).st_size with open(TMP, 'wb') as out: for k, v in manifest.iteritems(): print(k, v, sep='\t', file=out) os.rename(TMP, MANIFEST_OUT) -
minexew created this gist
Aug 28, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/usr/bin/env python #usage: build-package-list.py <directory> from __future__ import print_function import os import sys DIR = sys.argv[1] TMP = 'packages.list.tmp' files = os.listdir(DIR) with open(TMP, 'wb') as out: for entry in sorted(files): if not '.' in entry and os.path.isfile(os.path.join(DIR, entry)): print(entry, file=out) os.rename(TMP, os.path.join(DIR, 'packages.list'))