Commit Graph

63 Commits

Author SHA1 Message Date
Chantry Xavier 1a3b3bc130 libalpm/util.c : stat returns 0 on success
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2007-06-28 17:14:26 +02:00
Dan McGee 7daa6708d2 Remove lockfile configuration from frontend, make it job of libalpm
I previously introduced some patches to make just about every path in
pacman/libalpm configurable; doing this with the lockfile seemed a bit too
far and we really should just place the lockfile where it belongs- with the
DB that needs locking.

More details in this thread:
http://archlinux.org/pipermail/pacman-dev/2007-June/008499.html

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-27 23:34:38 -04:00
Dan McGee 5a3b595837 Fix wrong permissions on pacnew extraction
First reported here:
http://bbs.archlinux.org/viewtopic.php?pid=261861

Newly created files were done with the standard umask, so those that are
extracted seperately and copied to a .pacnew extension will have the wrong
permissions. This should hopefully fix this.

Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-27 20:32:37 -04:00
Dan McGee 0de5c97193 libalpm/util.c: remove unnecessary include
Signed-off-by: Dan McGee <dan@archlinux.org>
2007-06-20 17:54:42 -04:00
Dan McGee a32ca90192 Remove logmask stuff from backend; switch logging callback to new pm_printf
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-09 12:57:50 -04:00
Dan McGee 7bd2ff6851 Move DB and cache dirs away from there dependence on ROOTDIR
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-31 02:51:28 -04:00
Aaron Griffin ebad199614 Allow $repo expansion in 'Server' config lines
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>
2007-05-18 01:24:59 -05:00
Dan McGee 2bcecbd62c Remove unnecessary casts on malloc and elsewhere
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-05-14 03:16:55 -04:00
Dan McGee 8bbb5dd078 libalpm util.c and util.h cleanup
* 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>
2007-04-29 12:47:02 -04:00
Dan McGee a58e17a1d7 Remove STRNCPY macro from libalpm
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-29 12:03:09 -04:00
Dan McGee 75efcbbff6 Clean up gettext on the libalpm side
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-04-26 19:39:53 -04:00
Aaron Griffin 1d35c4dcc6 Report an error on setmntent failure
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
2007-03-29 22:44:10 -05:00
Aaron Griffin d8ec08f578 * Correct install scriptlet usage (reuse of handle->root when not needed)
* Skip running scriptlet when chroot fails - to prevent issues in the host
  filesystem
2007-03-22 08:22:48 +00:00
Aaron Griffin 22206d5bea Nagy Gabor <ngaba@petra.hos.u-szeged.hu>
* correct _alpm_rmrf usage with regard to symlinks and directories
2007-03-19 04:49:28 +00:00
Dan McGee 869e81e1cf This commit looks much more monumental than it is. Almost all just #include
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-03-05 22:13:33 +00:00
Aaron Griffin cdb46ef3fa * Fixed a whole mess of extra '/' pathing issues when a different root is
specified
* Use db->path when appropriate
* Commented out the FAKEROOT checks in libalpm.  This should never ever be done.
  TODO test this quite a bit, as this will never cause the transactions to fail
  if RW operations are requested... right now it is totally up to the front end
  to decide when to fail
* Use realpath() to canonicalize the root path when specified, so
  _alpm_makepath() doesn't freak out
* Fixed some output/indent of MDFile and SHAFile algorithms
* More efficient sprintf() usage in MDFile/SHAFile
* Added real error output to _alpm_makepath
2007-03-04 09:08:54 +00:00
Aaron Griffin 7f5dada885 Big commit this time:
* 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
2007-03-03 08:13:59 +00:00
Dan McGee cd34ced4ad * strlen -> mbstowcs (multibyte str to wide char str) conversion where we
want the actual number of characters, not the number of bytes.
* Added a TODO to take care of later in scriptlet processing.
2007-02-14 15:54:35 +00:00
Aaron Griffin 103dbb9fd1 * Refactored conflict checking within packages. Profiling from Dan showed an
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.
2007-02-13 08:15:38 +00:00
Aaron Griffin 670319c2fb Debug logging changes:
* The --debug params were goofy.  New setup allows --debug without params,
  --debug=<level> where level 1=debug output, 2=debug and download output,
  3=debug, download, and function tracing output.  This seems more sane to me.
* Removed PM_LOG_FLOW1 and PM_LOG_FLOW2.  They were just confusing.  When adding
  new functions, it is near impossible to determin if your output should be
  "flow1" or "flow2" without tracking all the way up the call chain.  Rarely
  would one ever say "ok, lets just show "flow2" output.  These have both been
  replaced with PM_LOG_DEBUG
* Removed the need for the root parameter on alpm_initialize. it is now
  defaulted to PM_ROOT just like dbpath and cachedir.  This allows alpm to be
  initialized BEFORE option parsing in the front end, saving us some duplicate
  variables in the frontend.
