Skip to content

Commit

Permalink
Refactor AURPKGBUILDRepos and Fix Localization Command in Makefile (#…
Browse files Browse the repository at this point in the history
…2313)

* optimize mutex usage and logging in AURPKGBUILDRepos function

* fix localization script

Fix localization script Makefile by adding missing semicolon and --no-translator flag
  • Loading branch information
sosiska authored Nov 20, 2023
1 parent 8f98ab3 commit 0771ded
Show file tree
Hide file tree
Showing 24 changed files with 6,111 additions and 3,724 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ $(PACKAGE): $(BIN) $(RELEASE_DIR) ${MOFILES}
locale:
xgotext -in . -out po
for lang in ${LANGS}; do \
test -f po/$$lang.po || msginit -l po/$$lang.po -i po/${POTFILE} -o po/$$lang.po \
test -f po/$$lang.po || msginit --no-translator -l po/$$lang.po -i po/${POTFILE} -o po/$$lang.po; \
msgmerge -U po/$$lang.po po/${POTFILE}; \
touch po/$$lang.po; \
done
Expand Down
26 changes: 15 additions & 11 deletions pkg/download/aur.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,30 +63,34 @@ func AURPKGBUILDRepos(

for _, target := range targets {
sem <- 1

wg.Add(1)

go func(target string) {
newClone, err := AURPKGBUILDRepo(ctx, cmdBuilder, aurURL, target, dest, force)
defer func() {
<-sem
wg.Done()
}()

progress := 0
newClone, err := AURPKGBUILDRepo(ctx, cmdBuilder, aurURL, target, dest, force)

mux.Lock()
progress := len(cloned)
if err != nil {
errs.Add(err)
} else {
mux.Lock()
cloned[target] = newClone
progress = len(cloned)
mux.Unlock()
logger.OperationInfoln(
gotext.Get("(%d/%d) Failed to download PKGBUILD: %s",
progress, len(targets), text.Cyan(target)))
return
}

cloned[target] = newClone
progress = len(cloned)
mux.Unlock()

logger.OperationInfoln(
gotext.Get("(%d/%d) Downloaded PKGBUILD: %s",
progress, len(targets), text.Cyan(target)))

<-sem

wg.Done()
}(target)
}

Expand Down
Loading

0 comments on commit 0771ded

Please sign in to comment.