| ... | ... | @@ -168,6 +168,7 @@ from contextlib import contextmanager | 
| 168 | 168 |  from . import Plugin, Consistency
 | 
| 169 | 169 |  from . import _yaml, utils
 | 
| 170 | 170 |  from ._exceptions import BstError, ImplError, ErrorDomain
 | 
|  | 171 | +from ._loader.metasource import MetaSource
 | 
| 171 | 172 |  from ._projectrefs import ProjectRefStorage
 | 
| 172 | 173 |  
 | 
| 173 | 174 |  
 | 
| ... | ... | @@ -299,9 +300,6 @@ class Source(Plugin): | 
| 299 | 300 |          self.__expected_alias = None                    # The primary alias
 | 
| 300 | 301 |          self.__marked_urls = set()                      # Set of marked download URLs
 | 
| 301 | 302 |  
 | 
| 302 |  | -        # FIXME: Reconstruct a MetaSource from a Source instead of storing it.
 | 
| 303 |  | -        self.__meta = meta                              # MetaSource stored so we can copy this source later.
 | 
| 304 |  | -
 | 
| 305 | 303 |          # Collect the composited element configuration and
 | 
| 306 | 304 |          # ask the element to configure itself.
 | 
| 307 | 305 |          self.__init_defaults(meta)
 | 
| ... | ... | @@ -984,7 +982,19 @@ class Source(Plugin): | 
| 984 | 982 |          alias = self._get_alias()
 | 
| 985 | 983 |          source_kind = type(self)
 | 
| 986 | 984 |  
 | 
| 987 |  | -        clone = source_kind(context, project, self.__meta, alias_override=(alias, uri))
 | 
|  | 985 | +        # Rebuild a MetaSource from the current element
 | 
|  | 986 | +        meta = MetaSource(
 | 
|  | 987 | +            self.__element_name,
 | 
|  | 988 | +            self.__element_index,
 | 
|  | 989 | +            self.__element_kind,
 | 
|  | 990 | +            self.get_kind(),
 | 
|  | 991 | +            self.__config,
 | 
|  | 992 | +            self.__directory,
 | 
|  | 993 | +        )
 | 
|  | 994 | +
 | 
|  | 995 | +        meta.first_pass = self.__first_pass
 | 
|  | 996 | +
 | 
|  | 997 | +        clone = source_kind(context, project, meta, alias_override=(alias, uri))
 | 
| 988 | 998 |  
 | 
| 989 | 999 |          # Do the necessary post instantiation routines here
 | 
| 990 | 1000 |          #
 |