summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* Skip diskspace checking for symlinks and directories in all casesDan McGee2011-02-08
| | | | | | | | | | | | | | | | | | We did this in some but not all cases, assuming the 0 value coming out of libarchive would not be a problem. However, this does not work for "fake" filesystems such as rpc_pipefs, which reports a free block and total block count of zero. Fix this by not ever counting symlinks or directories, and adding a note explaining that if we someday do count directories, their size needs to be attributed to the proper place. This patch also includes a few cleanups/performance tweaks- avoid calling strlen() on the mountpoint directory string as much by storing this size in our mountpoint struct, and push the snprintf() call up to the calculate functions since we were already doing it here in the remove case. Signed-off-by: Dan McGee <dan@archlinux.org>
* Refactor out common code in pkghash add functionsPang Yan Han2011-02-07
| | | | | | | | | | The overlapping code in _alpm_pkghash_add() and _alpm_pkghash_add_sorted() are now in a new static function pkghash_add_pkg(). This function has a third flag parameter which determines whether the package should be added in sorted order. Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Handle null pkgcache for local/sync db_populate()Pang Yan Han2011-02-07
| | | | | | | | | | | | | | | In sync_db_populate() and local_db_populate(), a NULL db->pkgcache is not caught, allowing the functions to continue instead of exiting. A later alpm_list_msort() call which uses alpm_list_nth() will thus traverse invalid pointers in a non-existent db->pkgcache->list. pm_errno is set to PM_ERR_MEMORY as _alpm_pkghash_create() will only return NULL when we run out of memory / exceed max hash table size. The local/sync db_populate() functions are also exited. Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* makepkg: more bash-3.2 compatibilityAllan McRae2011-02-06
| | | | | | | | Adding the "|| true" to the subshell prevents bash-3.2 setting off the error_trap but requires changing the if statement. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* Merge branch 'maint'Dan McGee2011-02-06
|\
| * Add new translations from TransifexDan McGee2011-02-04
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
| * Add updated Kazakh translation from TransifexDan McGee2011-02-04
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Remove redundant _alpm_strtrim() in be_local.cPang Yan Han2011-02-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When reading the "desc" file in _alpm_local_db_read(), some strings are trimmed and checked for length > 0 before their use/duplication subsequently. They are then trimmed again when there is no need to. The following code snippet should illustrate it clearly: while(fgets(line, sizeof(line), fp) && strlen(_alpm_strtrim(line))) { char *linedup; STRDUP(linedup, _alpm_strtrim(line), goto error); info->groups = alpm_list_add(info->groups, linedup); } This patch removes the redundant _alpm_strtrim() calls in _alpm_local_db_read() such as the one inside the STRDUP shown above. Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Handle PM_ERR_WRITE in alpm_strerror()Pang Yan Han2011-02-04
| | | | | | | | | | | | | | | | PM_ERR_WRITE is defined in alpm.h but not handled in alpm_strerror(). This patch corrects that. Signed-off-by: Pang Yan Han <pangyanhan@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Update translation file indexes and MakevarsDan McGee2011-02-04
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add comment about download file resolutionDan McGee2011-02-04
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Merge remote-tracking branch 'allan/hash'Dan McGee2011-02-04
|\ \
| * | Improve pkghash_remove algorithmDan McGee2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than potentially move every item to the next NULL, attempt to move at most one item at a time by iterating backwards from the NULL location in the hash array. If we move an item, we repeat the process on the now shorter "chain" until no more items need moving. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
| * | Use alpm_list_remove_item in pkghash_removeDan McGee2011-02-04
| | | | | | | | | | | | | | | | | | | | | Removes the code that was duplicated and has now been refactored into a separate method. Signed-off-by: Dan McGee <dan@archlinux.org>
| * | Add new alpm_list_remove_item() functionDan McGee2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This takes in the list and a list item, and does the pointer dance necessary to remove it from the list regardless of whether it is first, last, or somewhere in the middle. It is useful for callers that already know what item needs to be removed and have a pointer to it rather than doing a search by data that the plain alpm_list_remove() does. Refactor alpm_list_remove() to use this function as well. Signed-off-by: Dan McGee <dan@archlinux.org>
| * | Add a new removal smoke testDan McGee2011-02-04
| | | | | | | | | | | | | | | | | | Hint: this will really stress hash table removal. Signed-off-by: Dan McGee <dan@archlinux.org>
| * | Actually remove packages from pkghash on removalAllan McRae2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | Fully removes a package from the hash. Also unify prototype with removal from an alpm_list_t, fixing issues when removing a package from the pkgcache. Signed-off-by: Allan McRae <allan@archlinux.org>
| * | Refactor finding position for new hash entryAllan McRae2011-02-04
| | | | | | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
| * | Rehash efficientlyAllan McRae2011-02-04
| | | | | | | | | | | | | | | | | | | | | Rehash without recreating the hash table list or reallocating the memory for holding the list nodes. Signed-off-by: Allan McRae <allan@archlinux.org>
| * | Slightly more efficient rehash size selectionAllan McRae2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | While probably still not optimal in terms of everyday usage in pacman, this reduces the absolute size increase to "more reasonable" levels. For databases greater than 5000 in size, the minimum size increase is used which is still on the order of a 10% increase. Signed-off-by: Allan McRae <allan@archlinux.org>
| * | Error handling for maximum database sizeAllan McRae2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | Check that the requested size of a pkghash is not beyond the maximum prime. Also check for successful creation of a new hash before rehashing. Signed-off-by: Allan McRae <allan@archlinux.org>
| * | Change default sync hash table sizing to 66% fullDan McGee2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | Since the sync database never changes size once we initialize it, we allow it to be filled a bit more. This reduces the overall memory footprint needed by the hash table. Signed-off-by: Dan McGee <dan@archlinux.org>
| * | Implement a quick and dirty rehash functionDan McGee2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | This allows us to get through the rehash required by smoke001 and pass all pactests. It is by no means the best or most efficient implementation but it does do the job. Signed-off-by: Dan McGee <dan@archlinux.org>
| * | Read pkgcache into hashAllan McRae2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Read the package information for sync/local databases into a pmpkghash_t structure. Provide a alpm_db_get_pkgcache_list() method that returns the list from the hash object. Most usages of alpm_db_get_pkgcache are converted to this at this stage for ease of implementation. Review whether these are better accessing the hash table directly at a later stage. Signed-off-by: Allan McRae <allan@archlinux.org>
| * | Get estimated package count when populating databasesDan McGee2011-02-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This works for both local and sync databases in slightly different ways. For the local database, we can use the directory hard link count on the local/ folder. For sync databases, we use the archive size coupled with some computed average per-package sizes to determine an estimate. This is currently a dead assignment once calculated, but could be used to set the initial size of a hash table. Signed-off-by: Dan McGee <dan@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org>
| * | Add a hash table for holding packagesAllan McRae2011-02-04
| | | | | | | | | | | | Signed-off-by: Allan McRae <allan@archlinux.org>
* | | Add more error checking and loggingDan McGee2011-02-04
| | | | | | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | | Ensure found files are actually filesDan McGee2011-02-04
|/ / | | | | | | | | | | | | | | | | We located files in a few places but didn't check if they were files or directories. Ensure they are actually files using stat() and S_ISREG(); this showed itself when trying to download to the directory name itself in FS#22645. Signed-off-by: Dan McGee <dan@archlinux.org>
* | makepkg: initialize local arrays to emptyAllan McRae2011-02-02
| | | | | | | | | | | | | | | | Fixes bash-3.2 compatibility. Thanks-to: Dave Reisner <d@falconindy.com> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | makepkg: error on invalid optdependsAllan McRae2011-02-02
| | | | | | | | | | | | | | Missed in commit a88cb03a. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | makepkg: make SRCPKGDEST default to $startdirCedric Staniewski2011-02-02
| | | | | | | | | | | | | | | | | | The current behaviour, which is placing source packages in PKGDEST if SRCPKGDEST is not set, is inconsistent with {SRC,PKG}DEST handling and there is no real advantage in doing so. Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | makepkg: Fix the check for references to srcdir/pkgdirNezmer2011-02-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At least in FreeBSD, find always returns 0 if it finds stuff (imagine that). It doesn't care about the exit status of whatever is passed to -exec. This patch makes the checks compatible with this behaviour. Using xargs and not using grep directly because packages with too many files would cause grep to complain about argument list being too long. This should also fix the false positive in packages with no files. Signed-off-by: Nezmer <git@nezmer.info> Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
* | makepkg: fix indention to follow style guideCedric Staniewski2011-02-01
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Fix locale.h/setlocale inclusion with --disable-nlsDan McGee2011-02-01
| | | | | | | | | | | | | | | | | | Noted in FS#22697. When I factored out _alpm_parsedate() into a common function, I didn't move the <locale.h> include properly, causing a build failure when NLS is disabled and this header isn't automatically included everywhere. Signed-off-by: Dan McGee <dan@archlinux.org>
* | make -d less strict; add -dd optionFlorian Pritz2011-01-31
| | | | | | | | | | | | | | | | | | | | -d skips checking the version of a dependency. -dd skips the whole dependency check. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Florian Pritz <bluewind@server-speed.net> Signed-off-by: Dan McGee <dan@archlinux.org>
* | alpm/depcmp: new NODEPVERSION flagXavier Chantry2011-01-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This flag allows to disable version checking in dependency resolving code. depcmp_tolerant respects the NODEPVERSION flag but we still keep the original strict depcmp. The idea is to reduce the impact of the NODEPVERSION flag by using it in fewer places. I replaced almost all depcmp calls by depcmp_tolerant in deps.c (except in the public find_satisfier used by deptest / pacman -T), but I kept depcmp in sync.c and conflict.c Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | add pactests for -SddXavier Chantry2011-01-31
| | | | | | | | | | Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Allow both cleanmethod values to be specified at the same timeDan McGee2011-01-31
| | | | | | | | | | | | | | | | No reason to disallow this- it allows keeping even more packages around in the cache. Test cases included for this case and to ensure the default behavior is preserved. Signed-off-by: Dan McGee <dan@archlinux.org>
* | Style cleanups in clean cache codeDan McGee2011-01-31
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | Add three clean cache testsDan McGee2011-01-31
| | | | | | | | | | | | | | | | The first two are rather standard tests of our two available clean options, and the third is attempting to test a reported bug (and failing to make the given case fail). Signed-off-by: Dan McGee <dan@archlinux.org>
* | pactest: allow checking for cache file existenceDan McGee2011-01-31
| | | | | | | | | | | | This will allow some tests to be added for cache cleaning. Signed-off-by: Dan McGee <dan@archlinux.org>
* | libalpm: fix db_update documentationXavier Chantry2011-01-31
| | | | | | | | | | | | return codes were mixed up Signed-off-by: Dan McGee <dan@archlinux.org>
* | Call count() once in callbackDan McGee2011-01-29
| | | | | | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* | alpm: drop old target interfacesXavier Chantry2011-01-29
| | | | | | | | | | | | | | | | | | | | It's likely that these interfaces will break sooner or later, now that pacman no longer uses them. So better force the two people who use them to migrate their code to the new add_pkg/remove_pkg interface, which is very easy anyway. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* | select_display: per-database outputXavier Chantry2011-01-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function is used both for provision and group selection. Now the database name will be displayed. $ pacman -S base-devel :: There are 11 members in group base-devel: :: Repository testing 1) make :: Repository core 2) autoconf 3) automake 4) bison 5) fakeroot 6) flex 7) gcc 8) libtool 9) m4 10) patch 11) pkg-config Which ones do you want to install? Enter a number (default=all): Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* | pacman: improve select-questionXavier Chantry2011-01-29
| | | | | | | | | | | | | | Make use of parseindex like in multiselect, and loop until we get a valid answer like in multiselect. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* | pacman/sync: implement interactive group selectionXavier Chantry2011-01-29
| | | | | | | | Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* | alpm: deprecate old interfaceXavier Chantry2011-01-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Old interface is marked as deprecated: int alpm_sync_target(char *target); int alpm_sync_dbtarget(char *db, char *target); int alpm_add_target(char *target); int alpm_remove_target(char *target); New recommended interface: int alpm_add_pkg(pmpkg_t *pkg); int alpm_remove_pkg(pmpkg_t *pkg); Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* | pacman/remove: switch to new alpm_remove_pkg interfaceXavier Chantry2011-01-29
| | | | | | | | Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
* | pacman/upgrade: switch to new interfaceXavier Chantry2011-01-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that there is a behavior change here : if the same package name appeared several times in the target list, the alpm_add_target interface chooses the new package, while alpm_add_pkg returns PKG_DUP. I don't see why we cannot unify the behavior of -S and -U, and just choose one behavior that applies to both. Otherwise, it's always possible to handle these different behaviors in the frontend, it just requires more work. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>