ubuntu-bugcontrol team mailing list archive
-
ubuntu-bugcontrol team
-
Mailing list archive
-
Message #04724
[Merge] ~octagalland/ubuntu-qa-tools:uvt_repo_prioritize_local into ubuntu-qa-tools:master
Octavio Galland has proposed merging ~octagalland/ubuntu-qa-tools:uvt_repo_prioritize_local into ubuntu-qa-tools:master.
Commit message:
make uvt repo prioritize local repository
Requested reviews:
Ubuntu Bug Control (ubuntu-bugcontrol)
For more details, see:
https://code.launchpad.net/~octagalland/ubuntu-qa-tools/+git/ubuntu-qa-tools/+merge/470446
When enabling the local repository with uvt, the user may have added other PPAs with priority pinning (e.g. Ubuntu Pro ppas). In that case we'd like to assign the highest existing priority to the local repo to ensure local packages take precedence during QA testing
--
Your team Ubuntu Bug Control is requested to review the proposed merge of ~octagalland/ubuntu-qa-tools:uvt_repo_prioritize_local into ubuntu-qa-tools:master.
diff --git a/vm-tools/uvt b/vm-tools/uvt
index 36a3c31..b6e5636 100755
--- a/vm-tools/uvt
+++ b/vm-tools/uvt
@@ -20,6 +20,7 @@ import subprocess
import sys
import time
import xml.etree.ElementTree as ET
+from urllib.parse import urlparse
try:
import distro_info
@@ -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
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 &&
+ (cat /etc/apt/preferences.d/* | grep -e \"^Pin-Priority: [0-9]\\+$\" || echo \"Pin-Priority: 500\") | sort -r | 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:
Follow ups