Skip to content
This repository was archived by the owner on Dec 12, 2022. It is now read-only.

Commit 853ae07

Browse files
committed
upgrade only the related installed packages
1 parent 2710c04 commit 853ae07

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

debian/install

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
ubports-qa /usr/bin
2+
pkginstall /usr/bin
23
ubports-qa_completion /etc/bash_completion.d

pkginstall

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
branch=$1
3+
arch=$(dpkg --print-architecture)
4+
5+
case "${branch}" in
6+
"xenial"*) repo="repo.ubports.com";;
7+
*) repo="repo2.ubports.com";;
8+
esac
9+
10+
readarray -t pkgs < <(awk '/Package/{print $2}' /var/lib/apt/lists/${repo}_dists_${branch//_/%5f}_main_binary-${arch}_Packages|uniq)
11+
relpkgs=()
12+
for pkg in "${pkgs[@]}"
13+
do
14+
status=$(apt-cache policy $pkg|awk '/Installed/{print $2}')
15+
[ "$status" != "(none)" ] && relpkgs=${relpkgs}" "${pkg}
16+
done
17+
apt install $relpkgs

ubports-qa

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ def apt_upgrade():
9191
except subprocess.CalledProcessError:
9292
LOG.error("Failed to run 'apt full-upgrade'. See the output above for details.")
9393

94-
def apt_install(package)
94+
def apt_install(repository_name):
9595
LOG.debug("upgrading package")
9696
try:
97-
subprocess.run(["apt", "install", package], check=True)
97+
subprocess.run(["pkginstall", repository_name], check=True)
9898
except subprocess.CalledProcessError:
9999
LOG.error("Failed to install Package")
100100

@@ -227,7 +227,7 @@ def install_command(args):
227227
add_list(repository_name)
228228
add_pref(repository_name)
229229
apt_update()
230-
apt_install(args.repo)
230+
apt_install(repository_name)
231231

232232
LOG.info(
233233
"You can remove this repository by running 'sudo ubports-qa remove {}'".format(

0 commit comments

Comments
 (0)