[Merge] lp:~jamesodhunt/ubuntu/vivid/ubuntu-core-upgrader/allow-assets-unpack into lp:ubuntu/ubuntu-core-upgrader

Steve Langasek steve.langasek at canonical.com
Sat Feb 21 00:59:58 UTC 2015


Review: Approve

Comments inline below.

This will break the ability to use --root-dir for testing, with any tarball that contains assets.  I don't think we are blocked on this, but it bears mentioning.

Diff comments:

> === modified file 'debian/changelog'
> --- debian/changelog	2015-02-20 18:00:11 +0000
> +++ debian/changelog	2015-02-20 18:04:43 +0000
> @@ -1,3 +1,4 @@
> +<<<<<<< TREE
>  ubuntu-core-upgrader (0.7) UNRELEASED; urgency=medium
>  
>    * Move this from the ppa to the main archive.
> @@ -5,6 +6,16 @@
>  
>   -- Steve Langasek <steve.langasek at ubuntu.com>  Fri, 20 Feb 2015 09:58:54 -0800
>  
> +=======
> +ubuntu-core-upgrader (0.6~ppa25) UNRELEASED; urgency=medium
> +
> +  * ubuntucoreupgrader/upgrader.py:
> +    - tar_generator(): Permit unpack of assets/ directory to allow snappy to
> +      install them (and clean up).
> +
> + -- James Hunt <james.hunt at ubuntu.com>  Fri, 20 Feb 2015 14:55:46 +0000
> +
> +>>>>>>> MERGE-SOURCE
>  ubuntu-core-upgrader (0.6~ppa24) vivid; urgency=low

ignorable, I can take care of this on merge.

>  
>    * support new "config.machine_readable" option
> 
> === modified file 'ubuntucoreupgrader/upgrader.py'
> --- ubuntucoreupgrader/upgrader.py	2015-01-30 11:51:24 +0000
> +++ ubuntucoreupgrader/upgrader.py	2015-02-20 18:04:43 +0000
> @@ -85,6 +85,11 @@
>  # - if the file '/etc/bar' should be modified, it
>  #   would be specified in the tar file as member 'system/etc/bar'.
>  TAR_FILE_SYSTEM_PREFIX = 'system/'
> +
> +# boot assets (kernel, initrd, .dtb's)
> +# (XXX: note no trailing slash to ensure we unpack the directory itself).
> +TAR_FILE_ASSETS_PREFIX = 'assets'
> +

inconsistent use of trailing slash.  This needs to be 'assets/', to ensure that this is actually a *directory* prefix.

>  TAR_FILE_REMOVED_FILE = 'removed'
>  
>  SYSTEM_IMAGE_CHANNEL_CONFIG = '/etc/system-image/channel.ini'
> @@ -1443,19 +1448,32 @@
>              # - Don't unpack the removed file.
>              # - Don't unpack device files *iff* they already exist.
>              # - Don't unpack files that are not below
> -            #   TAR_FILE_SYSTEM_PREFIX.
> +            #   TAR_FILE_SYSTEM_PREFIX or TAR_FILE_ASSETS_PREFIX.
>              #
>              # - XXX: This is a temporary function to work-around for
>              #   LP: #1381121: we shouldn't need to filter which files are
>              #   extracted!
> -            prefix = '{}dev/'.format(TAR_FILE_SYSTEM_PREFIX)
> +            device_prefix = '{}dev/'.format(TAR_FILE_SYSTEM_PREFIX)
>  
>              mount_path = '{}/{}'.format(self.get_cache_dir(), member.name)
>  
> -            if (member.name == self.removed_file) or \
> -               ((member.name.startswith(prefix) and
> -                   os.path.exists(mount_path)) or
> -                   not member.name.startswith(TAR_FILE_SYSTEM_PREFIX)):
> +            unpack = True
> +
> +            if member.name == self.removed_file:
> +                # already handled
> +                unpack = False
> +
> +            if member.name.startswith(device_prefix) and \
> +                    os.path.exists(mount_path):
> +                # device already exists
> +                unpack = False
> +
> +            if not (member.name.startswith(TAR_FILE_SYSTEM_PREFIX) or
> +                    member.name.startswith(TAR_FILE_ASSETS_PREFIX)):
> +                # unrecognised prefix directory
> +                unpack = False
> +
> +            if not unpack:
>                  log.debug('not unpacking file {}'.format(member.name))
>              else:
>                  # A modified root directory requires convering
> 


-- 
https://code.launchpad.net/~jamesodhunt/ubuntu/vivid/ubuntu-core-upgrader/allow-assets-unpack/+merge/250493
Your team Ubuntu branches is subscribed to branch lp:ubuntu/ubuntu-core-upgrader.



More information about the Ubuntu-reviews mailing list