@@ -55,7 +55,7 @@ class AutotoolsConfigureHandler(models.NonAssemblableDatafileHandler):
5555 documentation_url = 'https://www.gnu.org/software/automake/'
5656
5757 @classmethod
58- def parse (cls , location ):
58+ def parse (cls , location , package_only = False ):
5959 # we use the parent directory as a package name
6060 name = fileutils .file_name (fileutils .parent_directory (location ))
6161 # we could use checksums as version in the future
@@ -67,12 +67,13 @@ def parse(cls, location):
6767 # there are dependencies we could use
6868 # dependencies = []
6969
70- yield models . PackageData (
70+ package_data = dict (
7171 datasource_id = cls .datasource_id ,
7272 type = cls .default_package_type ,
7373 name = name ,
7474 version = version ,
7575 )
76+ yield models .PackageData .from_data (package_data , package_only )
7677
7778
7879
@@ -104,6 +105,7 @@ def assemble(cls, package_data, resource, codebase, package_adder):
104105 package = models .Package .from_package_data (
105106 package_data = package_data ,
106107 datafile_path = resource .path ,
108+ package_only = True ,
107109 )
108110
109111 if TRACE :
@@ -135,8 +137,7 @@ def assemble(cls, package_data, resource, codebase, package_adder):
135137 yield resource
136138
137139 @classmethod
138- def parse (cls , location ):
139-
140+ def parse (cls , location , package_only = False ):
140141 # Thanks to Starlark being a Python dialect, we can use `ast` to parse it
141142 with open (location , 'rb' ) as f :
142143 tree = ast .parse (f .read ())
@@ -188,23 +189,28 @@ def parse(cls, location):
188189 if TRACE :
189190 logger_debug (f"build: parse: license_files: { license_files } " )
190191
191- package_data = models . PackageData (
192+ package_data = dict (
192193 datasource_id = cls .datasource_id ,
193194 type = cls .default_package_type ,
194195 name = name ,
196+ extracted_license_statement = license_files ,
197+ )
198+ # `package_only` is True as we do the license detection
199+ # on assembly
200+ yield models .PackageData .from_data (
201+ package_data = package_data ,
202+ package_only = True ,
195203 )
196-
197- package_data .extracted_license_statement = license_files
198- yield package_data
199204
200205 else :
201206 # If we don't find anything in the pkgdata file, we yield a Package
202207 # with the parent directory as the name
203- yield models . PackageData (
208+ package_data = dict (
204209 datasource_id = cls .datasource_id ,
205210 type = cls .default_package_type ,
206211 name = fileutils .file_name (fileutils .parent_directory (location ))
207212 )
213+ yield models .PackageData .from_data (package_data , package_only )
208214
209215 @classmethod
210216 def assign_package_to_resources (cls , package , resource , codebase , package_adder , skip_name = None ):
@@ -326,7 +332,7 @@ class BuckMetadataBzlHandler(BaseStarlarkManifestHandler):
326332 documentation_url = 'https://buck.build/'
327333
328334 @classmethod
329- def parse (cls , location ):
335+ def parse (cls , location , package_only = True ):
330336
331337 with open (location , 'rb' ) as f :
332338 tree = ast .parse (f .read ())
@@ -378,7 +384,7 @@ def parse(cls, location):
378384 ):
379385 # TODO: Create function that determines package type from download URL,
380386 # then create a package of that package type from the metadata info
381- yield models . PackageData (
387+ package_data = dict (
382388 datasource_id = cls .datasource_id ,
383389 type = metadata_fields .get ('upstream_type' , cls .default_package_type ),
384390 name = metadata_fields .get ('name' ),
@@ -388,6 +394,7 @@ def parse(cls, location):
388394 homepage_url = metadata_fields .get ('upstream_address' , '' ),
389395 # TODO: Store 'upstream_hash` somewhere
390396 )
397+ yield models .PackageData .from_data (package_data , package_only = True )
391398
392399 if (
393400 'package_type'
@@ -401,7 +408,7 @@ def parse(cls, location):
401408 and 'vcs_commit_hash'
402409 in metadata_fields
403410 ):
404- yield models . PackageData (
411+ package_data = dict (
405412 datasource_id = cls .datasource_id ,
406413 type = metadata_fields .get ('package_type' , cls .default_package_type ),
407414 name = metadata_fields .get ('name' ),
@@ -414,6 +421,7 @@ def parse(cls, location):
414421 sha1 = metadata_fields .get ('download_archive_sha1' , '' ),
415422 extra_data = dict (vcs_commit_hash = metadata_fields .get ('vcs_commit_hash' , '' ))
416423 )
424+ yield models .PackageData .from_data (package_data , package_only = True )
417425
418426 @classmethod
419427 def assign_package_to_resources (cls , package , resource , codebase , package_adder ):
0 commit comments