Age | Commit message (Collapse) | Author |
|
Reference : FS#9547.
The get_filename function first tries to get the filename field from the
database, and if it doesn't find it, it tries to guess it based on the name,
version and arch.
This field was introduced in 3.0, but there are still many old entries in
the official databases without it. So the databases need to be regenerated
first before this patch can be applied.
There is a second problem with the delta code, which needs the filename for
locally installed packages too, but this field is not present in the local
db. So the delta code needs to be fixed first.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Using the graph structures that Nagy set up for dependency sorting, we now
do a similar process for deltas. Load up all of the deltas into a graph
object on which we can then apply Dijkstra's algorithm, using the new weight
field of graph struct.
We initialize the nodes weight using the base files that we can use in our
filecache (both filename and md5sum must match). The algorithm then picks
the best path among those that can be resolved.
Note that this algorithm has a few advantages over the old one:
1. It is completely file agnostic. These delta chains do not have to consist
of package files- this could be adopted to do delta-fied DBs.
2. It does not use the local_db anymore, or even care if a package or file
is currently installed. Instead, it only looks in the filecache for files
and packages that match delta chain entries.
Original-work-by: Dan McGee <dan@archlinux.org>
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Remove unused error codes, begin refactoring some of the others.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
|
|
Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Conflicts:
lib/libalpm/be_files.c
lib/libalpm/package.c
|
|
This is the first step of fixing FS#9547. This should not break any existing
code that may rely on this function behaving the way it did, and should be
good for inclusion in a maint release.
In addition, update pactest so it fills the FILENAME field in the DB entries
it creates so we can move forward with a real fix to this issue.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
_alpm_pkgname_pkg_cmp(pkgname, pkg) returns true iff pkg's name is pkgname.
This is useful if you want to remove a package from pmpkg_t* list, and you
want to search for package name.
This allows cleaning the -Ru code a bit, by removing the need of a dummy
pkg.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|
|
The deptest code (pacman -T) used by makepkg was mostly in the frontend.
There were 2 drawbacks:
1) the public splitdep function returns a pmdepend_t struct, but the
_alpm_dep_free function for freeing it is private. So there was a memleak.
2) there is a helper in the backend (satisfycmp in deps.c) which makes this
function much easier.
So this adds a new public alpm_deptest in libalpm/deps.c, which cleans
pacman_deptest in pacman/deptest.c a lot.
Besides, alpm_splitdep was made private, because the frontend no longer
requires it, and _alpm_dep_free is also private.
Finally the deptest001 pactest was extended.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Another elimination of a static length structure in libalpm. Should result
in a little more memory saved during execution of packages with lots of
deltas attached.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
|
|
We didn't have a free function before, causing some memory leaks. We also
need a dup function now that strings are not in the structure but are
dynamically allocated.
Also adapt pmdepmissing_t to use a pointer to a depend struct instead of an
inclusive one so we can use the functions we created here.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Two functions defined in alpm.h were not marked with SYMEXPORT, causing
linking errors if they were used.
In addition, remove the incorrect use of the 'alpm_' prefix from an internal
function and replace it with '_alpm_'.
Fixes FS#9155.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
It wasn't even implemented correctly, and it really doesn't have a use if
packagers just do their job correctly anyway for a distro. Let's not try to
solve a problem with the wrong solution now.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
We had an unused date element in the pmpkg_t struct (not builddate or
installdate). Kill it off and fix the one function that was using it.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This is something pacman can do on its own straight from the archive, and we
will reduce the chance of problems occurring becuase of inproper FILELIST
generation as we have had in the past with special characters in filenames.
Once we remove it from makepkg. we can remove any usage of it from all of
our other tools, including pacman, pactest, and contrib/ utilities.
Note that removing it from pacman uncovered a few other bugs anyway, so this
was probably a good move.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
If /tmp was full during the early stages of package extraction, we were
unable to extract the package description file with the call to
archive_read_data_into_fd(archive, fd) becuase we never checked the return
code. Add a check to ensure the extraction was successful and print and
return an error if it was not instead of falling through to a possibly
untrue error message.
This should fix FS #8885.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Thanks to Allan for inspiring all this work on what was one little TODO item
in the codebase. :)
Change changelog handling so we can now dump a changelog from both installed
packages and package files (fixes FS#7371). We do this by moving all of the
machinery to the backend where it should have been in the first place.
The changelog reading is now done through a open/read/close interface
similar to the fopen/fread/fclose functions (can you guess how it is done?).
It is buffered by the frontend, so programs using the library can read as
much or as little as they want at a time.
Unfortunately, I could not implement a changelog_feof function due to some
shortcomings of libarchive. However, I left the stub code in there,
commented out, in case it becomes possible later or anyone wants to take a
stab at it.
Original-work-by: Allan McRae <mcrae_allan@hotmail.com>
Improved-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
And check the IgnorePkg handling is done correctly in the other places.
For example, -Qu and -Su will automatically skip the ignored packages (-Su will print a warning),
but -S will install ignored packages anyway, because it was asked explicitly.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|
|
This file only contained one private function : _alpm_db_whatprovides .
And the public alpm_db_whatprovides was in db.c , so I moved everything there.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
[Dan: updated POTFILES.in as well]
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Run the kernel's cleanfile script on all of our source files.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
So I spent a good 4 hours tracking a bug down tonight due to
alpm_list_copy_data not actually doing what I expected to do. We can't find
the size of an object we don't know the type of, so rewrite it so we pass
in the size explicitly. This was making _alpm_pkg_dup fail and causing all
sorts of other issues.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Holy inefficient batman! For a pacman -Qt operation (when we are using
compute_requiredby and not database entries), splitdep was being called ~1.3
million times on my local database. By splitting when we read the DB, we
drop this number to around 1700 and save a LOT of time in doing so (a 5x
increase in pacman -Qt speed here).
Note that the depends alpm_list_t in the package struct is no longer a
string list, but a list of pmdepent_t objects.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Instead of using the often-busted REQUIREDBY entries in the pacman database,
compute them each time they are required. This should help many things:
1. Simplify the codebase
2. Prevent future database corruption
3. Ensure when we do use requiredby, it is always correct
4. Shrink the pmpkg_t memory overhead
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This option acts as if IgnorePkg was set on each package in the group.
This closes FS#1592.
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Commit 47622eef4dd8fd86a0aa0e3ebdb7b33f7c9d6804 introduced localized times
in the metadata by way of storing the UNIX epoch value instead of a hard
coded date string. However, it missed a few things:
* If we weren't in the C/POSIX/en_US locale, the date parsing would fail
as it tried to use the abbreviations of the locale being used. Fix this
by switching the LC_TIME value before we parse a date.
* We used ctime to print the date value, which is always the C locale
string. Instead, use strftime to print a localized date string.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
This was forgotten in the original set of patches.
CC: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Signed-off-by: Nathan Jones <nathanj@insightbb.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
The code didn't match the following comment :
"A depends on B through n depends <=> A listed in B's requiredby n times"
It stopped at n=1 with a break.
I was surprised to see this case happens in real, that's how I noticed the
bug: wine depends on both freeglut and glut, while freeglut provides glut.
So when installing wine, the update_depends function listed wine twice in
freeglut's requiredby. But the compute_requiredby function (used when
installing freeglut, and used by testdb) listed wine only once in
freeglut's requiredby. That made testdb unhappy.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Some of the error messages in _alpm_pkg_load failed to use the pkgname
value when printing, which made error messages rather hard to decode.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Packages and DBs now support using the UNIX epoch (seconds since Jan 1, 1970)
for use in builddate and installdate. This will only affect newly built
packages. Old existing packages with the text format are still supported, but
this is deprecated.
In the case of removal of text time support, this code will fail gracefully,
returning the start of the epoch for broken packages.
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
In most cases, we want to fully scan a package when we load it, which serves
as a integrity verification check. However, there are times when it is only
desired to read the metadata and nothing else, so allow the caller of pkg_load
to choose the behavior they need.
This pays big dividends in speeding up pacman cache cleaning functionality.
Old (729 packages):
real 1m43.717s
user 1m20.785s
sys 0m2.993s
New (729 packages):
real 0m25.607s
user 0m19.389s
sys 0m0.543s
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
Add some alpm functions for getting optdepends, have makepkg include them
in the PKGINFO file, and have a pacman -Qi operation display the raw string
as stored by libalpm.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
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>
|
|
parse_descfile.
This fix FS#8081. The tr_TR locale has known issue with case insensitive
comparisons, mostly because upper(i) != I.
So the .PKGINFO files generated by makepkg MUST contain all keywords in lowercases now.
This was already done, but was not mandatory.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|
|
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|
|
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>
|
|
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>
|
|
This patch cleans up and fix the _alpm_trans_update_depends function
and ensure that all requiredby fields are filled in case of multiple satisfiers
(previously, the handling of mutliple satisfiers in that function was inconsistent).
This makes a special case handling of requiredby in commit_single_pkg() obsolete,
and so allows cleaning that code as well.
Also fixed upgrade056 pactest because :
1) the requiredby fields were wrong, and this wouldn't happen with the fixed _alpm_trans_update_depends().
2) this is a very unusual case anyway (and handling all corner cases combined to a broken database
seems nearly impossible to achieve).
References :
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008919.html
http://www.archlinux.org/pipermail/pacman-dev/2007-July/008920.html
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
|