Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work on Show PKGBUILD diff when updating a package issue #62

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions aurget
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Usage: aurget [ -h | -S* [ --options ] [ -- ] <arguments> ]
build in <directory>

--devel only affects -Su, add all development packages

--clean Removes pkgbuild files

--deps resolve dependencies
--nodeps don't resolve dependencies
Expand Down Expand Up @@ -166,14 +168,20 @@ searching() { [[ "$opmode" == 'search' ]]; }

upgrading() { [[ "$opmode" == 'upgrade' ]]; }

clean() { [[ "$opmode" == 'clean' ]]; }

resolving() { $resolve_dependencies; }

eager_sudo() { $eager_sudo; }

create_temp_directory() {
debug "storing temporary files in $colorM$temp_directory$nocolor"
mkdir -p "$temp_directory" || die 'unable to create temp directory'
rm -rf "${temp_directory:?}"/*
create_package_directory() {
if [[ ! -d $cache_directory ]]; then
mkdir "$cache_directory" || die 'unable to create package directory'
fi
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not formatted correctly. Please use the other if expressions in the file as examples.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I will take a look.

}

clean_package_directory() {
rm -rf "${cache_directory:?}"/*
}

enter_build_directory() {
Expand Down Expand Up @@ -288,6 +296,7 @@ initialize() {
--ignore) shift; ignore_packages+=" $1" ;;
--noconfirm) noconfirm=true; makepkg_options+=' --noconfirm' ;;
--devel) devels=true ;;
--clean) opmode='clean' ;;
--deps) resolve_dependencies=true ;;
--nodeps) resolve_dependencies=false ;;
--edit) edit_pkgbuilds='always' ;;
Expand Down Expand Up @@ -331,7 +340,8 @@ set_defaults() {
silent=false
sort_mode='name'
sync_mode='install'
temp_directory='/tmp/aurget'
cache_directory="${XDG_CACHE_HOME:-$HOME/.cache}/aurget"
temp_directory="/tmp/aurget"
user_config="${XDG_CONFIG_HOME:-$HOME/.config}/aurgetrc"

EDITOR="${EDITOR:-$VISUAL}"
Expand Down Expand Up @@ -470,7 +480,7 @@ output_upgrade() {
# Resolve dependencies {{{
resolve_dependencies() {
info 'Resolving dependencies...'
create_temp_directory
create_package_directory
resolve "${arguments[@]}"
}

Expand Down Expand Up @@ -503,7 +513,9 @@ resolve() {

source_pkgbuild() {
local name="$1" pkgbuild="$temp_directory/${1}_PKGBUILD"

rpc_info "$@"
mv $tmp_directory/${1}_PKGBUILD $cache/$name/$version/PKGBUILD
pkgbuild="$cache/$name/$version/PKGBUILD"
if [[ ! -f "$pkgbuild" ]]; then
if pkgbuild "$name" > "$pkgbuild"; then
debug "PKGBUILD found for $colorG$name$nocolor"
Expand Down Expand Up @@ -554,7 +566,7 @@ setup_targets() {
version="${versions[$name]}"

if [[ -z "$version" ]]; then
pkgbuild="$temp_directory/${name}_PKGBUILD"
pkgbuild="$cache_directory/${name}_PKGBUILD"

if [[ -f "$pkgbuild" ]]; then
debug "target $colorG$name$nocolor may have moved to repos"
Expand Down Expand Up @@ -717,8 +729,10 @@ declare -A target_versions # name->version
declare -A target_deps # pkgbase->is-dep?

initialize "$@"

if searching; then
if clean; then
clean_package_directory
elif
searching; then
perform_search
else
eager_sudo && sudo_upfront
Expand Down