diff options
author | Johannes Winkelmann <jw@smts.ch> | 2006-04-04 15:39:45 +0000 |
---|---|---|
committer | Johannes Winkelmann <jw@smts.ch> | 2006-04-04 15:39:45 +0000 |
commit | 866c029f9667a2da6e9a4e0620e25f653dee6dd0 (patch) | |
tree | 6bd3e8becd17f4d1e77cfd8d4416ae8c64abb98b | |
parent | 62ab83eb8739d77b71df9cb66e427cdb163d6d0f (diff) | |
download | prt-get-866c029f9667a2da6e9a4e0620e25f653dee6dd0.tar.gz prt-get-866c029f9667a2da6e9a4e0620e25f653dee6dd0.tar.xz |
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
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/locker.h | 4 | ||||
-rw-r--r-- | src/prtget.cpp | 20 |
3 files changed, 17 insertions, 8 deletions
@@ -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<string> 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<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); } @@ -1790,7 +1796,7 @@ void PrtGet::printDepsLevel(int indent, const Package* package) list<string>::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() ) { |