summaryrefslogtreecommitdiff
path: root/lib/libalpm/util.h
Commit message (Collapse)AuthorAge
* libalpm: clean up of md5sum functions.Chantry Xavier2008-02-27
| | | | | | | | | test_delta_md5sum and test_pkg_md5sum were simple wrappers to test_md5sum, and only used once, so not very useful. I removed them. Also, test_md5sum and alpm_pkg_checkmd5sum functions were a bit duplicated, so I refactored them with a new _alpm_test_md5sum function in libalpm/util.c Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
* Merge branch 'maint'Dan McGee2008-01-14
|\
| * FS#9183 : force correct permissions on tmp/.Jaroslaw Swierczynski2008-01-13
| | | | | | | | | | | | | | [Xav: removed unneeded makepath_internal function, and fixed the permission value : 1777 -> 01777] Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* | Use dynamic string allocation in package structuresDan McGee2008-01-11
|/ | | | | | | | | | | | | | 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>
* Update GNU GPL boilerplate and copyright datesDan McGee2007-12-10
| | | | | | | 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>
* War on whitespaceDan McGee2007-11-16
| | | | | | Run the kernel's cleanfile script on all of our source files. Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: simplify sync db lastupdateDan McGee2007-11-16
| | | | | | | | | | | 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>
* Add STRDUP macro to mirror MALLOC/CALLOCAaron Griffin2007-11-06
| | | | Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* libalpm: use an lstat wrapper so we never dereference dir symlinksDan McGee2007-11-04
| | | | | | | | Linux lstat follows POSIX standards and dereferences a symlink pointing to a directory if there is a trailing slash. For purposes of libalpm, we don't want this so make a lstat wrapper that suppresses this behavior. Signed-off-by: Dan McGee <dan@archlinux.org>
* When printing size_t, use %zdDan McGee2007-10-29
| | | | | | | | %d was used, which worked for Linux and FreeBSD. Not so for Darwin. The warning was probably spat out when compiling on x68_64 as well, but no developers use this architecture as their primary one. Signed-off-by: Dan McGee <dan@archlinux.org>
* libalpm: introduce MALLOC and CALLOC macrosDan McGee2007-10-29
| | | | | | | | | | | | | | | | | 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>
* Ensure all localization stuff is correctly guardedDan McGee2007-10-22
| | | | | | | Anything dealing with libintl and localization should be correctly guarded inside an ENABLE_NLS block on both the pacman and libalpm sides. Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix broken or missing includesDan McGee2007-10-22
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix invalid static scoping of strverscmpDan McGee2007-10-22
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Download delta files if UseDelta is set.Nathan Jones2007-10-19
| | | | | | | | Delta files will be used if the size is smaller than a percent (MAX_DELTA_RATIO) of the package size. Signed-off-by: Nathan Jones <nathanj@insightbb.com> Signed-off-by: Dan McGee <dan@archlinux.org>
* Update usage of gcc __attribute__ flagsDan McGee2007-10-08
| | | | | | | | | | | | Change the default visibility of libalpm functions to internal instead of hidden- this allows for slightly better optimization because it tells GCC that the function can never be called outside of the current module (see http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html). Also added some attributes to the pacman print functions so that they check the format strings being passed to them. Signed-off-by: Dan McGee <dan@archlinux.org>
* alpm: removed unused strtoupper wrapper, remove installeddate on parse_descfileDan McGee2007-09-23
| | | | | | | installdate should never be present in a package descfile, so get rid of it. With the last commit, we also don't need the util strtoupper function. Signed-off-by: Dan McGee <dan@archlinux.org>
* Add a few missing includes, caught while compiling on cygwinDan McGee2007-09-06
| | | | Signed-off-by: Dan McGee <dan@archlinux.org>
* Fix for FS 6404 and functionalize some cachedir handling stuffDan McGee2007-08-20
| | | | | | | | | 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>
* Remove versioncmp.{c,h}, clean up selective #ifdefsDan McGee2007-07-12
| | | | | | | | | Remove versioncmp.c by moving all functions to locations that make sense. Move replacement functions (for building without glibc) into util.c where they belong, and do proper checks for them instead of using __sun__, etc. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove scriptlet START and DONE commands that we don't useDan McGee2007-06-27
| | | | | | | | The scriptlet calling had some unneeded complexity for the time being which we aren't using here. Let's get rid of it until we find a good way to implement it correctly. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove logmask stuff from backend; switch logging callback to new pm_printfDan McGee2007-06-09
| | | | | | | | | | 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>
* Move DB and cache dirs away from there dependence on ROOTDIRDan McGee2007-05-31
| | | | | | | | | | | | | | | | | | | 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>
* Allow $repo expansion in 'Server' config linesAaron Griffin2007-05-18
| | | | | | | | | | | | | Small change (addition of a 'strreplace' function) which replaces any $repo tokens found in a server line with the name of the repo or section being processed. While this is more simplistic than suggestions on flyspray, it works and I think it is cleaner. Merits can be discussed further. Ref: FS#6389 Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
* libalpm util.c and util.h cleanupDan McGee2007-04-29
| | | | | | | | | | * Remove some unnecessary conditional compiling in util.h- move the functions tha required it to trans.c (along with a bunch of new header includes). * Clean up util.h a bit- remove some header includes, remove universal libarchive include and only put it in the files that need it. Signed-off-by: Dan McGee <dan@archlinux.org>
* Remove STRNCPY macro from libalpmDan McGee2007-04-29
| | | | | | | Replaced calls to the STRNCPY macro with the actual strncpy function, and pacman passes all pactests. Signed-off-by: Dan McGee <dan@archlinux.org>
* Clean up gettext on the libalpm sideDan McGee2007-04-26
| | | | | | | 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>
* Big commit this time:Aaron Griffin2007-03-03
| | | | | | | | | | | | | | | | | | | | | | | * Moved entirely to alpm_pkg_get_* accessors, to read data on demand * Mostly removed the INFRQ_ parameters from outside the be_files backend (making the backend more extensible in the long run) * packages created from _alpm_db_scan now have the db and origin set (making accessors actually work for these packages) * removed _alpm_db_ensure_pkgcache * totally revamped the _alpm_checkconflicts function, making it cleaner and easier to read (and thus fix in the long run) - maintainable code ftw NOTE: feel free to rename the functions... I couldn't think of anything better * removed an extra loop in sync.c:find_replacements - no sense in looping over an entire DB while strcmp'ing the name, when we have get_pkgfromcache Other: * package struct "license" -> "licenses" * Created _alpm_sync_find (duplicate code in some places, find_pkginsync * Minor const correctness changes along the way * fixed a couple extra '/' pathing issues (non-issues really) * removed a duplicate pkg_cmp function
* * strlen -> mbstowcs (multibyte str to wide char str) conversion where weDan McGee2007-02-14
| | | | | want the actual number of characters, not the number of bytes. * Added a TODO to take care of later in scriptlet processing.
* * Refactored conflict checking within packages. Profiling from Dan showed anAaron Griffin2007-02-13
| | | | | | | | unbelievable amount of strcmp() calls (25 million) due to the list searching. This has been reimplemented with a set-intersection scheme, due to the fact that file lists are always ordered. - NEEDS TESTING * Minor clean up, "globalized" the str_cmp helper to match the alpm comparison signature, so we can use it elsewhere.
* K. Piche <kpiche@rogers.com>Aaron Griffin2007-01-30
| | | | | | | * gcc visiblity changes Also modified _alpm_versioncmp -> alpm_versioncmp (public function) as per K. Piche's suggestions
* This mainly deals with code clarity- removing currently unneededAaron Griffin2007-01-24
| | | | | | | | | | optimizations in order to make the code much more readable and type-checkable. Every enum in the library now has it's own type that should be used instead of the generic 'unsigned char'. In addition, several #define statements dealing with constants were converted to enums. Signed-off-by: Dan McGee <dpmcgee@gmail.com>
* Preliminary checkin for alpm_list conversionAaron Griffin2007-01-19
| | | | | | | | | * 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
* * Misc logging changesAaron Griffin2007-01-17
| | | | | | Addition of a forced fflush in an attempt to diagnose mutli-logging Removal of varargs from the internal logaction function, they are handled in alpm_logaction just fine
* Jürgen Hötzel <juergen@hoetzel.info>Aaron Griffin2007-01-17
| | | | | | | | | | | | | | | | | | | | | | | | * avoid repeated regex compilations (regex for search string do not change while scanning the package database) * remove needless string duplication (regex function do not change target string nor free them) * code cleanup This patch improves search performance: bash-3.2$ time ./src/pacman/pacman.static.old -Ss "(database|web).*server" >/dev/null real 0m1.026s user 0m0.544s sys 0m0.208s bash-3.2$ time ./src/pacman/pacman.static -Ss "(database|web).*server" >/dev/null real 0m0.777s user 0m0.456s sys 0m0.128s bash-3.2$
* * Completed getinfo api changes (pmmissing_t, pmtrans_t, etc)Aaron Griffin2006-11-22
| | | | | | | | * Modified some dependancy checking * Changed "performing local database upgrade" message to be more clear * Change 'usize' to 'isize' in database files * Scriptlet output is now sent to pacman's log file * Limited some debugging output to be more clear
* * Initial changes to gensync - makepkg changes were not checked in from anotherAaron Griffin2006-11-15
| | | | | | machine - still pending * Addition of _alpm_pkg_makefilename to simplify the with/without -ARCH prefix scheme we're going with for the interim
* * Numerous mini valgrind fixes.Aaron Griffin2006-11-14
| | | | | | | | | | * 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)
* Numerous changes:Aaron Griffin2006-10-31
| | | | | | | | | | | | * Furthered the "lazy caching" to force the pkgcache to read nothing (INFRQ_NONE) by default. Anything requiring package data should now check the infolevel of each package and attempt to update it. This could be ironed out a bit more later (by using the front-end get_info function * Switched to libfetch. Drastic changes to the download code and the callback progress bar functions. Also fixed the return value of _alpm_downloadfiles_forreal. Downloading now supports http, ftp, https, and files urls, along with 'mtime's and numerous other fancy features from libfetch.
* Moved downloaded db unpacking to the backend files, to easier allow conversionAaron Griffin2006-10-25
| | | | from db to whatever format we need.
* A handful of minor changes:Aaron Griffin2006-10-20
| | | | | | | | * Removed the PMList typedef, in favor of the same naming scheme other structs use 'pmlist_t' * Added a time stamp on debug output, to make it more informational * Moved alpm_db_register to _alpm_db_register, making the public function not take a callback parameter
* Merged frugalware changes (too many to list). Also added some config fileAaron Griffin2006-10-15
| | | | | handling changes (support [sections] to carry over to included files - this helps with backwards compatibility with existing pacman config files)
* removed libtar support in favour of libarchiveJudd Vinet2006-09-28
|
* first stage of i18n stuff from VMiklosJudd Vinet2006-05-15
|
* dropped the MALLOC macroAurelien Foret2006-02-20
|
* - grep is now a static functionAurelien Foret2006-02-16
| | | | - code cleanup
* - merged pkg_new and pkg_dummy functionsAurelien Foret2006-01-09
| | | | - renamed _alpm_log_action to _alpm_logaction
* patch from VMiklos - use PACKAGE_VERSION instead of PACMAN_VERSIONJudd Vinet2006-01-02
|
* Replaced snprintf calls by the SNPRINTF macro to avoid buffer overflows when ↵Aurelien Foret2005-03-29
| | | | copying strings
* Initial revisionJudd Vinet2005-03-15