summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/server.c
AgeCommit message (Collapse)AuthorFilesLines
2008-02-25Remove pmserver_t abstractionDan McGee1-89/+0
Remove what was a pretty weird abstraction in the libalpm backend. Instead of parsing server URLs as we get them (of which we don't usually use more than a handful anyway), wait until they are actually used, which allows us to store them as a simple string list instead. This allows us to remove a lot of code, and will greatly simplify the continuing refactoring of the download code. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-25Move download code out of server.cDan McGee1-381/+0
This is the first in what will be a series of patches to clean up the current download code in libalpm. Start by moving download code out of server.c and into download.c. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-01-11Use dynamic string allocation in package structuresDan McGee1-2/+3
This also affects all structures with static strings, such as depmiss, conflict, etc. This should help a lot with memory usage, and hopefully make things a bit more "idiot proof". Currently our pactest pass/fail rate is identical before and after this patch. This is not to say it is a perfect patch- I have yet to pull valgrind out. However, this should be quite safe to use in all situations from here on out, and we can start plugging the memleaks. Original-work-by: Aaron Griffin <aaronmgriffin@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-11Update GNU GPL boilerplate and copyright datesDan McGee1-3/+1
Update the GPL boilerplate to direct people to the GNU website for a copy of the license, as well as bump all of Judd's copyrights to 2007. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-12-07libalpm/server.c : fix segfault when downloading failed.Chantry Xavier1-1/+1
The alpm_list_free(complete) needs to be done OUTSIDE the loop walking through the server list. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-25Make the download failure message more clearAaron Griffin1-1/+5
Use the word "disk" in place of the host name for local files Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-11-17War on whitespaceDan McGee1-9/+9
Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-16libalpm: simplify sync db lastupdateDan McGee1-23/+19
Legacy code is hitting the trash here. Remove unnecessary _alpm_time2string time storage abstraction in favor of just writing the time_t value to the disk. The only drawback is that everyone's sync DBs will have to be updated at least once so that the lastupdate values are stored right. :) Signed-off-by: Dan McGee <dan@archlinux.org>
2007-11-11Implement TotalDownload option.Nathan Jones1-11/+36
Setting this option will change the download progress to show the amount downloaded, download rate, ETA, and download percent of the entire download list rather than per each individual file. The progress bar is still based on the completion of the current file regardless if the TotalDownload option is set. This closes FS#7205. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-29libalpm: introduce MALLOC and CALLOC macrosDan McGee1-10/+2
These macros take the place of the common 4 or 5 line blocks of code we had in most places that called malloc or calloc. This should reduce some code duplication and make memory allocation more standard in libalpm. Highlights: * Note that the MALLOC macro actually uses calloc, this is just for safety so that memory is initialized to 0. This can be easily changed in one place. * One malloc call was completely eliminated- it made more sense to do it on the stack. * The use of RET_ERR in public functions (mainly the alpm_*_new functions) was standardized, this makes sense so pm_errno is set. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-10-23Fix broken or missing includesDan McGee1-2/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Update comments dealing with pkgext/dbext strippingDan McGee1-2/+1
pacman/callback.c already did the work I set out to do with this commit, so update the comments accordingly in the frontend and backend. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-09-28Remove package name dependency from libalpmDan McGee1-10/+3
Previously, package names must match a specified scheme or they will cause pacman add operations to fail. This is not a very intelligent or necessary way to act, so remove the dependency on the name of the package to be installed and read all relevant information from the metadata instead. This does have one causality to be addressed later- pacman cache cleaning functionality, which has never been phenomenal, just lost most capability. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-24libalpm: add newlines to all strings passed to log callbackDan McGee1-21/+21
This allows us to remove the hack in the frontend where we added a newline to everything coming out of the pm_printf functions, and instead let the developer put newlines where they want them. This should be the last hangover of that auto-newline stuff. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-22Various valgrind mem leak fixesDan McGee1-4/+12
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-22Post trial install changes, round oneDan McGee1-1/+1
A bunch of changes related to my first "real" install of pacman-git into /usr/local and trying to use it. * Shift some uses of free -> FREE in libalpm. * Move stat and sanity checks of config paths into libalpm from the config and argument parsing in pacman.c. * Fix issue where dbpath still was not defined early enough due to its requirement for being used in alpm_db_register. This should be rewritten so it doesn't have this dependency, but this will work for now. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-08-20Fix for FS 6404 and functionalize some cachedir handling stuffDan McGee1-36/+32
In order to best resolve bug 6404, move some cachedir handling stuff out of sync.c and into util.c and create two new functions: filecache_find and filecache_setup. sync.c was rewritten to use these, and alpm_fetch_pkgurl now also uses these routines. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-10Remove gettext calls from all PM_LOG_DEBUG messagesDan McGee1-9/+10
There is no real reason to burden our translators with these messages, as anyone helping to debug these will probably want them in English. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-07-02Remove unnecessary and extra includesDan McGee1-1/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-09Remove logmask stuff from backend; switch logging callback to new pm_printfDan McGee1-9/+1
Remove the logmask functionality from the backend as it has been moved to the frontend, and change the logging callback function to use pm_printf. In addition, make much better use of va_list- use the args list instead of a arbitrarily chosen string to print to in the logging functions. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-05Const correctness!Dan McGee1-2/+2
Add some 'const' keywords all over the code to make it a bit more strict on what you can and can't do with data. This is especially important when we return pointers to the pacman frontend- ideally this would always be untouchable data. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-05Move functions out of alpm.c to where they belongDan McGee1-0/+14
alpm.h is the only "publically viewable" file, so there is no reason to have functions in alpm.c that belong in package.c, db.c, etc. Move the functions where they belong and leave only the library init functions in alpm.c. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-31Move DB and cache dirs away from there dependence on ROOTDIRDan McGee1-1/+1
This change allows us to use all autoconf specified paths, most notably $(localstatedir). It is quite a change and touches a lot of files, as all references to the DB and cache were done with the ROOTDIR as a prefix. * add --lock command-line option to pacman to specify the location of the lockfile (this can now be specified at configure time by setting the $localstatedir path). * Rip quite a few settings out of configure.ac as they are now picked by setting the paths during configure or make. * Fix bug with /tmp fallback for sync downloads not working correctly (related to root location, now the system tmp dir is used). * Simplified the parameters to some libalpm functions, and added get/set for the new lockfile option. * Renamed several of the DEFS to names without the PM_ prefix. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-05-18Remove trailing slashes from Server URLsAaron Griffin1-0/+4
Simple clean up for the rest of the code, which also prevents a little libdownload bug relating to '//' appearing in URLs. Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-05-14Remove unnecessary casts on malloc and elsewhereDan McGee1-1/+1
We had many unnecessary casts, most of them dealing with malloc and other memory allocations. The variable type should take care of it; no need to do it explicitly. In addition, I caught a const error while removing the casts. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-29Remove STRNCPY macro from libalpmDan McGee1-1/+1
Replaced calls to the STRNCPY macro with the actual strncpy function, and pacman passes all pactests. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-28Remove FREESERVER macro and correctly type _alpm_server_freeDan McGee1-3/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-04-27Clean up gettext on the libalpm sideDan McGee1-1/+0
Remove inclusion of libintl.h from all files, because we can do it once in util.c where the _() macro is defined. Signed-off-by: Dan McGee <dan@archlinux.org>
2007-03-21* dont use XferCommand if retrieving local files, fixes wget error:Jürgen Hötzel1-1/+1
file:////....: Unsupported scheme.
2007-03-21* Fix asking the user to upgrade when using -SpAaron Griffin1-1/+26
* More significant error messages when -Qo fails * Potential fix for reported error that pacman indicates corrupt packages when space is full on the cache dir
2007-03-13* Missed a path when requiring that all paths end with / - this caused -U not toAaron Griffin1-1/+1
work (it was downloading files as .package-name) at all.
2007-03-06* Fix the double package name URL when using XferCommandAaron Griffin1-7/+5
* Fixed valgrind yelling about the sprintfs in md5/sha1 routines
2007-03-06* Added missing header include guards in md5.h and sha1.h.Dan McGee1-2/+2
* Some header cleanup on the pacman side of things - we had alpm.h instead alpm_list.h in a few headers. * removed an extra slash in path-building snprintf in server.c.
2007-03-05This commit looks much more monumental than it is. Almost all just #includeDan McGee1-1/+4
reordering and adding ones that were forgotten (noticed when trying to compile after reordering). * Updated the HACKING file to include information on #include usage. * print -> vprint in "making dir" function in pactest.
2007-02-12Wasn't clearing out the 'pkgname' variable, which was causing goofy outputAaron Griffin1-3/+6
issues - silly me. Also removed config.rpath from CVS
2007-02-10* 'add' percentages now cap at 100% (see the comment)Aaron Griffin1-2/+13
* downloaded packages now pass ONLY the package name to the callback
2007-02-09* Fixed some missing error values in strerrorAaron Griffin1-65/+83
* Cleanup up some error enum values * Revamped the 'pmserver_t' functionality. Less allocation, removed a param and cleaned up some duplicate URL parsing
2007-02-01* Minor output fix (move colon so it's not part of the URL)Aaron Griffin1-1/+1
* Added ldconfig on --sync operations too
2007-01-30K. Piche <kevin.piche@cgi.com>Aaron Griffin1-0/+9
* ALPM_LOG_FUNCTION macro and all the great work to add this macro everywhere
2007-01-30Discussed on IRC for a bit, this makes the following changes for clarity:Dan McGee1-1/+1
* alpm_list_is_in --> alpm_list_find * alpm_list_is_strin --> alpm_list_find_str * Flip parameters of both functions to be inline with rest of alpm_list. First commit, woohoo.
2007-01-19Preliminary checkin for alpm_list conversionAaron Griffin1-15/+15
* renamed pmlist_t -> alpm_list_t * made alpm_list_t a public type (alpm_list.h header) * removed additional storage for registered DBs in pacman source * some code cleanup * removed duplicate (pm)list_display functions from pacman source * misc code cleanup
2007-01-18Dan McGee <dpmcgee@gmail.com>Aaron Griffin1-1/+1
* Removed some unnecessary headers and library links * Made things static if possible * Cleaned up makefiles a bit * Fixed some old comments in the code * Fixed some errors the static code checker splint pointed out * Backwards arguments in a memset call in _alpm_db_read (could have been worse) * Other various small fixes Other: * Default to 80 columns when getcols cannot determine display width * Removal of ._install as a valid install file in packages
2006-11-22* Fixed an error when trying to download to an unwritable locationAaron Griffin1-0/+4
2006-11-20* repo-add script - to add entries to a db file directly from package data ↵Aaron Griffin1-6/+4
(no PKGBUILD) * libalpm api changes - move from a _getinfo(p, WHAT_WE_WANT) scheme to a typesafe _get_what_we_want(p) scheme [not 100% complete yet] * some const correctness changes * removal of PM_* types in alpm.h in favor of the pm*_t types used throughout libalpm
2006-11-15* Initial changes to gensync - makepkg changes were not checked in from anotherAaron Griffin1-0/+1
machine - still pending * Addition of _alpm_pkg_makefilename to simplify the with/without -ARCH prefix scheme we're going with for the interim
2006-11-14* Numerous mini valgrind fixes.Aaron Griffin1-17/+22
* Addition of hacky architecture check in the _splitname function * Removal of libfetch from the archlinux proper - it has been renamed to libdownload and can be found at http://phraktured.net/libdownload * Merge of _some_ of the Frugalware makepkg change - this may still be incomplete * Removal of libftp from cvs proper * PKGBUILD manpage now says 'PKGBUILD' instead of FrugalBuild (he he)
2006-11-08* Improved mcheck outputAaron Griffin1-1/+1
* Added minor libalpm const correctness * Mini-memory fixes
2006-11-03* Modified some error output and loggingAaron Griffin1-3/+2
* Changed the initial log mask (added PM_LOG_ERROR) * Fixed -Syu so it now works if any databases were downloaded (it was working like a -Su)
2006-11-01Fixed pacman -U:Aaron Griffin1-20/+30
* Accidental database read of a file-based package (whoops) * Proper fetching of url-based -U or -A Removed some newlines from _alpm_log calls, to make debug output more concise
2006-10-31Forgot to cycle to next server on download error - fixed, as well as theAaron Griffin1-2/+3
erro-case return value of _alpm_downloadfiles_forreal