Skip to content

Commit

Permalink
Backout changeset 283408b8d8a3 (bug 603370)
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Mar 8, 2012
1 parent eb676b6 commit 7345f7f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 79 deletions.
4 changes: 2 additions & 2 deletions config/config.mk
Expand Up @@ -789,8 +789,8 @@ EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config
EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist $(if $(REORDER),--reorder $(REORDER))-- $(LD)
EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) --uselist $(if $(REORDER),--reorder $(REORDER))-- $(MKSHLIB)
EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) --uselist -- $(MKSHLIB)

ifdef STDCXX_COMPAT
ifneq ($(OS_ARCH),Darwin)
Expand Down
27 changes: 1 addition & 26 deletions config/expandlibs_exec.py
Expand Up @@ -48,10 +48,6 @@
EXPAND_LIBS_LIST_STYLE variable: 'list' for MSVC style lists (@file.list)
or 'linkerscript' for GNU ld linker scripts.
See https://bugzilla.mozilla.org/show_bug.cgi?id=584474#c59 for more details.
With the --reorder argument, followed by a file name, it will reorder the
object files from the command line according to the order given in the file.
Implies --extract.
'''
from __future__ import with_statement
import sys
Expand Down Expand Up @@ -129,22 +125,6 @@ def makelist(self):
newlist = self[0:idx] + [ref] + [item for item in self[idx:] if item not in objs]
self[0:] = newlist

def reorder(self, order_list):
'''Given a list of file names without OBJ_SUFFIX, rearrange self
so that the object file names it contains are ordered according to
that list.
'''
objs = [o for o in self if isObject(o)]
if not objs: return
idx = self.index(objs[0])
# Keep everything before the first object, then the ordered objects,
# then any other objects, then any non-objects after the first object
objnames = dict([(os.path.splitext(os.path.basename(o))[0], o) for o in objs])
self[0:] = self[0:idx] + [objnames[o] for o in order_list if o in objnames] + \
[o for o in objs if os.path.splitext(os.path.basename(o))[0] not in order_list] + \
[x for x in self[idx:] if not isObject(x)]


def main():
parser = OptionParser()
parser.add_option("--extract", action="store_true", dest="extract",
Expand All @@ -153,17 +133,12 @@ def main():
help="use a list file for objects when executing a command")
parser.add_option("--verbose", action="store_true", dest="verbose",
help="display executed command and temporary files content")
parser.add_option("--reorder", dest="reorder",
help="reorder the objects according to the given list", metavar="FILE")

(options, args) = parser.parse_args()

with ExpandArgsMore(args) as args:
if options.extract or options.reorder:
if options.extract:
args.extract()
if options.reorder:
with open(options.reorder) as file:
args.reorder([l.strip() for l in file.readlines()])
if options.uselist:
args.makelist()

Expand Down
23 changes: 0 additions & 23 deletions config/tests/unit-expandlibs.py
Expand Up @@ -267,28 +267,5 @@ def call(args, **kargs):
# Restore subprocess.call
subprocess.call = subprocess_call

def test_reorder(self):
'''Test object reordering'''
# We don't care about AR_EXTRACT testing, which is done in test_extract
config.AR_EXTRACT = ''

# ExpandArgsMore does the same as ExpandArgs
with ExpandArgsMore(['foo', '-bar'] + self.arg_files + [self.tmpfile('liby', Lib('y'))]) as args:
self.assertRelEqual(args, ['foo', '-bar'] + self.files + self.liby_files + self.libx_files)

# Use an order containing object files from libraries
order_files = [self.libx_files[1], self.libx_files[0], self.liby_files[2], self.files[1]]
order = [os.path.splitext(os.path.basename(f))[0] for f in order_files]
args.reorder(order[:2] + ['unknown'] + order[2:])

# self.files has objects at #1, #2, #4
self.assertRelEqual(args[:3], ['foo', '-bar'] + self.files[:1])
self.assertRelEqual(args[3:7], order_files)
self.assertRelEqual(args[7:9], [self.files[2], self.files[4]])
self.assertRelEqual(args[9:11], self.liby_files[:2])
self.assertRelEqual(args[11:12], [self.libx_files[2]])
self.assertRelEqual(args[12:14], [self.files[3], self.files[5]])
self.assertRelEqual(args[14:], [self.liby_files[3]])

if __name__ == '__main__':
unittest.main(testRunner=MozTestRunner())
4 changes: 2 additions & 2 deletions js/src/config/config.mk
Expand Up @@ -789,8 +789,8 @@ EXPAND_LIBS_GEN = $(PYTHON) $(topsrcdir)/config/pythonpath.py -I$(DEPTH)/config
EXPAND_AR = $(EXPAND_LIBS_EXEC) --extract -- $(AR)
EXPAND_CC = $(EXPAND_LIBS_EXEC) --uselist -- $(CC)
EXPAND_CCC = $(EXPAND_LIBS_EXEC) --uselist -- $(CCC)
EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist $(if $(REORDER),--reorder $(REORDER))-- $(LD)
EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) --uselist $(if $(REORDER),--reorder $(REORDER))-- $(MKSHLIB)
EXPAND_LD = $(EXPAND_LIBS_EXEC) --uselist -- $(LD)
EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) --uselist -- $(MKSHLIB)

ifdef STDCXX_COMPAT
ifneq ($(OS_ARCH),Darwin)
Expand Down
27 changes: 1 addition & 26 deletions js/src/config/expandlibs_exec.py
Expand Up @@ -48,10 +48,6 @@
EXPAND_LIBS_LIST_STYLE variable: 'list' for MSVC style lists (@file.list)
or 'linkerscript' for GNU ld linker scripts.
See https://bugzilla.mozilla.org/show_bug.cgi?id=584474#c59 for more details.
With the --reorder argument, followed by a file name, it will reorder the
object files from the command line according to the order given in the file.
Implies --extract.
'''
from __future__ import with_statement
import sys
Expand Down Expand Up @@ -129,22 +125,6 @@ def makelist(self):
newlist = self[0:idx] + [ref] + [item for item in self[idx:] if item not in objs]
self[0:] = newlist

def reorder(self, order_list):
'''Given a list of file names without OBJ_SUFFIX, rearrange self
so that the object file names it contains are ordered according to
that list.
'''
objs = [o for o in self if isObject(o)]
if not objs: return
idx = self.index(objs[0])
# Keep everything before the first object, then the ordered objects,
# then any other objects, then any non-objects after the first object
objnames = dict([(os.path.splitext(os.path.basename(o))[0], o) for o in objs])
self[0:] = self[0:idx] + [objnames[o] for o in order_list if o in objnames] + \
[o for o in objs if os.path.splitext(os.path.basename(o))[0] not in order_list] + \
[x for x in self[idx:] if not isObject(x)]


def main():
parser = OptionParser()
parser.add_option("--extract", action="store_true", dest="extract",
Expand All @@ -153,17 +133,12 @@ def main():
help="use a list file for objects when executing a command")
parser.add_option("--verbose", action="store_true", dest="verbose",
help="display executed command and temporary files content")
parser.add_option("--reorder", dest="reorder",
help="reorder the objects according to the given list", metavar="FILE")

(options, args) = parser.parse_args()

with ExpandArgsMore(args) as args:
if options.extract or options.reorder:
if options.extract:
args.extract()
if options.reorder:
with open(options.reorder) as file:
args.reorder([l.strip() for l in file.readlines()])
if options.uselist:
args.makelist()

Expand Down

0 comments on commit 7345f7f

Please sign in to comment.