mirror of
https://github.com/moparisthebest/arch-ppa
synced 2024-11-24 09:32:19 -05:00
Adds update function
This commit is contained in:
parent
a67d1c7740
commit
b91db4ddee
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
chroot
|
chroot
|
||||||
*~
|
*~
|
||||||
pkg
|
pkg
|
||||||
|
src/**/*.gz
|
||||||
|
src/**/*.xz
|
||||||
|
src/**/*.log
|
40
arch-ppa
40
arch-ppa
@ -39,6 +39,7 @@ install_system_deps() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
pkg_dep devtools
|
pkg_dep devtools
|
||||||
|
pkg_dep git
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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() {
|
list() {
|
||||||
if [ "$#" -ne 1 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo "Must specify repository name to list"
|
echo "Must specify repository name to list"
|
||||||
|
Loading…
Reference in New Issue
Block a user