prt-get: remove lock on 'prt-get remove'

git-svn-id: https://crux.nu/svn/tools/prt-get/trunk@1137 0b5ae1c7-2405-0410-a7fc-ba219f786e1e
This commit is contained in:
Johannes Winkelmann 2006-04-04 15:39:45 +00:00
parent 62ab83eb87
commit 866c029f96
3 changed files with 17 additions and 8 deletions

View File

@ -2,6 +2,7 @@
- Fix compilation on OpenBSD
- Show alias info in depends
- don't install alias file and deplist
- unlock ports on remove
* 0.5.11 29.05.2005 Johannes Winkelmann
- add --path to 'ls'

View File

@ -24,6 +24,8 @@ using namespace std;
* - marked in prt-get diff
* - not shown in prt-get quickdiff
* - not updated in prt-get sysup
*
* remember to call store!
*/
class Locker
{

View File

@ -1467,8 +1467,7 @@ void PrtGet::setLock( bool lock )
list<char*>::const_iterator it = args.begin();
for ( ; it != args.end(); ++it ) {
if ( lock ) {
const Package* p = m_repo->getPackage( *it );
if ( p ) {
if (m_pkgDB->isInstalled( *it )) {
if (!m_locker.lock( *it )) {
cerr << "Already locked: " << *it << endl;
m_returnValue = PG_GENERAL_ERROR;
@ -1476,15 +1475,18 @@ void PrtGet::setLock( bool lock )
} else {
cerr << "Package '" << *it << "' not found" << endl;
m_returnValue = PG_GENERAL_ERROR;
return;
}
} else {
if ( !m_locker.unlock( *it ) ) {
cerr << "Not locked previously: " << *it << endl;
m_returnValue = PG_GENERAL_ERROR;
return;
}
}
}
if (!m_locker.store()) {
cerr << "Failed to write lock data" << endl;
m_returnValue = PG_GENERAL_ERROR;
@ -1672,6 +1674,10 @@ void PrtGet::remove()
Process proc(command, args);
if (m_parser->isTest() || proc.executeShell() == 0) {
removed.push_back(*it);
if (m_locker.isLocked(*it)) {
m_locker.unlock(*it);
m_locker.store();
}
} else {
failed.push_back(*it);
}