* Cleaned up front end variables due to early alpm_initialize call.
2007-01-31 06:10:21 +00:00
Aaron Griffin da648bc24c K. Piche <kevin.piche@cgi.com>
* ALPM_LOG_FUNCTION macro and all the great work to add this macro everywhere
2007-01-30 08:14:10 +00:00
Dan McGee 0bc06918e4 * Remove -fno-strict-aliasing as it is now unnecessary to compile.
* Fix up add.c a bit better than it was in regards to FS #3492.
* Optimized the sqrt call in dependency cycle checking to a single call.
* Removal of an outdated comment.
2007-01-30 05:41:13 +00:00
Aaron Griffin a5ad2b3f93 * Fix FS #3107- Use ISO date style
* Fix FS #5409- document that pacman.conf repo ordering is important

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
2007-01-26 01:33:03 +00:00
Aaron Griffin 1b61cc8c69 This mainly deals with code clarity- removing currently unneeded
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>
2007-01-24 03:02:53 +00:00
Aaron Griffin 6167017264 Preliminary checkin for alpm_list conversion
* 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-19 09:28:44 +00:00
Aaron Griffin 86b136bb59 Dan McGee <dpmcgee@gmail.com>
* 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
2007-01-18 16:52:57 +00:00
Aaron Griffin 1bea7706ae * Misc logging changes
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
2007-01-17 07:21:07 +00:00
Aaron Griffin 726e90dc2c Jürgen Hötzel <juergen@hoetzel.info>
* 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$
2007-01-17 03:57:53 +00:00
Aaron Griffin 986409f9bd * Completed getinfo api changes (pmmissing_t, pmtrans_t, etc)
* 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
2006-11-22 09:03:41 +00:00
Aaron Griffin aa1c0ba9f8 * repo-add script - to add entries to a db file directly from package data (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-20 09:10:23 +00:00
Aaron Griffin 3d6242ed74 * makepkg.conf.in variable changes (missed the checkin)
* Better error reporting when unpacking an archive fails
* Fixed -Sc and -Scc cache dir opening/reading
2006-11-16 17:24:41 +00:00
Aaron Griffin 00ce9ea739 * Initial changes to gensync - makepkg changes were not checked in from another
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-15 07:50:37 +00:00
Aaron Griffin 4470e5ce01 * Numerous mini valgrind fixes.
* 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-14 07:58:42 +00:00
Aaron Griffin af2fb3324a Numerous changes:
*   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.
2006-10-31 06:39:59 +00:00
Aaron Griffin e8275fa964 Moved downloaded db unpacking to the backend files, to easier allow conversion
from db to whatever format we need.
2006-10-25 18:15:25 +00:00
Aaron Griffin 7131b7ac87 A handful of minor changes:
* 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
2006-10-20 06:26:55 +00:00
Aaron Griffin d37ad04873 Merged frugalware changes (too many to list). Also added some config file
handling changes (support [sections] to carry over to included files - this
helps with backwards compatibility with existing pacman config files)
2006-10-15 19:31:03 +00:00
Judd Vinet cf6da173f6 removed libtar support in favour of libarchive 2006-09-28 20:51:33 +00:00
Judd Vinet bb787e26ee first stage of i18n stuff from VMiklos 2006-05-15 02:19:57 +00:00
Aurelien Foret eefe29d99a fixed directory roots when running scriplets 2006-02-16 21:07:34 +00:00
Aurelien Foret 181efcdeaa - grep is now a static function
- code cleanup
2006-02-16 21:05:49 +00:00
Aurelien Foret 831ff882ae reworked lock handling (patch from VMiklos <vmiklos@frugalware.org>) 2006-01-26 22:16:57 +00:00
Aurelien Foret fd6ce1f4cb - merged pkg_new and pkg_dummy functions
- renamed _alpm_log_action to _alpm_logaction
2006-01-09 20:16:00 +00:00
Aurelien Foret f3a4197e34 code cleanup (mainly removed line spaces at the beginning of lines by tabulations) 2006-01-07 09:42:48 +00:00
Judd Vinet 96de3501ab patch from VMiklos - use PACKAGE_VERSION instead of PACMAN_VERSION 2006-01-02 19:55:35 +00:00
Aurelien Foret 55a76279c5 - fixed a regression with pacman 2.x (patch from VMiklos <vmiklos@frugalware.org>)
- code reowrk to ensure the /tmp/alpm_foo directory is always removed
2006-01-01 12:20:36 +00:00
Aurelien Foret 414d6d83c9 Used the chroot syscall instead of the chroot binary
(patch from Christian Hamaer <krics@linuxforum.hu>)
2005-11-05 19:21:25 +00:00
Judd Vinet a36ded25eb added conversation callback support for transactions 2005-10-09 06:09:57 +00:00
Judd Vinet 5ef51b3e26 Merging in recent fixes/additions from 2.9.7 2005-10-07 23:29:49 +00:00
Aurelien Foret 4ee51bdf46 Added a CYGWIN define to include header files required to build in a Cygwin environment 2005-10-06 07:28:30 +00:00