From bdc1508a068af7d9fb3d401922c0f2d8b012d8dc Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 20 Mar 2011 19:56:55 -0500 Subject: Fix assignment before NULL check Easy fix, found using null_ref.cocci example Coccinelle script. Signed-off-by: Dan McGee --- lib/libalpm/be_local.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index c3461b77..c13dffb4 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -995,10 +995,10 @@ pmdb_t *_alpm_db_register_local(void) _alpm_log(PM_LOG_DEBUG, "registering local database\n"); db = _alpm_db_new("local", 1); - db->ops = &local_db_ops; if(db == NULL) { RET_ERR(PM_ERR_DB_CREATE, NULL); } + db->ops = &local_db_ops; handle->db_local = db; return(db); -- cgit v1.2.3-24-g4f1b From 32e35d4028f30db5fc7cf96478015be293e4d123 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 20 Mar 2011 20:10:19 -0500 Subject: Fix comparison to 0 rather than NULL Another fix found by Coccinelle example semantic patches. Signed-off-by: Dan McGee --- lib/libalpm/package.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index d4b3b9c0..18d77d65 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -345,7 +345,7 @@ static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs) pmpkg_t *cachepkg = i->data; if(_alpm_dep_edge(cachepkg, pkg)) { const char *cachepkgname = cachepkg->name; - if(alpm_list_find_str(*reqs, cachepkgname) == 0) { + if(alpm_list_find_str(*reqs, cachepkgname) == NULL) { *reqs = alpm_list_add(*reqs, strdup(cachepkgname)); } } -- cgit v1.2.3-24-g4f1b From 78e55be0e6e51fe34e51544070c69cb6634b7eff Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 20 Mar 2011 20:11:11 -0500 Subject: Remove unnecessary NULL check fp can never be NULL at this point in the code, proven by Coccinelle. Signed-off-by: Dan McGee --- src/pacman/pacman.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 55f99a66..591b2a00 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -1230,9 +1230,7 @@ static int _parseconfig(const char *file, const char *givensection, } cleanup: - if(fp) { - fclose(fp); - } + fclose(fp); if(section){ free(section); } -- cgit v1.2.3-24-g4f1b From 451f9493f52975cad08ce9ff3b57c4d1993abfde Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 20 Mar 2011 23:08:22 -0500 Subject: Update source translation files in prep for 3.5.1 Signed-off-by: Dan McGee --- lib/libalpm/po/libalpm.pot | 8 ++++++-- po/pacman.pot | 21 ++++----------------- 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/lib/libalpm/po/libalpm.pot b/lib/libalpm/po/libalpm.pot index ba88318b..b4a5da66 100644 --- a/lib/libalpm/po/libalpm.pot +++ b/lib/libalpm/po/libalpm.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: pacman 3.5.0\n" "Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n" -"POT-Creation-Date: 2011-03-16 19:34-0500\n" +"POT-Creation-Date: 2011-03-20 12:35-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -188,7 +188,11 @@ msgid "could not determine mount point for file %s\n" msgstr "" #, c-format -msgid "could not determine filesystem mount points" +msgid "could not determine filesystem mount points\n" +msgstr "" + +#, c-format +msgid "could not determine root mount point %s\n" msgstr "" #, c-format diff --git a/po/pacman.pot b/po/pacman.pot index 9ab5d701..4fce2719 100644 --- a/po/pacman.pot +++ b/po/pacman.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: pacman 3.5.0\n" "Report-Msgid-Bugs-To: http://bugs.archlinux.org/index.php?project=3\n" -"POT-Creation-Date: 2011-03-14 13:57-0500\n" +"POT-Creation-Date: 2011-03-20 23:07-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -614,11 +614,8 @@ msgid "could not change directory to %s (%s)\n" msgstr "" #, c-format -msgid "directive '%s' without value not recognized\n" -msgstr "" - -#, c-format -msgid "directive '%s' with a value not recognized\n" +msgid "" +"config file %s, line %d: directive '%s' in section '%s' not recognized.\n" msgstr "" #, c-format @@ -652,17 +649,7 @@ msgid "config file %s, line %d: All directives must belong to a section.\n" msgstr "" #, c-format -msgid "config file %s, line %d: directive %s needs a value\n" -msgstr "" - -#, c-format -msgid "config file %s, line %d: problem in options section\n" -msgstr "" - -#, c-format -msgid "" -"config file %s, line %d: directive '%s' in repository section '%s' not " -"recognized.\n" +msgid "config file %s, line %d: directive '%s' needs a value\n" msgstr "" #, c-format -- cgit v1.2.3-24-g4f1b From d3b32a68fe7de022df998c37b2bbe7e053d06dfb Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 20 Mar 2011 23:37:56 -0500 Subject: Add a few more notes about translating using Transifex Signed-off-by: Dan McGee --- doc/translation-help.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/translation-help.txt b/doc/translation-help.txt index 5be15dff..d95b5135 100644 --- a/doc/translation-help.txt +++ b/doc/translation-help.txt @@ -35,6 +35,21 @@ kbabel. Using a translation tool tends to make the job easier. Please read up on Transifex usage using the http://help.transifex.net/[Transifex Help] if you are not familiar. +Here is an example set of commands if you have a source code checkout and are +not worried about any local translations being overwritten. The .tx/ directory +is checked into the git repository so is preconfigured with the two project +resources (See `tx status` output for a quick overview). + + tx pull -f + poedit po/.po + poedit lib/libalpm/po/.po + tx push -t -l + +Or to just push one of the two available resources: + + tx push -r archlinux-pacman.pacman-pot -t -l fi + tx push -r archlinux-pacman.libalpm-pot -t -l fi + See the <> section for additional hints on translating. Pre-release Updates -- cgit v1.2.3-24-g4f1b From fd3acff5e6b587c0fab04c2c3a34a1285e398a11 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 21 Mar 2011 00:24:36 -0500 Subject: Restore --debug/--verbose output without a primary operation This is by no means a guarantee of this behavior remaining the same in the future, but it is easy enough to do what we used to in this case by delaying any sort of error condition until after we are completely done parsing options. Addresses FS#23370. Signed-off-by: Dan McGee --- src/pacman/pacman.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 591b2a00..fc34f0e9 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -740,7 +740,8 @@ static int parseargs(int argc, char *argv[]) } else if(opt == '?') { /* this should have failed during first pass already */ return(1); - } else if(parsearg_op(opt, 1) == 0) { /* opt is an operation */ + } else if(parsearg_op(opt, 1) == 0) { + /* opt is an operation */ continue; } @@ -757,18 +758,17 @@ static int parseargs(int argc, char *argv[]) case PM_OP_SYNC: result = parsearg_sync(opt); break; - case PM_OP_DEPTEST: - result = 1; - break; case PM_OP_UPGRADE: result = parsearg_upgrade(opt); break; + case PM_OP_DEPTEST: default: - pm_printf(PM_LOG_ERROR, _("no operation specified (use -h for help)\n")); - return(1); + result = 1; + break; } - if (result == 0) + if (result == 0) { continue; + } /* fall back to global options */ result = parsearg_global(opt); -- cgit v1.2.3-24-g4f1b From c3e72e11b643b2a24608e1936763fb148613e464 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 21 Mar 2011 14:11:18 +1000 Subject: Fix zsh completion Fixes completion for "pacman -S " and "pacman -S repo/" Signed-off-by: Allan McRae Signed-off-by: Lukas Fleischer Signed-off-by: Dan McGee --- contrib/zsh_completion.in | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index 16919134..fded4144 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -221,23 +221,20 @@ _pacman_completions_all_groups() { # these can be specified as either 'package' or 'repository/package' _pacman_completions_all_packages() { local -a cmd packages repositories packages_long + _pacman_get_command + + if compset -P1 '*/*'; then + packages=( $(_call_program packages $cmd[@] -Sql ${words[CURRENT]%/*}) ) + typeset -U packages + _wanted repo_packages expl "repository/package" compadd ${(@)packages} + else + packages=( $(_call_program packages $cmd[@] -Sql) ) + typeset -U packages + _wanted packages expl "packages" compadd - "${(@)packages}" - repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options}) - typeset -U repositories - packages_long=(@localstatedir@/lib/pacman/sync/${^repositories}/*(/)) - packages=(${(o)${${packages_long#@localstatedir@/lib/pacman/sync/}#*/}%-*-*} ) - typeset -U packages - _wanted packages expl "packages" compadd - "${(@)packages}" - if [[ $PREFIX != */* ]] ; then repositories=(${(o)${${${(M)${(f)"$(<@sysconfdir@/pacman.conf)"}:#\[*}/\[/}/\]/}:#options}) typeset -U repositories _wanted repo_packages expl "repository/package" compadd -S "/" $repositories - else - compset -P '*/' - packages_long=(@localstatedir@/lib/pacman/sync/$IPREFIX*(/)) - packages=(${(o)${${packages_long#@localstatedir@/lib/pacman/sync/}#*/}%-*-*} ) - typeset -U packages - _wanted repo_packages expl "repository/package" compadd ${(@)packages} fi } -- cgit v1.2.3-24-g4f1b From 9cab9807e02674fd5a7efcea2a408c70c1f9d40c Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 21 Mar 2011 15:16:51 +1000 Subject: Some more zsh completion tidy up Changes for consistency across functions Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- contrib/zsh_completion.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/zsh_completion.in b/contrib/zsh_completion.in index fded4144..2131412c 100644 --- a/contrib/zsh_completion.in +++ b/contrib/zsh_completion.in @@ -214,6 +214,7 @@ _pacman_completions_all_groups() { local -a cmd groups _pacman_get_command groups=( $(_call_program groups $cmd[@] -Sg) ) + typeset -U groups compadd "$@" -a groups } @@ -242,7 +243,7 @@ _pacman_completions_all_packages() { _pacman_completions_installed_groups() { local -a cmd groups _pacman_get_command - groups=(${(o)${(f)"$(pacman -Qg)"}% *}) + groups=(${(o)${(f)"$(_call_program groups $cmd[@] -Qg)"}% *}) typeset -U groups compadd "$@" -a groups } -- cgit v1.2.3-24-g4f1b From b0bb4f9024712adcee5e2baf6cebe73c966d7d7f Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Mon, 21 Mar 2011 13:29:37 +1000 Subject: Do not query group selection when using -Sp Remove unnecessary output when using -Sp. Fixes FS#23340. Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- src/pacman/sync.c | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/pacman/sync.c b/src/pacman/sync.c index 29bcf540..13b65a8f 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -637,25 +637,37 @@ static int process_group(alpm_list_t *dbs, char *group) return(1); } - printf(_(":: There are %d members in group %s:\n"), count, - group); - select_display(pkgs); - char *array = malloc(count); - multiselect_question(array, count); - int n = 0; - for(i = pkgs; i; i = alpm_list_next(i)) { - if(array[n++] == 0) - continue; - pmpkg_t *pkg = alpm_list_getdata(i); - if(process_pkg(pkg) == 1) { - ret = 1; - goto cleanup; + if(config->print == 0) { + printf(_(":: There are %d members in group %s:\n"), count, + group); + select_display(pkgs); + char *array = malloc(count); + multiselect_question(array, count); + int n = 0; + for(i = pkgs; i; i = alpm_list_next(i)) { + if(array[n++] == 0) + continue; + pmpkg_t *pkg = alpm_list_getdata(i); + + if(process_pkg(pkg) == 1) { + ret = 1; + free(array); + goto cleanup; + } + } + } else { + for(i = pkgs; i; i = alpm_list_next(i)) { + pmpkg_t *pkg = alpm_list_getdata(i); + + if(process_pkg(pkg) == 1) { + ret = 1; + goto cleanup; + } } } cleanup: alpm_list_free(pkgs); - free(array); return(ret); } -- cgit v1.2.3-24-g4f1b