Bug 1360525 - Separate repackage out into subcommands; r=chmanchester

With multiple types of repackaging, it will be simpler to manage the
various commands if they are organized as sub-commands. This way the
different repackage types can take varying arguments, and we don't have
to guess on the repackage type based on the output filename.

MozReview-Commit-ID: BknRPAwFG5H

--HG--
extra : rebase_source : e74a9776a73791e41ada4038a8bb2ddd243d0de8
This commit is contained in:
Mike Shal 2017-05-03 15:06:44 -04:00
Родитель 865741ad85
Коммит b2d607154b
2 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -1942,11 +1942,16 @@ class Repackage(MachCommandBase):
'''
@Command('repackage', category='misc',
description='Repackage artifacts into different formats.')
def repackage(self):
print("Usage: ./mach repackage [dmg|installer|mar] [args...]")
@SubCommand('repackage', 'dmg',
description='Repackage a tar file into a .dmg for OSX')
@CommandArgument('--input', '-i', type=str, required=True,
help='Input filename')
@CommandArgument('--output', '-o', type=str, required=True,
help='Output filename')
def repackage(self, input, output):
def repackage_dmg(self, input, output):
if not os.path.exists(input):
print('Input file does not exist: %s' % input)
return 1
@ -1956,10 +1961,5 @@ class Repackage(MachCommandBase):
'prior to |mach repackage|.')
return 1
if output.endswith('.dmg'):
from mozbuild.repackaging.dmg import repackage_dmg
repackage_dmg(input, output)
else:
print("Repackaging into output '%s' is not yet supported." % output)
return 1
return 0
from mozbuild.repackaging.dmg import repackage_dmg
repackage_dmg(input, output)

Просмотреть файл

@ -81,6 +81,7 @@ class Repackage(BaseScript):
infile = os.path.join(config['input_home'], config['input_filename'])
outfile = os.path.join(dirs['abs_upload_dir'], config['output_filename'])
command = [sys.executable, 'mach', '--log-no-times', 'repackage',
'dmg',
'--input', infile,
'--output', outfile]
return self.run_command(