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

Commit

Permalink
upgrade only the related installed packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuseteam committed Mar 6, 2022
1 parent 2710c04 commit 853ae07
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions debian/install
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ubports-qa /usr/bin
pkginstall /usr/bin
ubports-qa_completion /etc/bash_completion.d
17 changes: 17 additions & 0 deletions pkginstall
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
branch=$1
arch=$(dpkg --print-architecture)

case "${branch}" in
"xenial"*) repo="repo.ubports.com";;
*) repo="repo2.ubports.com";;
esac

readarray -t pkgs < <(awk '/Package/{print $2}' /var/lib/apt/lists/${repo}_dists_${branch//_/%5f}_main_binary-${arch}_Packages|uniq)
relpkgs=()
for pkg in "${pkgs[@]}"
do
status=$(apt-cache policy $pkg|awk '/Installed/{print $2}')
[ "$status" != "(none)" ] && relpkgs=${relpkgs}" "${pkg}
done
apt install $relpkgs
6 changes: 3 additions & 3 deletions ubports-qa
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ def apt_upgrade():
except subprocess.CalledProcessError:
LOG.error("Failed to run 'apt full-upgrade'. See the output above for details.")

def apt_install(package)
def apt_install(repository_name):
LOG.debug("upgrading package")
try:
subprocess.run(["apt", "install", package], check=True)
subprocess.run(["pkginstall", repository_name], check=True)
except subprocess.CalledProcessError:
LOG.error("Failed to install Package")

Expand Down Expand Up @@ -227,7 +227,7 @@ def install_command(args):
add_list(repository_name)
add_pref(repository_name)
apt_update()
apt_install(args.repo)
apt_install(repository_name)

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

0 comments on commit 853ae07

Please sign in to comment.