Commit Graph

24 Commits

Author SHA1 Message Date
Juan RP
4b0c08ebcf xbps_unpack_binary_pkg: multiple fixes and improvements.
- Don't write any archive entry to disk unless the package metadata
  plist files are found.
- Always check for the package metadata plist files in the first 4
  entries, if they aren't found stop the unpacking... invalid archive.
- Don't check for removing INSTALL/REMOVE scripts on each iteration when
  extracting, just check it once before the loop.
- Add doxygen comments and related stuff.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100122225639-wameh8ls94bkm68h
2010-01-22 23:56:39 +01:00
Juan RP
c0b280c118 Mega-commit to document the API with doxygen.
Some changes were made to the API when making the documentation:

- A few exported functions are now hidden, because they were only used
  internally in the library.
- A few exported symbols were renamed to document them better than
  previously.
- Cosmetic changes all along the way, as well as some fixes here and there.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100121021019-onbsivlrhdb7t3ou
2010-01-21 03:10:19 +01:00
Juan RP
e11a1fe651 xbps_unpack_binary_pkg: fixed some bugs while upgrading essential pkgs.
* A package failed to be upgraded properly if current pkg contained
  INSTALL/REMOVE scripts, while the new one didn't have any of them.
  Fixed this by always removing current scripts if they exist.

* Essential pkgs are never removed (they are replaced) so the pre remove
  action target was never called, now it all works properly.

Bumped XBPS_RELVER because I consider these bugs so important.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20100118184932-pdsb0djvf0swylm3
2010-01-18 19:49:32 +01:00
Juan RP
a165d20193 Error and warning messages should go to stderr, make it so.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20100115141916-tpg2rga1i4pm42kj
2010-01-15 15:19:16 +01:00
Juan RP
279219a348 xbps_unpack_binary_pkg: set INSTALL/REMOVE perms to 0750.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091211095846-kwszryu1wlho39eq
2009-12-11 10:58:46 +01:00
Juan RP
eb885bbcc2 When executing the INSTALL/REMOVE scripts, always pass the UPDATE
value to them.

Bump XBPS_RELVER to 20091209.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091209151435-1yy9f7k2880tswz7
2009-12-09 16:14:35 +01:00
Juan RP
026dc6dbd9 xbps_unpack_binary_pkg: bail out if required metadata plist files aren't
found after processing 6 entries from the archive.

This to detect non-valid XBPS binary packages.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091207062422-fnwx9n0miq1nwadt
2009-12-07 07:24:22 +01:00
Juan RP
b03a18ff84 xbps_unpack_binary_pkg: removed 2nd bool argument, look for a preserve object
to not remove files in removal or upgrades.

Bump XBPS_RELVER to 20091202.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091202053103-uby6hwu313pieafa
2009-12-02 06:31:03 +01:00
Juan RP
88ba635780 Split unpack.c config files and remove obsoletes code into its own files.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128044321-6kmhrrxggv2h681w
2009-11-28 05:43:21 +01:00
Juan RP
f3d2481c31 xbps-repo: if fetching info from remote repo for the 'show' and 'show-files'
targets and the binary package exists in cachedir, use it.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128022129-y6y2tr0vtvy2w745
2009-11-28 03:21:29 +01:00
Juan RP
bf7ca100f6 xbps_unpack_binary_pkg: cosmetic changes.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128014936-0k9pmxox7igtlfmn
2009-11-28 02:49:36 +01:00
Juan RP
494504dbec Added support for a cachedir to store downloaded binpkgs.
libxbps:
 * Added xbps_set_cachedir() and xbps_get_cachedir(). By default it's
   set to /var/cache/xbps if not specified and it's always relative
   to the root directory.
 * Move mkpath() code from sync_remote_pkgidc.c into its own file mkpath.c
   to use it in another parts of the code.
 * Added xbps_get_binpkg_local_path(), that returns the local path to
   a binary package file, stored in cachedir or local repo.
 * Remote pkg index files are now stored directly in metadir/repodir,
   skipping the arch directory because binpkgs are now in cachedir.

xbps-bin:
 * Added -c flag to set the cachedir.
 * Check sha256 hashes in the download stage so that it can check
   a downloaded binpkg immediately once is stored.
 * If a binpkg doesn't match the hash it will be refetched.

