mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 9d1f7f04a682 (bug 1230060) to complete backout
This commit is contained in:
parent
28c88033a4
commit
b445fe3546
@ -5,16 +5,8 @@
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from mozpack.copier import (
|
||||
FileCopier,
|
||||
FileRegistry,
|
||||
)
|
||||
from mozpack.files import (
|
||||
BaseFile,
|
||||
FileFinder,
|
||||
)
|
||||
from mozpack.copier import FileCopier
|
||||
from mozpack.manifests import InstallManifest
|
||||
|
||||
|
||||
@ -22,49 +14,22 @@ COMPLETE = 'From {dest}: Kept {existing} existing; Added/updated {updated}; ' \
|
||||
'Removed {rm_files} files and {rm_dirs} directories.'
|
||||
|
||||
|
||||
def process_manifest(destdir, paths, track=None,
|
||||
def process_manifest(destdir, paths,
|
||||
remove_unaccounted=True,
|
||||
remove_all_directory_symlinks=True,
|
||||
remove_empty_directories=True,
|
||||
defines={}):
|
||||
|
||||
if track:
|
||||
if os.path.exists(track):
|
||||
# We use the same format as install manifests for the tracking
|
||||
# data.
|
||||
manifest = InstallManifest(path=track)
|
||||
remove_unaccounted = FileRegistry()
|
||||
dummy_file = BaseFile()
|
||||
|
||||
finder = FileFinder(destdir, find_executables=False,
|
||||
find_dotfiles=True)
|
||||
for dest in manifest._dests:
|
||||
if '*' in dest:
|
||||
for p, f in finder.find(dest):
|
||||
remove_unaccounted.add(p, dummy_file)
|
||||
else:
|
||||
remove_unaccounted.add(dest, dummy_file)
|
||||
else:
|
||||
# If tracking is enabled and there is no file, we don't want to
|
||||
# be removing anything.
|
||||
remove_unaccounted=False
|
||||
|
||||
manifest = InstallManifest()
|
||||
for path in paths:
|
||||
manifest |= InstallManifest(path=path)
|
||||
|
||||
copier = FileCopier()
|
||||
manifest.populate_registry(copier, defines_override=defines)
|
||||
result = copier.copy(destdir,
|
||||
return copier.copy(destdir,
|
||||
remove_unaccounted=remove_unaccounted,
|
||||
remove_all_directory_symlinks=remove_all_directory_symlinks,
|
||||
remove_empty_directories=remove_empty_directories)
|
||||
|
||||
if track:
|
||||
manifest.write(path=track)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
class DefinesAction(argparse.Action):
|
||||
def __call__(self, parser, namespace, values, option_string):
|
||||
@ -94,8 +59,6 @@ def main(argv):
|
||||
help='Do not remove all directory symlinks from destination.')
|
||||
parser.add_argument('--no-remove-empty-directories', action='store_true',
|
||||
help='Do not remove empty directories from destination.')
|
||||
parser.add_argument('--track', metavar="PATH",
|
||||
help='Use installed files tracking information from the given path.')
|
||||
parser.add_argument('-D', action=DefinesAction,
|
||||
dest='defines', metavar="VAR[=VAL]",
|
||||
help='Define a variable to override what is specified in the manifest')
|
||||
@ -103,7 +66,7 @@ def main(argv):
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
result = process_manifest(args.destdir, args.manifests,
|
||||
track=args.track, remove_unaccounted=not args.no_remove,
|
||||
remove_unaccounted=not args.no_remove,
|
||||
remove_all_directory_symlinks=not args.no_remove_all_directory_symlinks,
|
||||
remove_empty_directories=not args.no_remove_empty_directories,
|
||||
defines=args.defines)
|
||||
|
Loading…
Reference in New Issue
Block a user