Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bc31c0745 | ||
|
|
da6bfb0a60 | ||
|
|
ac030e3530 | ||
|
|
8f9a1254ff | ||
|
|
69c857a896 | ||
|
|
ca0a3c3524 | ||
|
|
041feb25c1 | ||
|
|
2993a9ad57 | ||
|
|
75285a0dd9 | ||
|
|
decb4e383c | ||
|
|
4b6998eade | ||
|
|
2fd99a3c8f | ||
|
|
54dc911470 |
2
configure
vendored
2
configure
vendored
@@ -2585,7 +2585,7 @@ fi
|
||||
# Define the identity of the package.
|
||||
|
||||
PACKAGE=prt-get
|
||||
VERSION=5.19.1
|
||||
VERSION=5.19.5
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([src/prtget.cpp])
|
||||
AM_INIT_AUTOMAKE(prt-get,5.19.1)
|
||||
AM_INIT_AUTOMAKE(prt-get,5.19.5)
|
||||
|
||||
|
||||
dnl Determine default prefix
|
||||
|
||||
@@ -25,18 +25,9 @@ ArgParser::ArgParser( int argc, char** argv )
|
||||
m_isAlternateConfigGiven( false ),
|
||||
m_useCache( false ),
|
||||
m_calledAsPrtCache( false ),
|
||||
m_alternateConfigFile( "" ),
|
||||
m_pkgmkArgs( "" ),
|
||||
m_pkgaddArgs( "" ),
|
||||
m_pkgrmArgs( "" ),
|
||||
m_installRoot( "" ),
|
||||
m_ignore( "" ),
|
||||
m_argc( argc ),
|
||||
m_argv( argv ),
|
||||
m_verbose( 0 ),
|
||||
m_writeLog( false ),
|
||||
m_hasFilter( false ),
|
||||
m_noStdConfig( false ),
|
||||
m_writeLog( false ),
|
||||
m_nodeps( false ),
|
||||
m_all( false ),
|
||||
m_printPath( false ),
|
||||
@@ -48,7 +39,21 @@ ArgParser::ArgParser( int argc, char** argv )
|
||||
m_fullPath(false),
|
||||
m_recursive(false),
|
||||
m_printTree(false),
|
||||
m_depSort(false)
|
||||
m_depSort(false),
|
||||
m_alternateConfigFile( "" ),
|
||||
m_pkgmkArgs( "" ),
|
||||
m_pkgaddArgs( "" ),
|
||||
m_pkgrmArgs( "" ),
|
||||
m_sortArgs( "" ),
|
||||
m_filter( "" ),
|
||||
m_commandName( "" ),
|
||||
m_unknownOption( "" ),
|
||||
m_installRoot( "" ),
|
||||
m_ignore( "" ),
|
||||
m_commandType(HELP),
|
||||
m_argc( argc ),
|
||||
m_argv( argv ),
|
||||
m_verbose( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -24,11 +24,12 @@ Configuration::Configuration( const std::string& configFile,
|
||||
const ArgParser* parser )
|
||||
: m_configFile( configFile ),
|
||||
m_parser( parser ),
|
||||
m_cacheFile( "" ),
|
||||
m_rootList(),
|
||||
m_logFilePattern( "" ),
|
||||
m_writeLog( false ),
|
||||
m_appendLog( false ),
|
||||
m_removeLogOnSuccess( false ),
|
||||
m_logFilePattern( "" ),
|
||||
m_cacheFile( "" ),
|
||||
m_readmeMode( VERBOSE_README ),
|
||||
m_runScripts( false ),
|
||||
m_preferHigher( false ),
|
||||
|
||||
@@ -51,9 +51,17 @@ InstallTransaction::InstallTransaction( const list<string>& names,
|
||||
const Repository* repo,
|
||||
PkgDB* pkgDB,
|
||||
const Configuration* config )
|
||||
: m_repo( repo ),
|
||||
m_pkgDB( pkgDB ),
|
||||
: m_pkgDB( pkgDB ),
|
||||
m_resolver(),
|
||||
m_repo( repo ),
|
||||
m_depCalced( false ),
|
||||
m_installedPackages(),
|
||||
m_alreadyInstalledPackages(),
|
||||
m_ignoredPackages(),
|
||||
m_depNameList(),
|
||||
m_depList(),
|
||||
m_missingPackages(),
|
||||
m_installErrors(),
|
||||
m_config( config )
|
||||
{
|
||||
list<string>::const_iterator it = names.begin();
|
||||
@@ -73,9 +81,17 @@ InstallTransaction::InstallTransaction( const list<char*>& names,
|
||||
const Repository* repo,
|
||||
PkgDB* pkgDB,
|
||||
const Configuration* config )
|
||||
: m_repo( repo ),
|
||||
m_pkgDB( pkgDB ),
|
||||
: m_pkgDB( pkgDB ),
|
||||
m_resolver(),
|
||||
m_repo( repo ),
|
||||
m_depCalced( false ),
|
||||
m_installedPackages(),
|
||||
m_alreadyInstalledPackages(),
|
||||
m_ignoredPackages(),
|
||||
m_depNameList(),
|
||||
m_depList(),
|
||||
m_missingPackages(),
|
||||
m_installErrors(),
|
||||
m_config( config )
|
||||
{
|
||||
list<char*>::const_iterator it = names.begin();
|
||||
@@ -97,9 +113,17 @@ InstallTransaction::InstallTransaction( const string& name,
|
||||
const Repository* repo,
|
||||
PkgDB* pkgDB,
|
||||
const Configuration* config )
|
||||
: m_repo( repo ),
|
||||
m_pkgDB( pkgDB ),
|
||||
: m_pkgDB( pkgDB ),
|
||||
m_resolver(),
|
||||
m_repo( repo ),
|
||||
m_depCalced( false ),
|
||||
m_installedPackages(),
|
||||
m_alreadyInstalledPackages(),
|
||||
m_ignoredPackages(),
|
||||
m_depNameList(),
|
||||
m_depList(),
|
||||
m_missingPackages(),
|
||||
m_installErrors(),
|
||||
m_config( config )
|
||||
{
|
||||
m_packages.push_back( make_pair( name, m_repo->getPackage( name ) ) );
|
||||
|
||||
@@ -316,10 +316,8 @@ void Package::expandShellCommands(std::string& input,
|
||||
for (int i = 0; i < TAG_COUNT; ++i) {
|
||||
string::size_type pos, dpos = 0;
|
||||
|
||||
int len;
|
||||
pos = 0;
|
||||
while ((pos = input.find(startTag[i], pos)) != string::npos) {
|
||||
len = input.length();
|
||||
|
||||
if (unameBuf.release) {
|
||||
input = replaceAll(input,
|
||||
|
||||
@@ -27,7 +27,7 @@ using namespace std;
|
||||
|
||||
|
||||
const string PkgDB::PKGDB = "/var/lib/pkg/db";
|
||||
const string PkgDB::ALIAS_STORE = LOCALSTATEDIR"/lib/pkg/prt-get.aliases";
|
||||
const string PkgDB::ALIAS_STORE = SYSCONFDIR"/prt-get.aliases";
|
||||
|
||||
/*!
|
||||
Create a PkgDB object
|
||||
|
||||
@@ -56,10 +56,11 @@ const string PrtGet::DEFAULT_CACHE_FILE = LOCALSTATEDIR"/lib/pkg/prt-get.cache";
|
||||
PrtGet::PrtGet( const ArgParser* parser )
|
||||
: m_repo( 0 ),
|
||||
m_config( 0 ),
|
||||
m_currentTransaction( 0 ),
|
||||
m_locker(),
|
||||
m_parser( parser ),
|
||||
m_cacheFile( DEFAULT_CACHE_FILE ),
|
||||
m_returnValue( PG_OK ),
|
||||
m_currentTransaction( 0 )
|
||||
m_returnValue( PG_OK )
|
||||
{
|
||||
if ( m_parser->wasCalledAsPrtCached() ) {
|
||||
m_appName = "prt-cache";
|
||||
@@ -523,7 +524,8 @@ void PrtGet::listInstalled()
|
||||
{
|
||||
assertMaxArgCount(1);
|
||||
|
||||
string arg = "*";
|
||||
string arg = m_useRegex ? ".*" : "*";
|
||||
|
||||
if ( m_parser->otherArgs().size() == 1 ) {
|
||||
arg = *(m_parser->otherArgs().begin());
|
||||
}
|
||||
@@ -552,7 +554,7 @@ void PrtGet::listInstalled()
|
||||
l.erase(mit);
|
||||
|
||||
InstallTransaction trans( name, m_repo, m_pkgDB, m_config );
|
||||
InstallTransaction::InstallResult result = trans.calcDependencies();
|
||||
InstallTransaction::InstallResult result __attribute__((unused)) = trans.calcDependencies();
|
||||
const list<string>& depRef = trans.dependencies();
|
||||
list<string>::const_iterator it = depRef.begin();
|
||||
|
||||
@@ -923,7 +925,7 @@ void PrtGet::printDiff()
|
||||
const map<string, string>& installed = m_pkgDB->installedPackages();
|
||||
map<string, string>::const_iterator it = installed.begin();
|
||||
const Package* p = 0;
|
||||
int count = 0;
|
||||
size_t count = 0;
|
||||
COMP_RESULT result;
|
||||
for ( ; it != installed.end(); ++it ) {
|
||||
|
||||
@@ -1625,6 +1627,8 @@ SignalHandler::HandlerResult PrtGet::handleSignal( int signal )
|
||||
if ( m_currentTransaction ) {
|
||||
evaluateResult( *m_currentTransaction, false, true );
|
||||
}
|
||||
|
||||
return EXIT;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -1802,9 +1806,14 @@ void PrtGet::ls()
|
||||
if ( p ) {
|
||||
string dirname = p->path() + "/" + p->name();
|
||||
DIR* dir = opendir(dirname.c_str());
|
||||
if (dir == NULL) {
|
||||
cerr << "Directory " << dirname << " not found" << endl;
|
||||
m_returnValue = PG_GENERAL_ERROR;
|
||||
return;
|
||||
}
|
||||
struct dirent* entry;
|
||||
vector<string> files;
|
||||
while (entry = readdir(dir)) {
|
||||
while ((entry = readdir(dir))) {
|
||||
string dName = entry->d_name;
|
||||
if (dName != "." && dName != "..") {
|
||||
files.push_back(dName);
|
||||
@@ -1844,7 +1853,7 @@ void PrtGet::cat()
|
||||
}
|
||||
string file = p->path() + "/" + p->name() + "/" + fileName;
|
||||
if (!printFile(file)) {
|
||||
cerr << "File '" << *it << "' not found" << endl;
|
||||
cerr << "File '" << fileName << "' not found" << endl;
|
||||
m_returnValue = PG_GENERAL_ERROR;
|
||||
return;
|
||||
}
|
||||
@@ -1936,28 +1945,28 @@ void PrtGet::remove()
|
||||
|
||||
}
|
||||
|
||||
void PrtGet::assertMaxArgCount(int count)
|
||||
void PrtGet::assertMaxArgCount(size_t count)
|
||||
{
|
||||
if ( m_parser->otherArgs().size() > count ) {
|
||||
argCountFailure(count, "at most");
|
||||
}
|
||||
}
|
||||
|
||||
void PrtGet::assertExactArgCount(int count)
|
||||
void PrtGet::assertExactArgCount(size_t count)
|
||||
{
|
||||
if ( m_parser->otherArgs().size() != count ) {
|
||||
argCountFailure(count, "exactly");
|
||||
}
|
||||
}
|
||||
|
||||
void PrtGet::assertMinArgCount(int count)
|
||||
void PrtGet::assertMinArgCount(size_t count)
|
||||
{
|
||||
if ( m_parser->otherArgs().size() < count ) {
|
||||
argCountFailure(count, "at least");
|
||||
}
|
||||
}
|
||||
|
||||
void PrtGet::argCountFailure(int count, const string& specifier)
|
||||
void PrtGet::argCountFailure(size_t count, const string& specifier)
|
||||
{
|
||||
cerr << m_appName << " "
|
||||
<< m_parser->commandName() << " takes " << specifier << " "
|
||||
|
||||
@@ -146,10 +146,10 @@ protected:
|
||||
static const string DEFAULT_CACHE_FILE;
|
||||
|
||||
|
||||
void assertMinArgCount(int count);
|
||||
void assertMaxArgCount(int count);
|
||||
void assertExactArgCount(int count);
|
||||
void argCountFailure(int count, const string& specifier);
|
||||
void assertMinArgCount(size_t count);
|
||||
void assertMaxArgCount(size_t count);
|
||||
void assertExactArgCount(size_t count);
|
||||
void argCountFailure(size_t count, const string& specifier);
|
||||
|
||||
VersionComparator::COMP_RESULT
|
||||
compareVersions( const string& v1, const string& v2 );
|
||||
|
||||
@@ -256,6 +256,7 @@ Repository::initFromCache( const string& cacheFile )
|
||||
if ( fgets( input, length, fp ) ) {
|
||||
line = stripWhiteSpace( input );
|
||||
if ( line != CACHE_VERSION ) {
|
||||
fclose( fp );
|
||||
return FORMAT_ERR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,18 +58,18 @@ string stripWhiteSpace( const string& s )
|
||||
return s;
|
||||
}
|
||||
|
||||
int pos = 0;
|
||||
size_t pos = 0;
|
||||
string line = s;
|
||||
string::size_type len = line.length();
|
||||
size_t len = line.length();
|
||||
while ( pos < len && isspace( line[pos] ) ) {
|
||||
++pos;
|
||||
}
|
||||
line.erase( 0, pos );
|
||||
pos = line.length()-1;
|
||||
while ( pos > -1 && isspace( line[pos] ) ) {
|
||||
while ( pos != (size_t) -1 && isspace( line[pos] ) ) {
|
||||
--pos;
|
||||
}
|
||||
if ( pos != -1 ) {
|
||||
if ( pos != (size_t) -1 ) {
|
||||
line.erase( pos+1 );
|
||||
}
|
||||
return line;
|
||||
|
||||
@@ -39,16 +39,16 @@ COMP_RESULT compareVersions(const string& v1, const string& v2)
|
||||
|
||||
tokenizeIntoBlocks(v1, blocks1);
|
||||
tokenizeIntoBlocks(v2, blocks2);
|
||||
int blockLen = normalizeVectors(blocks1, blocks2);
|
||||
size_t blockLen = normalizeVectors(blocks1, blocks2);
|
||||
|
||||
for (int i = 0; i < blockLen; ++i) {
|
||||
for (size_t i = 0; i < blockLen; ++i) {
|
||||
vector<string> tokens1;
|
||||
vector<string> tokens2;
|
||||
split(blocks1[i], '.', tokens1);
|
||||
split(blocks2[i], '.', tokens2);
|
||||
int tokLen = normalizeVectors(tokens1, tokens2);
|
||||
size_t tokLen = normalizeVectors(tokens1, tokens2);
|
||||
|
||||
for (int j = 0; j < tokLen; ++j) {
|
||||
for (size_t j = 0; j < tokLen; ++j) {
|
||||
if (tokens1[j] == tokens2[j]) {
|
||||
continue;
|
||||
}
|
||||
@@ -67,8 +67,8 @@ COMP_RESULT compareVersions(const string& v1, const string& v2)
|
||||
|
||||
tokenizeMixed(tokens1[j], subtokens1);
|
||||
tokenizeMixed(tokens2[j], subtokens2);
|
||||
int subTokLen = normalizeVectors(subtokens1, subtokens2);
|
||||
for (int k = 0; k < subTokLen; ++k) {
|
||||
size_t subTokLen = normalizeVectors(subtokens1, subtokens2);
|
||||
for (size_t k = 0; k < subTokLen; ++k) {
|
||||
long sl1 = strtol(subtokens1[k].c_str(), &error1, 10);
|
||||
long sl2 = strtol(subtokens2[k].c_str(), &error2, 10);
|
||||
if (*error1 == 0 && *error2 == 0) {
|
||||
@@ -123,9 +123,9 @@ COMP_RESULT compareVersions(const string& v1, const string& v2)
|
||||
return EQUAL;
|
||||
}
|
||||
|
||||
int normalizeVectors(vector<string>& v1, vector<string>& v2)
|
||||
size_t normalizeVectors(vector<string>& v1, vector<string>& v2)
|
||||
{
|
||||
int length = max(v1.size(), v2.size());
|
||||
size_t length = max(v1.size(), v2.size());
|
||||
|
||||
while (v1.size() < length) {
|
||||
v1.push_back("-1");
|
||||
@@ -140,14 +140,14 @@ int normalizeVectors(vector<string>& v1, vector<string>& v2)
|
||||
void tokenizeMixed(const string& s, vector<string>& tokens)
|
||||
{
|
||||
vector<bool> digitMask;
|
||||
for (int i = 0; i < s.length(); ++i) {
|
||||
for (size_t i = 0; i < s.length(); ++i) {
|
||||
digitMask.push_back(isdigit(s[i]));
|
||||
}
|
||||
|
||||
bool state = digitMask[0];
|
||||
string tok;
|
||||
tok = s[0];
|
||||
for (int i = 1; i < digitMask.size(); ++i) {
|
||||
for (size_t i = 1; i < digitMask.size(); ++i) {
|
||||
if (digitMask[i] != state) {
|
||||
tokens.push_back(tok);
|
||||
tok = s[i];
|
||||
|
||||
@@ -19,7 +19,7 @@ enum COMP_RESULT { LESS, GREATER, EQUAL, UNDEFINED };
|
||||
|
||||
COMP_RESULT compareVersions(const string& v1, const string& v2) ;
|
||||
void tokenizeIntoBlocks(const string& version, vector<string>& blocks);
|
||||
int normalizeVectors(vector<string>& v1, vector<string>& v2);
|
||||
size_t normalizeVectors(vector<string>& v1, vector<string>& v2);
|
||||
void tokenizeMixed(const string& s, vector<string>& tokens);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user