Bump XBPS_RELVER to 20091128.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128013841-kkcvk07lsqdr26w8
2009-11-28 02:38:41 +01:00
Juan RP
87a216fd11 Major changes in libxbps to implement caching in some cases.
libxbps:
 - Moved repolist code to lib/repository_pool.c.
 - Renamed xbps_{prepare,release}_repolist_data() to
   xbps_repository_pool_{init,release} respectively.
 - Moved regpkgdb dict code to lib/regpkgs_dictionary.c.
 - Renamed xbps_{prepare,release}_regpkgdb_dict() to
   xbps_regpkgs_dictionary_{init,release} respectively.
 - Use a global reference count for repository_pool and regpkgs_dictionary,
   this gives a substantial performance gain while looking for dependencies
   in repository pool, among other things.
 - Make xbps_find_pkg_* functions return errno and use it to detect
   for spurious errors in code using them.
 - Add code to detect when a dependency is already unpacked.

xbps-bin:
 - Do not set pkg state to unpacked in the transaction, it's set already
   while a package is unpacked.
 - While installing or updating packages, it now knows when a dependency
   is already unpacked and shows it as "unconfigured".

Bump XBPS_RELVER to 20091126.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091126022250-uu8x0fa86l4scb5x
2009-11-26 02:22:50 +00:00
Juan RP
bf82b6512d Extensively verified that all functions have its return value
checked for any spurious error, this should make the core more safer :-)

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091123094651-5prw0bkqmt3y8h23
2009-11-23 09:46:51 +00:00
Juan RP
308a25f302 xbps_unpack_binary_pkg: initialize a local var.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091119051042-0kyp37uo6puex4jt
2009-11-19 06:10:42 +01:00
Juan RP
d379d1d44c Implemented blueprint "essential-upgrades".
See https://blueprints.launchpad.net/xbps/+spec/essential-upgrades
for complete information.

Implementation used almost the same code than the pseudo-code explained
in the blueprint. Works really fine, tested with glibc-2.10.1 -> 2.11
upgrade.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091109013004-szdc9ngb3i70bc4p
2009-11-09 02:30:04 +01:00
Juan RP
7aebea684b Implemented support for working with remote repositories.
libfetch from NetBSD's pkgsrc has been imported into lib/fetch, but
the objects are embedded into libxbps. Only a public function to fetch
files has been implemented: xbps_fetch_file().

The library now is built with -fvisibility=hidden by default, and
exported symbols are the ones that use the SYMEXPORT macro.

The code works well enough, but will need many more cleanups.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091027004600-0lq9aao67lisbzxv
2009-10-27 01:46:00 +01:00
Juan RP
03c7b26874 Fix typo in previous.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20091021162718-n24n1yf7144rmqrz
2009-10-21 18:27:18 +02:00
Juan RP
f99a154d7f Improved unpacking package files, fixing bugs in configuration file
handling.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091021161617-c9d2jyhxlwlid4e6
2009-10-21 18:16:17 +02:00
Juan RP
53de9e531b lib/unpack.c: fix a NULL pointer deref when checking configuration
files exists or not while unpacking.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091010064437-9121w162sy8ilpim
2009-10-10 08:44:37 +02:00
Juan RP
c56e2931db Fix bug #439457 "Unpacking a package ignores correct perms"
Simplify logic and fix the mistake of pass-by-value vs pass-by-ref.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20090930162921-wfx9ze2v7rjrpmza
2009-09-30 18:29:21 +02:00
Juan RP
62b514f6e1 lib/unpack.c: fix the logic of an inverted conditional.
--HG--
extra : convert_revision : xtraeme%40gmail.com-20090818215919-xv54d9a2vobsizlr
2009-08-18 23:59:19 +02:00
Juan RP
5a2348e502 xbps_unpack_binary_pkg: switch back to fsync(), to be safe.
Move the set_pkg_state call just after the fsync call, otherwise
strange things can ocurr sometimes.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20090818205029-b01fqdf5tw4hnzgc
2009-08-18 22:50:29 +02:00
juan
3f3b6d00dd Initial import of xbps with code as August '09.
--HG--
extra : convert_revision : juan%40xbps-20090817170720-amxxac4a2e8bza1j
2009-08-17 19:07:20 +02:00