← Back to team overview

ubuntu-bugcontrol team mailing list archive

Re: [Merge] ~octagalland/ubuntu-qa-tools:uvt_repo_prioritize_local into ubuntu-qa-tools:master

 

Review: Needs Fixing

Nice - thanks for this - just one comment about the priority value - I think we should be explicit and configure the repo with a higher priority value, hence I suggest adding 1 to the value obtained from apt-cache policy.

Diff comments:

> diff --git a/vm-tools/uvt b/vm-tools/uvt
> index 36a3c31..72bd51b 100755
> --- a/vm-tools/uvt
> +++ b/vm-tools/uvt
> @@ -1154,16 +1155,25 @@ def vm_update_local_repo(vm_name, release, enable=True):
>          return False
>  
>      sources_file = "/etc/apt/sources.list.d/uvt-repo.list"
> +    preferences_file = "/etc/apt/preferences.d/uvt-test-repo"
> +    repo_url = uvt_conf['vm_repo_url']
> +    repo_host = urlparse(repo_url).netloc.split(':')[0]
>  
>      if enable == True:
>          print("Enabling %s for %s" % (uvt_conf['vm_repo_url'], vm_name))
> -        command = "bash -c 'echo -e \"deb %(repo_url)s %(release)s/\ndeb-src %(repo_url)s %(release)s/\" > %(sources)s'" \
> -                   % { 'repo_url': uvt_conf['vm_repo_url'],
> +        command = "bash -c ' \
> +            echo -e \"Package: *\" > %(preferences)s && \
> +            echo -e \"Pin: origin %(repo_host)s\" >> %(preferences)s && \
> +            echo -e \"Pin-Priority: $(apt-cache policy | grep -e \"^ [0-9]\\+ \" | awk \"{print \\$1}\" | sort -nr | head -n1)\" >> %(preferences)s && \

Do we need a priority greater than anything already configured (rather than the same which is what this code is doing)?

e.g. should this be something like the following to add 1 to the priority value:

echo -e \"Pin-Priority: $(apt-cache policy | grep -e \"^ [0-9]\\+ \" | awk \"{print \\$1 + 1}\" | sort -nr | head -n1)\" >> %(preferences)s && \

> +            echo -e \"deb %(repo_url)s %(release)s/\ndeb-src %(repo_url)s %(release)s/\" > %(sources)s'" \
> +                   % { 'repo_url': repo_url,
>                         'release': release,
> -                       'sources': sources_file }
> +                       'sources': sources_file,
> +                       'preferences': preferences_file,
> +                       'repo_host': repo_host }
>      else:
>          print("Disabling %s for %s" % (uvt_conf['vm_repo_url'], vm_name))
> -        command = "rm -f %s" % sources_file
> +        command = "rm -f %s %s" % (sources_file, preferences_file)
>  
>      result = vm_run_command(vm_name, command, root=True, force_keys=True)
>      if result == True:


-- 
https://code.launchpad.net/~octagalland/ubuntu-qa-tools/+git/ubuntu-qa-tools/+merge/470446
Your team Ubuntu Bug Control is subscribed to branch ubuntu-qa-tools:master.



Follow ups

References