← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] lp:~maxiberta/launchpad/snap-name-extraction into lp:launchpad

 


Diff comments:

> === modified file 'lib/lp/snappy/browser/snap.py'
> --- lib/lp/snappy/browser/snap.py	2016-05-23 19:44:07 +0000
> +++ lib/lp/snappy/browser/snap.py	2016-05-23 19:44:08 +0000
> @@ -357,12 +360,32 @@
>  
>      @property
>      def initial_values(self):
> +        store_name = None
> +        if self.has_snappy_series and IGitRef.providedBy(self.context):

Good catch, thanks. Merged devel and fixed all conflicts.

> +            # Try to extract Snap store name from snapcraft.yaml file.
> +            try:
> +                blob = self.context.repository.getBlob(
> +                    'snapcraft.yaml', self.context.name)
> +                # Beware of unsafe yaml.load()!
> +                store_name = yaml.safe_load(blob).get('name')
> +            except GitRepositoryScanFault:
> +                log.exception("Failed to get Snap manifest from Git %s",
> +                              self.context.unique_name)
> +            except (AttributeError, yaml.YAMLError):
> +                # Ignore parsing errors from invalid, user-supplied YAML
> +                pass
> +            except Exception as e:
> +                log.exception(
> +                    "Failed to extract name from Snap manifest at Git %s: %s",
> +                    self.context.unique_name, unicode(e))
> +
>          # XXX cjwatson 2015-09-18: Hack to ensure that we don't end up
>          # accidentally selecting ubuntu-rtm/14.09 or similar.
>          # ubuntu.currentseries will always be in BuildableDistroSeries.
>          series = getUtility(ILaunchpadCelebrities).ubuntu.currentseries
>          sds_set = getUtility(ISnappyDistroSeriesSet)
>          return {
> +            'store_name': store_name,
>              'owner': self.user,
>              'store_distro_series': sds_set.getByDistroSeries(series).first(),
>              }


-- 
https://code.launchpad.net/~maxiberta/launchpad/snap-name-extraction/+merge/295114
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.


References