From 7f5c486666cc99fba4029b2c059ae062b7dd7933 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 24 Jul 2010 17:13:01 -0400 Subject: Always treat PKGLIST as an array. Fixes repackaging issues when multiple package names are passed to the --pkg option. Signed-off-by: Dave Reisner Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 516e1d7c..562e8758 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -73,7 +73,7 @@ HOLDVER=0 BUILDFUNC=0 PKGFUNC=0 SPLITPKG=0 -PKGLIST="" +PKGLIST=() # Forces the pkgver of the current PKGBUILD. Used by the fakeroot call # when dealing with svn/cvs/etc PKGBUILDs. @@ -1585,7 +1585,7 @@ while true; do -m|--nocolor) USE_COLOR='n' ;; -o|--nobuild) NOBUILD=1 ;; -p) shift; BUILDFILE=$1 ;; - --pkg) shift; PKGLIST=$1 ;; + --pkg) shift; PKGLIST=($1) ;; -r|--rmdeps) RMDEPS=1 ;; -R|--repackage) REPKG=1 ;; --skipinteg) SKIPINTEG=1 ;; @@ -1800,7 +1800,7 @@ pkgbase=${pkgbase:-${pkgname[0]}} if [[ -n "${PKGLIST[@]}" ]]; then unset pkgname - pkgname="${PKGLIST[@]}" + pkgname=("${PKGLIST[@]}") fi if (( ! SPLITPKG )); then -- cgit v1.2.3-54-g00ecf From e702f56ea671c6cd1154a0ddb41fa63e97587c85 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 25 Jul 2010 22:15:25 -0500 Subject: Add two pactests for group and --needed interaction The first step for resolving FS#20221. sync023 is the case from the bug report; sync022 is already working fine but we have no tests at all that test the --needed option in any form. Signed-off-by: Dan McGee --- test/pacman/tests/sync022.py | 25 +++++++++++++++++++++++++ test/pacman/tests/sync023.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 test/pacman/tests/sync022.py create mode 100644 test/pacman/tests/sync023.py diff --git a/test/pacman/tests/sync022.py b/test/pacman/tests/sync022.py new file mode 100644 index 00000000..eebbe07d --- /dev/null +++ b/test/pacman/tests/sync022.py @@ -0,0 +1,25 @@ +self.description = "Install a group from a sync db using --needed" + +lp1 = pmpkg("pkg1") +lp2 = pmpkg("pkg2") +lp3 = pmpkg("pkg3") + +sp1 = pmpkg("pkg1", "1.1-1") +sp2 = pmpkg("pkg2") +sp3 = pmpkg("pkg3") + +for p in lp1, lp2, lp3, sp1, sp2, sp3: + setattr(p, "groups", ["grp"]) + +for p in lp1, lp2, lp3: + self.addpkg2db("local", p) + +for p in sp1, sp2, sp3: + self.addpkg2db("sync", p); + +self.args = "-S --needed grp" + +self.addrule("PACMAN_RETCODE=0") +for p in sp1, sp2, sp3: + self.addrule("PKG_EXIST=%s" % p.name) +self.addrule("PKG_VERSION=pkg1|1.1-1") diff --git a/test/pacman/tests/sync023.py b/test/pacman/tests/sync023.py new file mode 100644 index 00000000..9253497c --- /dev/null +++ b/test/pacman/tests/sync023.py @@ -0,0 +1,31 @@ +self.description = "Install a group from a sync db using --needed (testing repo)" + +lp1 = pmpkg("pkg1", "1.1-1") +lp2 = pmpkg("pkg2") +lp3 = pmpkg("pkg3") + +sp1 = pmpkg("pkg1") +sp2 = pmpkg("pkg2") +sp3 = pmpkg("pkg3") +newp1 = pmpkg("pkg1", "1.1-1") + +for p in lp1, lp2, lp3, sp1, sp2, sp3, newp1: + setattr(p, "groups", ["grp"]) + +for p in lp1, lp2, lp3: + self.addpkg2db("local", p) + +self.addpkg2db("testing", newp1); + +for p in sp1, sp2, sp3: + self.addpkg2db("sync", p); + +self.args = "-S --needed grp" + +self.addrule("PACMAN_RETCODE=0") +for p in sp1, sp2, sp3: + self.addrule("PKG_EXIST=%s" % p.name) +# The newer version should still be installed +self.addrule("PKG_VERSION=pkg1|1.1-1") + +self.expectfailure = True -- cgit v1.2.3-54-g00ecf From f8d7cd6b2623a864aa85fbdcdd629f3ff92a631c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 25 Jul 2010 22:31:55 -0500 Subject: Maintain a list of seen packages when installing a group As reported in FS#20221, we don't always do the right thing when installing a group and using the --needed option. This was due to the code pulling packages based on what was already in the transaction's add list, but completely ignoring the fact that we may have already seen and skipped this same package in an earlier repository. Add a list to the private _alpm_sync_pkg() function that allows us to have this extra information so we don't mistakenly downgrade a package when using --needed. Signed-off-by: Dan McGee --- lib/libalpm/sync.c | 12 ++++++++---- test/pacman/tests/sync023.py | 2 -- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 68ee8dc7..bc7c3dc2 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -202,7 +202,7 @@ int SYMEXPORT alpm_sync_sysupgrade(int enable_downgrade) return(0); } -int _alpm_sync_pkg(pmpkg_t *spkg) +int _alpm_sync_pkg(pmpkg_t *spkg, alpm_list_t *pkg_list) { pmtrans_t *trans; pmdb_t *db_local; @@ -213,7 +213,7 @@ int _alpm_sync_pkg(pmpkg_t *spkg) trans = handle->trans; db_local = handle->db_local; - if(_alpm_pkg_find(trans->add, alpm_pkg_get_name(spkg))) { + if(_alpm_pkg_find(pkg_list, alpm_pkg_get_name(spkg))) { RET_ERR(PM_ERR_TRANS_DUP_TARGET, -1); } @@ -251,6 +251,7 @@ int _alpm_sync_pkg(pmpkg_t *spkg) int _alpm_sync_target(alpm_list_t *dbs_sync, char *target) { alpm_list_t *i, *j; + alpm_list_t *known_pkgs = NULL; pmpkg_t *spkg; pmdepend_t *dep; /* provisions and dependencies are also allowed */ pmgrp_t *grp; @@ -267,7 +268,7 @@ int _alpm_sync_target(alpm_list_t *dbs_sync, char *target) _alpm_dep_free(dep); if(spkg != NULL) { - return(_alpm_sync_pkg(spkg)); + return(_alpm_sync_pkg(spkg, handle->trans->add)); } _alpm_log(PM_LOG_DEBUG, "%s package not found, searching for group...\n", target); @@ -278,17 +279,20 @@ int _alpm_sync_target(alpm_list_t *dbs_sync, char *target) found = 1; for(j = alpm_grp_get_pkgs(grp); j; j = j->next) { pmpkg_t *pkg = j->data; - if(_alpm_sync_pkg(pkg) == -1) { + if(_alpm_sync_pkg(pkg, known_pkgs) == -1) { if(pm_errno == PM_ERR_TRANS_DUP_TARGET || pm_errno == PM_ERR_PKG_IGNORED) { /* just skip duplicate or ignored targets */ continue; } else { + alpm_list_free(known_pkgs); return(-1); } } + known_pkgs = alpm_list_add(known_pkgs, pkg); } } } + alpm_list_free(known_pkgs); if(!found) { /* pass through any 'found but ignored' errors */ diff --git a/test/pacman/tests/sync023.py b/test/pacman/tests/sync023.py index 9253497c..8233ab73 100644 --- a/test/pacman/tests/sync023.py +++ b/test/pacman/tests/sync023.py @@ -27,5 +27,3 @@ self.addrule("PKG_EXIST=%s" % p.name) # The newer version should still be installed self.addrule("PKG_VERSION=pkg1|1.1-1") - -self.expectfailure = True -- cgit v1.2.3-54-g00ecf From fa4f25626c462e88ca0f6457bf9942980a5bd329 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 25 Jul 2010 22:50:54 -0500 Subject: Mark sync_pkg and sync_target as static functions We no longer use these anywhere outside of sync.c, so do the rename and add static to their definition to meet our coding standards. Signed-off-by: Dan McGee --- lib/libalpm/sync.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index bc7c3dc2..f8193962 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -202,7 +202,7 @@ int SYMEXPORT alpm_sync_sysupgrade(int enable_downgrade) return(0); } -int _alpm_sync_pkg(pmpkg_t *spkg, alpm_list_t *pkg_list) +static int sync_pkg(pmpkg_t *spkg, alpm_list_t *pkg_list) { pmtrans_t *trans; pmdb_t *db_local; @@ -248,7 +248,7 @@ int _alpm_sync_pkg(pmpkg_t *spkg, alpm_list_t *pkg_list) return(0); } -int _alpm_sync_target(alpm_list_t *dbs_sync, char *target) +static int sync_target(alpm_list_t *dbs_sync, char *target) { alpm_list_t *i, *j; alpm_list_t *known_pkgs = NULL; @@ -268,7 +268,7 @@ int _alpm_sync_target(alpm_list_t *dbs_sync, char *target) _alpm_dep_free(dep); if(spkg != NULL) { - return(_alpm_sync_pkg(spkg, handle->trans->add)); + return(sync_pkg(spkg, handle->trans->add)); } _alpm_log(PM_LOG_DEBUG, "%s package not found, searching for group...\n", target); @@ -279,7 +279,7 @@ int _alpm_sync_target(alpm_list_t *dbs_sync, char *target) found = 1; for(j = alpm_grp_get_pkgs(grp); j; j = j->next) { pmpkg_t *pkg = j->data; - if(_alpm_sync_pkg(pkg, known_pkgs) == -1) { + if(sync_pkg(pkg, known_pkgs) == -1) { if(pm_errno == PM_ERR_TRANS_DUP_TARGET || pm_errno == PM_ERR_PKG_IGNORED) { /* just skip duplicate or ignored targets */ continue; @@ -333,7 +333,7 @@ int SYMEXPORT alpm_sync_dbtarget(char *dbname, char *target) if(dbs == NULL) { RET_ERR(PM_ERR_PKG_REPO_NOT_FOUND, -1); } - return(_alpm_sync_target(dbs, target)); + return(sync_target(dbs, target)); } /** Add a sync target to the transaction. @@ -350,7 +350,7 @@ int SYMEXPORT alpm_sync_target(char *target) ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); dbs_sync = handle->dbs_sync; - return(_alpm_sync_target(dbs_sync,target)); + return(sync_target(dbs_sync,target)); } /** Compute the size of the files that will be downloaded to install a -- cgit v1.2.3-54-g00ecf From ff689b6a383cbeb5ea699d587fe8975d71cae600 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 27 Jul 2010 10:08:47 -0500 Subject: Fix compile error in certain cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I'm not sure why it doesn't happen everywhere, but we need for umask and mkdir in this file. I hit this today: cc1: warnings being treated as errors util.c: In function ‘makepath’: util.c:128:2: error: implicit declaration of function ‘umask’ util.c:141:5: error: implicit declaration of function ‘mkdir’ make[2]: *** [util.o] Error 1 Signed-off-by: Dan McGee --- src/pacman/util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pacman/util.c b/src/pacman/util.c index 0cae6d7c..557696b0 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -22,6 +22,7 @@ #include #include +#include #include #include -- cgit v1.2.3-54-g00ecf From 52118bf0f084e891b53bcf05f9e6021ebb26fb13 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Mon, 26 Jul 2010 10:49:43 -0400 Subject: bash_completion: negate expression inside brackets Avoids letting the shell evaluate ! as something else (e.g. an alias). Signed-off-by: Dave Reisner Signed-off-by: Dan McGee --- contrib/bash_completion | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/bash_completion b/contrib/bash_completion index 1ec2cd53..bdc4754a 100644 --- a/contrib/bash_completion +++ b/contrib/bash_completion @@ -75,8 +75,8 @@ _pacman() { if [[ $? != 0 ]]; then _arch_ptr2comp core - elif ! [[ $prev =~ ^-\w*[Vbhr] || - $prev = --@(cachedir|config|dbpath|help|logfile|root|version) ]] + elif [[ ! $prev =~ ^-\w*[Vbhr] && + ! $prev = --@(cachedir|config|dbpath|help|logfile|root|version) ]] then [[ $cur = -* ]] && _arch_ptr2comp ${o#* } common || case ${o% *} in -- cgit v1.2.3-54-g00ecf From 0d6efb35ce445747cdc37b4f58cdf63463de6e1a Mon Sep 17 00:00:00 2001 From: Baurzhan Muftakhidinov Date: Tue, 27 Jul 2010 10:14:35 -0500 Subject: Small fix to Kazakh translation Signed-off-by: Dan McGee --- lib/libalpm/po/kk.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libalpm/po/kk.po b/lib/libalpm/po/kk.po index bcb194bb..a43f99b0 100644 --- a/lib/libalpm/po/kk.po +++ b/lib/libalpm/po/kk.po @@ -208,7 +208,7 @@ msgstr "'%s' файлын %s адресінен алу қатемен аяқт #, c-format msgid "%s appears to be truncated: %jd/%jd bytes\n" -msgstr "%s қысқартылады: %jd/%jd байт\n" +msgstr "%s қысқартылған сияқты: %jd/%jd байт\n" #, c-format msgid "failed to download %s\n" -- cgit v1.2.3-54-g00ecf