Browse Source

Adds update function

docker
Ryan McGuire 7 years ago
parent
commit
b91db4ddee
  1. 3
      .gitignore
  2. 40
      arch-ppa

3
.gitignore vendored

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
chroot
*~
pkg
src/**/*.gz
src/**/*.xz
src/**/*.log

40
arch-ppa

@ -39,6 +39,7 @@ install_system_deps() { @@ -39,6 +39,7 @@ install_system_deps() {
fi
}
pkg_dep devtools
pkg_dep git
)
}
@ -132,6 +133,45 @@ add() { @@ -132,6 +133,45 @@ add() {
)
}
update() {
# Update a package and it's dependencies from the AUR
(
set -e
if [ ! -d $basedir/src/$1 ]; then
echo "No package called $1 found in src"
return 1
fi
for pkg in "$@"; do
check_in_git() {
(
cd $basedir
if (! git ls-files $1 --error-unmatch >/dev/null 2>&1); then
echo "$1 is not under git control yet. Add and commit it before updating."
return 1
fi
)
}
check_in_git $basedir/src
check_in_git $basedir/src/$pkg
find_deps $pkg | while read dep; do
check_in_git $basedir/src/$dep
done
# Check if package has uncommited changes
if [ $(git -C $basedir diff HEAD $basedir/src/$pkg | wc -l) -gt 0 ]; then
echo "Package $pkg has uncommited changes. Commit or discard those changes first."
return 1
fi
# Use a temporary dir to download all PKGBUILDS atomically
[ -z "$tmp_dl" ] && tmp_dl=`mktemp -d`
cd $tmp_dl
arch-nspawn $chroot/root --bind=$tmp_dl:/src cower -q -t /src -d -d $pkg >/dev/null 2>&1
cp -a * $basedir/src
done
git -C $basedir diff --name-status $basedir/src/
)
}
list() {
if [ "$#" -ne 1 ]; then
echo "Must specify repository name to list"

Loading…
Cancel
Save