Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: freebsd/pkg
head fork: scher/pkgng
compare: par-dev
Checking mergeability… Don't worry, you can still create the pull request.
Commits on Aug 07, 2012
@scher scher [fixed] redesign of pkgdb_lock and pkgdb_unlock functions
it is assumed that lock_count==0 before lock and ==1 if the database is locked.
Asserts help us here.
Locking is implemented in a form of infinity while loop, with sleep(1) call if the database is locked by another pkgng process
EPKG_OK is the return value of the functions.
pkgdb_unlock return EPKG_FATAL in case of error while sql query.
@scher scher [new_feature] global var that represents sub command (pkg_subcmd)
it is appropriate to use global var, to avoid changes of signatures of various functions, and code modification to pass this value to pkgdb_open() function.
@scher scher [fixed] remove unnecessary locks/unlocks from jobs containers
Locking logic will be moved to pkgdb_open/pkgdb_close functions
Locks/unlocks in the above functions are superfluous and cause assertion errors
@scher scher [new_feature] Database locking depends on sub command
Locking logic integrated into pkgdb_open pkgdb_close functions.
Locking/Unlocking depends on sub command that was called.
All subcommands that require locked are listed in subcmd_lockers list.
@scher scher update .gitignore 9443386
@scher scher [close #1] *int lock_count* field changed to *bool locked* 7a442b6
@scher scher [fixed #3] frontend specific locking logic moved from libpkg
General global require_lock flag in libpkg to trigger DB locking.
Frontend sets this flag.
@scher scher [fixes #2] User configurable sleep timeout and number of attempts for…
… db locking
@scher scher [fixes #15] pkgdb_lock/unlock handles specific sqlite3_exec exit codes
pkgdb_lock/unlock now use sqlite3_exec instead of sql_exec (see #15)
@scher scher [fixes #14] catch pkgdb_lock/unlock exit statuses 7aae4be
@scher scher [closed #16] database unlocking after improper lock 3d736d2
@scher scher [closes #18] rename pkg.config fields 78e133e
@scher scher [fixes #21] try to apply sqlite3_busy_timeout() instead of sleep() wh…
…ile locking the database.
@scher scher default PKG_DB_LOCK_TIMEOUT set to 5 1dc3239
@scher scher Locks/unlocks while populating pkg_jobs
pkgdb_lock() now allows multiples locked by one process.
closes #5
@scher scher [new_feature] registration of active installations
integrated into:  pkg_add(), pkg_delete(), pkg_jobs_fetch()
@scher scher [new_feature] unregister active installations
integrated into pkg_jobs_fetch()
@scher scher fixes for reg/unreg active installations
track wrk_count for multiple registrations by the same process
@scher scher [fixed] single transition is used instead of DB locking in reg/unreg_…
@scher scher complete reg/unreg of active installs for pkg_jobs_install() 2f660de
@scher scher complete reg/unreg of active installs for pkg_add() pkg_delete() d6d8c26
@scher scher [fixes] DB unlock move to pkgdb_it_next()
It is more convenient to unlock DB as soon as db iterator reaches end of the query.
Hence there is no need to free this iterator as soon as possible to unlock the DB.
@scher scher complete reg/unreg of active installs for pkg_jobs_deinstall() 4f2abbe
@scher scher [bugfix] return void instead of int in function declaration bd983af
@scher scher [new_feature] pkg_fetch_file() receives open file flags as argument
it is necessary to pass flags to this function to prevent concurrent repo updates.
flags: O_WRONLY|O_CREAT|O_TRUNC|O_EXLOCK are sufficient for this purpose.
Hence process will be blocked while trying to open the file if another process is working with this file.
No need to require "non-existence" of this file, be cause O_TRUNC flag will rewrite the whole file.
@scher scher common file name is used for temp repo archive
It is necessary to use predefined file name for temporary repo archive,
so that all the processes will be able to acquire exclusive lock on the file.
This prevents concurrent concurrent repo updates by multiple processes
@scher scher [new feature] sanity check of active_installations table
deletes rows with invalid pids
@scher scher sanity check integrated into pkg/install 5f98bf1
@scher scher [bugfix] fixes "pkg: sqlite: no such savepoint: upgrade" error while …
…installing a pkg

If all goes Ok while installing a package using "pkg install some_pkg",
 "pkg: sqlite: no such savepoint: upgrade" error occurs, because save point is
released inside "while loop" (libpkg/pkg_jobs.c) and after the loop.
Execution flow is changed, not to get this error.
Savepoints are always released inside while loop.
@scher scher remove unnecessary pkgng specific db locking
All this stuff is implemented within libpkg as frontend independent
@scher scher change variable name e54ac13
@scher scher add pkgdb_reg_active_pkg() exit codes handling 5cc4363
@scher scher pkgdb_unreg_active_pkg() signature changed 0061af1
@scher scher unlock the database if necessary while closing DB connection 9c955ec
@scher scher delete debugging putput ef898bf
@scher scher complete sql statement only if necessary in pkgdb_sanity_active_insta…
@scher scher remove editor/OS specific files from .gitignore 188f4e0
Something went wrong with that request. Please try again.