Skip to content

Commit

Permalink
sync: fix upgrading system/aur with no targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Toni500github committed May 16, 2024
1 parent 3d16731 commit 25bfcb6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ LDFLAGS := -L./$(BUILDDIR)/fmt -L./$(BUILDDIR)/cpr $(LDFLAGS)

is_cpr_installed = $(shell ldconfig -p | grep libcpr > /dev/null && echo -n yes)

all: cpr fmt toml taur
all: mkbuilddir cpr fmt toml taur

mkbuilddir: $(BUILDDIR)
mkdir -p $(BUILDDIR)

cpr:
ifneq ($(is_cpr_installed), yes)
Expand Down Expand Up @@ -57,7 +60,6 @@ locale:
scripts/make_mo.sh locale/

taur: cpr fmt toml $(OBJ)
mkdir -p $(BUILDDIR)
$(CXX) $(OBJ) $(BUILDDIR)/toml++/toml.o -o $(BUILDDIR)/taur $(LDFLAGS)

clean:
Expand Down
30 changes: 14 additions & 16 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,12 @@ int installPkg(alpm_list_t *pkgNames) {
pkgNamesVec.push_back((const char *)(pkgNames->data));

if (pkgNamesVec.empty()) {
if (op.op_s_search)
if (op.op_s_search) {
log_println(WARN, _("Please specify a target"));
return false;
return false;
}
}

if (op.op_s_search) {
for (size_t i = 0; i < pkgNamesVec.size(); i++) {
vector<TaurPkg_t> pkgs = backend->search(pkgNamesVec[i], useGit, !op.op_s_search);
Expand Down Expand Up @@ -205,23 +206,20 @@ int installPkg(alpm_list_t *pkgNames) {
return false;
}
}

if (op.op_s_upgrade) {
if (!config->aurOnly) {
log_println(INFO, _("Upgrading system packages!"));
string op_s = "-S";

// install first system packages then the AUR ones
// but first check if url is not empty
// because it will then start installing system packages each loop
if (!pacmanPkgs.empty()) {
string op_s = "-S";
if (op.op_s_sync)
op_s += 'y';

if (op.op_s_sync)
op_s += 'y';
if (op.op_s_upgrade)
op_s += 'u';

pacman_exec(op_s, pacmanPkgs);
}

if (op.op_s_upgrade) {
log_println(DEBUG, _("Upgrading AUR packages!"));
pacman_exec(op_s, pacmanPkgs);
}
log_println(INFO, _("Upgrading AUR packages!"));
backend->update_all_aur_pkgs(cacheDir, useGit);
}

Expand Down

0 comments on commit 25bfcb6

Please sign in to comment.