diff --git a/ChangeLog b/ChangeLog index f66336d..e2443b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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' diff --git a/src/locker.h b/src/locker.h index 44968cc..d7d5a9b 100644 --- a/src/locker.h +++ b/src/locker.h @@ -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 { @@ -44,7 +46,7 @@ private: vector m_packages; static const string LOCKER_FILE; static const string LOCKER_FILE_PATH; - + bool m_openFailed; }; diff --git a/src/prtget.cpp b/src/prtget.cpp index 943d3f9..e66cfd0 100644 --- a/src/prtget.cpp +++ b/src/prtget.cpp @@ -1467,8 +1467,7 @@ void PrtGet::setLock( bool lock ) list::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); } @@ -1790,7 +1796,7 @@ void PrtGet::printDepsLevel(int indent, const Package* package) list::iterator it = deps.begin(); bool isAlias = false; string aliasName = ""; - + for (; it != deps.end(); ++it) { if ( m_pkgDB->isInstalled( *it, true, &isAlias, &aliasName ) ) { cout << "[i] "; @@ -1828,7 +1834,7 @@ void PrtGet::printDepsLevel(int indent, const Package* package) void PrtGet::dumpConfig() { - + cout.setf( ios::left, ios::adjustfield ); cout.width( 20 ); cout.fill( ' ' ); @@ -1837,10 +1843,10 @@ void PrtGet::dumpConfig() cout.setf( ios::left, ios::adjustfield ); cout.width( 20 ); cout.fill( ' ' ); - cout << "Ext. dep. file: " + cout << "Ext. dep. file: " << Repository::EXTERNAL_DEPENDENCY_FILE << endl; - - + + if (!m_parser->noStdConfig()) { string fName = CONF_FILE; if ( m_parser->isAlternateConfigGiven() ) {