summaryrefslogtreecommitdiffstats
path: root/lib
AgeCommit message (Collapse)AuthorFilesLines
2008-04-11Remove unnecessary import in dload.hDan McGee1-1/+0
We no longer expose any of libdownload in our public functions, so no need to include this header anymore. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-09Correctly use the fd returned my mkstemp()Dan McGee1-6/+4
There were a few issues with this code: 1. We already had an open fd to a file, but never used it to our benefit. Use the libarchive convienence method to write the current file contents straight to a file descriptor. 2. The real problem cropped up on Windows where the locking semantics caused the old way of extraction to fail because we had an open file descriptor. By using the file descriptor and closing it ASAP, we prevent these failures. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07Allow disabling of internal (libdownload) codeDan McGee3-34/+56
Add a new --disable-internal-download flag to configure allowing the internal download code to be skipped. This will be helpful on platforms that currently don't support either libdownload or libfetch (such as Cygwin) and for just compiling a lighter weight pacman binary. This was made really easy by our recent refactoring of the download code into separate internal and external functions, as well as some error code cleanup. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07Remove a bit more download.h pollutionDan McGee2-7/+5
Kill it where it isn't absolutely necessary. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07Remove unnecessary header file, move one macro to util.cDan McGee21-47/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-07libalpm error cleanup, step 1Dan McGee5-28/+21
Remove unused error codes, begin refactoring some of the others. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-04-02Merge branch 'maint'Dan McGee1-0/+1
Conflicts: configure.ac contrib/Makefile.am
2008-04-02Set handle->logstream to null after fclose()Dan McGee1-0/+1
We correctly closed the logfile stream when recalling set_logfile, but did not NULL out the dead pointer once we did this. Fix the problem which was the cause of FS#10056. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-30Merge branch 'maint'Dan McGee2-6/+6
2008-03-29Duplicate the result of archive_entry_pathname.Chantry Xavier1-2/+2
After the libarchive upgrade from 2.4.12 to 2.4.14, our usage of archive_entry_pathname became dangerous. We were using the result of that function even after calls to archive_entry_set_pathname. With 2.4.14, the entryname becomes wrong after these calls, and so all the future use of entryname are bogus. entryname is used quite a lot for logging, so that's not so bad. But it's also used for the backup handling, so that's not very cool. For example, reinstalling a package with backup entries will erase all the md5 entries from the DB, because they won't be found back. entryname is now a static string so that we can easily keep the result of archive_entry_pathname. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: fixed version numbers in commit message] Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-28Use pkgcache instead of db_scan in remove.cNagy Gabor1-4/+4
This should be a notable speed-up (apart from kernel cache). Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-27Read .PKGINFO directly from package fileDan McGee1-50/+11
With the addition of the archive_fgets() function, we can now skip the temp file usage in pkg_load/parse_descfile that was not needed. This has a nice benefit of probably being both faster, reducing code, and getting rid of "expensive" file operations. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-27Add an archive_fgets() functionDan McGee2-0/+31
This crude function allows reading from an archive on a line-by-line basis similar to the familiar fgets() call on a FILE stream. This is the first step in being able to read DB entries straight from an archive. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-27Make db->treename a pointerDan McGee2-3/+3
I really don't think we need statically allocated strings here. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23Merge branch 'maint'Dan McGee2-0/+4
2008-03-23Avoid duplicated target names.Nagy Gabor2-22/+29
This patch should avoid duplicated target names in the backend. 1. sync_loadtarget will return with PM_ERR_TRANS_DUP_TARGET when trying to add a duplicated target 2. sysupgrade never pulls duplicated targets 3. resolvedeps won't pull duplicated targets anymore A pulled list was introduced in sync_prepare to improve the pmsyncpkg_t<->pmpkg_t list conversion by making it more direct. Also replace sync1005 and sync1006 by the sync1008 pactest, which is similar but more interesting (the provisions are dependencies instead of explicit targets). sync1005 didn't work as expected anyway. It was expecting that pacman failed, and pacman indeed failed, but not for the good reason. It didn't fail during the preparation step because of conflicting targets, but during the commit step, because of a md5 error... And sync1006 didn't pass and was not really worth fixing. We have already enough failing pactests more important than these two. sync1008 pass with this patch. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-23memleak fix: ensure we free result of get_destfile()Dan McGee1-6/+5
In the file:// download case, we didn't free the return from get_destfile() after we were done with it. Fix it. (Found with xfercommand001.py) Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23memleak fix: ensure backup fname isn't lost if unusedDan McGee2-0/+4
The _alpm_backup_split function always alloced memory for the fname, and we let it disappear in a specific case (upgrade026.py). Fix the issue. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23Switch pmgrp_t to dynamic allocation, general group cleanupDan McGee4-39/+33
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-23Update database mtime after it has been extractedDan McGee1-8/+12
This will reduce the need for running an -Syy if the DB was only half-extracted, as the mtime won't get updated until the new database is completely in place. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-22Kill the dependsonly option.Chantry Xavier2-10/+4
From the man page : "This is pretty useless and we're not sure why it even exists." Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-18Kill PM_TRANS_TYPE_ADD.Chantry Xavier8-28/+12
This was totally useless. Signed-off-by: Chantry Xavier <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-18Kill some obsolete references to -A option.Chantry Xavier1-1/+1
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-11Add -Rss optionNagy Gabor2-2/+3
* -Rss removes all dependencies (including explicitly installed ones). * updated documentation * two pactest files added to test the difference between -Rs and -Rss Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2008-03-11Remove trans->targetsNagy Gabor5-28/+5
Its implementation was quite broken: * add_loadtarget() might have silently filtered out some targets when replacing an older version. * This was used in sync.c to determine whether a target is implicit or not, which is incorrect behavior. Before this patch we silently removed user confirmed replacements; now we always warn on a replacement. * remove001.py behavior was quite odd in adding same target 5 times to the target list, we can change this behavior to be a failure. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Xav: changed remove001 pactest accordingly] Signed-off-by: Chantry Xavier <shiningxc@gmail.com> [Dan: rewrote commit message] Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-09Merge branch 'maint'Dan McGee15-1919/+1059
Conflicts: configure.ac
2008-03-09Refactoring of the download code.Chantry Xavier1-279/+307
This should be the main step in the download refactoring initiated by commit 81a2a06818d367f8528c74311171417beb9e1592. The stub functions introduced by that commit were implemented. The big download code was mostly composed of two steps, and so it has been naturally splitted in two functions : download_external and download_internal file:/// urls are now handled manually, instead of forcing the use of the internal downloader. Thanks to Dan for fixing the remaining issues and cleaning up the patch :) Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-09Remove a bogus comment from libalpm/remove.cNagy Gabor1-1/+0
We do the opposite. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
2008-03-07New alpm_version functionNagy Gabor2-0/+6
Now pacman frontend uses this function instead of the compile-time libalpm version number. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: fix one more spot where LIB_VERSION was used] Signed-off-by: Dan McGee <dan@archlinux.org> (cherry picked from commit 49197b7492d61bf1fc6bef59a708f4f586f32edb)
2008-03-05Update Czech translationVojtěch Gondžala1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-04Remove a bogus commentNagy Gabor1-1/+0
This comment was created for the old provision version format and needless. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-04Kill all of the line numbers from the translationsDan McGee12-1774/+916
Hopefully the last of the huge commits ever. This also adds the c-format tag to all of the translated messages. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-04Disable the line number in .po files.Chantry Xavier1-1/+1
Add the --no-location xgettext option to disable the line numbers. They are not very useful, and generate a huge number of pointless line changes on every update. Ref: http://www.archlinux.org/pipermail/pacman-dev/2008-March/011332.html Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-03-04Convert Hungarian translation translation to UTF-8Dan McGee1-140/+140
The issue was discussed in this thread on the mailing list: http://archlinux.org/pipermail/pacman-dev/2008-March/011324.html In addition, the GNU gettext manual states that translation encoding is completely separate from the encoding used by the users of the translation. It makes sense for our project to use UTF-8 for all translations, regardless of the preferred encoding used by users of a certain language. This allows all contributors to more easily edit a translation file if necessary and not have to worry about codepage issues. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-02New alpm_version functionNagy Gabor2-0/+6
Now pacman frontend uses this function instead of the compile-time libalpm version number. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: fix one more spot where LIB_VERSION was used] Signed-off-by: Dan McGee <dan@archlinux.org>
2008-03-01Merge branch 'maint'Dan McGee1-1/+1
2008-03-01Set a missing pm_errno in _alpm_pkg_load()Nagy Gabor1-1/+1
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-28libalpm: clean up of md5sum functions.Chantry Xavier6-135/+55
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>
2008-02-28Start removing some junk from the function templateDan McGee2-23/+7
I screwed up originally when I accepted the TotalDownload patch, 8ec27835f40e3df1ce409bc3d913587c474a30c3. I didn't realize how deeply it modified libalpm and I probably shouldn't have let it do what it did. This commit reverts much of what that patch added in order to clean up our internal function calls. We can find another way to do it right down the road here but for now it has to go. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-28libalpm/dload.c : memleak fixes.Chantry Xavier1-13/+20
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-28clean up dltotal leftover from 81a2a06818d367f852.Chantry Xavier1-9/+0
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-26Merge branch 'maint'Dan McGee4-14/+14
Also bump the devel version on the master branch to 3.2.0devel.
2008-02-26Update simplified chinese (zh_CN) translation.甘露(Lu.Gan)1-9/+9
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-26fix two broken translated strings.Chantry Xavier1-2/+2
Using c-format on every strings allowed me two found two broken ones. One was harmless, but the other caused a segfault, as reported in FS#9658. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-26xgettext : change pass-c-format flag to c-format.Chantry Xavier1-2/+2
Currently xgettext apparently attempts to autodetect c format strings (eg a string with a %s) to decide whether to use c-format flag or not. If we use --flag=_:1:c-format instead of --flag=_:1:pass-c-format, the c-format will be applied everywhere. I couldn't find this documented anywhere though. But the pass prefix is mentioned here : http://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html#xgettext-Invocation "Specifies additional flags for strings occurring as part of the argth argument of the function word. The possible flags are the possible format string indicators, such as ‘c-format’, and their negations, such as ‘no-c-format’, possibly prefixed with ‘pass-’." And c-format is documented there : http://www.gnu.org/software/gettext/manual/html_node/c_002dformat-Flag.html#c_002dformat-Flag "This situation happens quite often. The printf function is often called with strings which do not contain a format specifier. Of course one would normally use fputs but it does happen. In this case xgettext does not recognize this as a format string but what happens if the translation introduces a valid format specifier? The printf function will try to access one of the parameters but none exists because the original code does not pass any parameters." And that's exactly what happened with FS#9658. So using c-format for every string will prevent this issue from happening again. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
2008-02-25Remove pmserver_t abstractionDan McGee9-214/+38
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-25Add new stub download functions for use throughout the codeDan McGee4-31/+45
Add new stub functions that work by calling the existing (terrible) download forreal function, which needs a serious overhaul. Hide the existing functions and switch all former users to the new functions. Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-25Move download code out of server.cDan McGee7-388/+464
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-02-25More cleanup to alpm_listDan McGee1-20/+7
* Remove some #include statements that are not strictly necessary * Remove node_new function that is really just a one-liner Signed-off-by: Dan McGee <dan@archlinux.org>
2008-02-25alpm_list.c clean-upNagy Gabor2-59/+63
* Introduces 'list == NULL' convention for empty list. That means alpm_list_new isn't needed anymore, so kill it * Small straightforward fixes in alpm_list.c Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> Signed-off-by: Chantry Xavier <shiningxc@gmail.com>