Skip to content

Commit

Permalink
Can install severall packages, severall packages and collections or s…
Browse files Browse the repository at this point in the history
…everall collections

It also install the locale in case of collection
  • Loading branch information
tnut committed Sep 7, 2015
1 parent a695725 commit 0505e69
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ MANDIR = /usr/share/man
LIBDIR = /usr/lib
ETCDIR = /etc

VERSION = 1.3.0
VERSION = 1.3.1
NAME = cards-$(VERSION)

CXXFLAGS += -DNDEBUG -std=c++11
Expand Down
13 changes: 7 additions & 6 deletions src/cards_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ void CardsInfo::diffPorts()
result.push_back(pair<string, DiffVers>("", DV));
unsigned int widthPackageName = result.begin()->first.length();
unsigned int widthInstalled = result.begin()->second.installed.length();
char sRelease[5]; // release up to 9999 should be enough :)
int newRelease = 1;
string baseName = "";
string newVersion = "";
string sRelease = "";
for (packages_t::const_iterator i = m_listOfInstPackages.begin(); i != m_listOfInstPackages.end(); ++i) {
if (! pkgrepo->checkPortExist(i->first))
continue;
Expand All @@ -170,9 +170,9 @@ void CardsInfo::diffPorts()
if ( ( i->second.version == newVersion ) && ( i->second.release == newRelease) ) {
continue;
} else {
sprintf(sRelease,"%d",i->second.release);
sRelease=itos(i->second.release);
DV.installed = i->second.version + "-" + sRelease;
sprintf(sRelease,"%d",newRelease);
sRelease=itos(newRelease);
DV.available = newVersion + "-" + sRelease;
result.push_back(pair<string, DiffVers> (i->first, DV));
if (i->first.length() > widthPackageName)
Expand Down Expand Up @@ -207,24 +207,25 @@ void CardsInfo::diffBinaries()
result.push_back(pair<string, DiffVers >("", DV));
unsigned int widthPackageName = result.begin()->first.length();
unsigned int widthInstalled = result.begin()->second.installed.length();
char sRelease[5]; // release up to 9999 should be enough :)
int newRelease = 1;
string baseName = "";
string newVersion = "";
string sRelease = "";
for (packages_t::const_iterator i = m_listOfInstPackages.begin(); i != m_listOfInstPackages.end(); ++i) {
if (! pkgrepo->checkBinaryExist(i->first))
continue;
baseName = pkgrepo->getBasePackageName(i->first);
if ( baseName.size() < 2 )
continue;

newVersion = pkgrepo->getBasePackageVersion(baseName);
newRelease = pkgrepo->getBasePackageRelease(baseName);
if ( ( i->second.version == newVersion ) && ( i->second.release == newRelease) ) {
continue;
} else {
sprintf(sRelease,"%d",i->second.release);
sRelease = itos(i->second.release);
DV.installed = i->second.version + "-" + sRelease;
sprintf(sRelease,"%d",newRelease);
sRelease = itos(newRelease);
DV.available = newVersion + "-" + sRelease;
result.push_back(pair<string, DiffVers> (i->first, DV));
if (i->first.length() > widthPackageName)
Expand Down
27 changes: 16 additions & 11 deletions src/cards_install.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,23 @@ CardsInstall::CardsInstall(const CardsArgumentParser& argParser)
}
}
for(std::vector<std::string>::const_iterator it = m_argParser.otherArguments().begin(); it != m_argParser.otherArguments().end();it++) {
m_packageName = *it ;
// Generate the dependencies
generateDependencies();
if ( ( m_pkgrepo->getListOfPackagesFromCollection(*it).size() > 0 ) &&
( ! m_pkgrepo->checkBinaryExist(*it)) ) {
set<string> ListOfPackage = m_pkgrepo->getListOfPackagesFromCollection(*it);
for(std::set<std::string>::iterator jt = ListOfPackage.begin();jt != ListOfPackage.end();jt++) {
m_packageName = *jt;
generateDependencies();
}
} else {
m_packageName = *it ;
generateDependencies();
}
}
// Add the locales if any defined
getLocalePackagesList();
addPackagesList();

} else if ( ( m_pkgrepo->getListOfPackagesFromCollection(m_argParser.otherArguments()[0]).size() > 0 ) &&
( ! m_pkgrepo->checkBinaryExist( m_argParser.otherArguments()[0] )) ) {
Pkgrepo::parseConfig("/etc/cards.conf", m_config);
// Get the list of installed packages
getListOfPackageNames(m_root);

Expand All @@ -73,17 +80,15 @@ CardsInstall::CardsInstall(const CardsArgumentParser& argParser)
set<string> ListOfPackage = m_pkgrepo->getListOfPackagesFromCollection(m_argParser.otherArguments()[0]);
for(std::set<std::string>::iterator it = ListOfPackage.begin();it != ListOfPackage.end();it++) {
m_packageName = *it;
// Generate the dependencies
generateDependencies();
}
// Add the locales if any defined
getLocalePackagesList();
addPackagesList();
#ifndef NDEBUG
for (std::vector<string>::iterator j = m_dependenciesList.begin(); j != m_dependenciesList.end();j++) {
cout << *j << endl;
}
for (std::vector<string>::iterator j = m_dependenciesList.begin(); j != m_dependenciesList.end();j++) {
cerr << *j << endl;
}
#endif
addPackagesList();
} else {
//TODO get rid of thoses useless arguments
run(0, NULL);
Expand Down

0 comments on commit 0505e69

Please sign in to comment.