aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2000-03-10 13:44:15 +0000
committerPascal Rigaux <pixel@mandriva.com>2000-03-10 13:44:15 +0000
commitdc461c3791a66866067e0d33683b70c21003a3ce (patch)
treee8669ff2a2cdb2766cd5bb853f135b529e29c699
parente491014054d64578775f539790da539b8294a42f (diff)
downloadrpmtools-dc461c3791a66866067e0d33683b70c21003a3ce.tar
rpmtools-dc461c3791a66866067e0d33683b70c21003a3ce.tar.gz
rpmtools-dc461c3791a66866067e0d33683b70c21003a3ce.tar.bz2
rpmtools-dc461c3791a66866067e0d33683b70c21003a3ce.tar.xz
rpmtools-dc461c3791a66866067e0d33683b70c21003a3ce.zip
no_comment
-rw-r--r--gendepslist2.cc64
-rw-r--r--rpmtools.spec3
2 files changed, 39 insertions, 28 deletions
diff --git a/gendepslist2.cc b/gendepslist2.cc
index faaf953..19277e5 100644
--- a/gendepslist2.cc
+++ b/gendepslist2.cc
@@ -12,7 +12,7 @@
#define COMPATIBILITY
-string put_first = "filesystem setup";
+string put_first = "setup filesystem";
/********************************************************************************/
@@ -140,8 +140,9 @@ vector<string> get_files(Header header) {
/********************************************************************************/
/* gendepslist ******************************************************************/
/********************************************************************************/
+int nb_hdlists;
vector<string> packages;
-map<string, int> sizes;
+map<string, int> sizes, which_hdlist;
map<string, string> name2fullname;
map<string, vector<string> > requires, frequires;
map<string, vector<string> > provided_by, fprovided_by;
@@ -166,7 +167,7 @@ void getRequires(FD_t fd) {
for (ITs p = all_frequires.begin(); p != all_frequires.end(); p++) fprovided_by[*p] = *(new vector<string>);
}
-void getProvides(FD_t fd) {
+void getProvides(FD_t fd, int current_hdlist) {
Header header;
while ((header=headerRead(fd, HEADER_MAGIC_YES)))
{
@@ -175,6 +176,7 @@ void getProvides(FD_t fd) {
packages.push_back(name);
name2fullname[s_name] = name;
+ which_hdlist[name] = current_hdlist;
sizes[name] = get_int(header, RPMTAG_SIZE);
if (in(s_name, provided_by)) provided_by[s_name].push_back(name);
@@ -248,6 +250,12 @@ map<string, set<string> > closure(const map<string, set<string> > &names) {
// }
//};
+inline int verif(const string &dep, int i, const string &package, int hdlist, map<string,int> &where) {
+ if (which_hdlist[dep] > hdlist)
+ cerr << package << " requires " << dep << " which is in hdlist " << which_hdlist[dep] << " > " << hdlist << "\n";
+ return where[dep];
+}
+
void printDepslist(ofstream *out1, ofstream *out2) {
map<string, set<string> > names;
@@ -266,7 +274,7 @@ void printDepslist(ofstream *out1, ofstream *out2) {
map<string,int> length;
for (ITms p = names.begin(); p != names.end(); p++) {
int l = p->second.size();
- for (ITs q = p->second.begin(); q != p->second.end(); q++) if (q->find('|') >= 0) l += 1000;
+ for (ITs q = p->second.begin(); q != p->second.end(); q++) if (q->find('|') != string::npos) l += 1000;
length[p->first] = l;
}
@@ -296,28 +304,29 @@ void printDepslist(ofstream *out1, ofstream *out2) {
map<string,int> where;
for (ITv p = packages.begin(); p != packages.end(); p++, i++) where[*p] = i;
- i = 0;
- for (ITv p = packages.begin(); p != packages.end(); p++, i++) {
- set<string> dep = closed[*p];
- *out2 << *p << " " << sizes[*p];
- for (ITs q = dep.begin(); q != dep.end(); q++) {
- if (q->find('|') >= 0) {
- vector<string> l = split('|', *q);
- for (ITv k = l.begin(); k != l.end(); k++) *out2 << " " << where[*k];
- } else if (q->compare("NOTFOUND_") > 1) {
- *out2 << " " << *q;
- } else {
- int j = where[*q];
- if (j > i) cerr << *p << "\n";
- *out2 << " " << j;
+ for (int hdlist = 0; hdlist < nb_hdlists; hdlist++) {
+ i = 0;
+ for (ITv p = packages.begin(); p != packages.end(); p++, i++)
+ if (which_hdlist[*p] == hdlist) {
+ set<string> dep = closed[*p];
+ *out2 << *p << " " << sizes[*p];
+ for (ITs q = dep.begin(); q != dep.end(); q++) {
+ if (q->find('|') != string::npos) {
+ vector<string> l = split('|', *q);
+ for (ITv k = l.begin(); k != l.end(); k++) *out2 << " " << verif(*k, i, *p, hdlist, where);
+ } else if (q->compare("NOTFOUND_") > 1) {
+ *out2 << " " << *q;
+ } else {
+ *out2 << " " << verif(*q, i, *p, hdlist, where);
+ }
+ }
+ *out2 << "\n";
}
- }
- *out2 << "\n";
}
}
-FD_t hdlists(const char *cmd) {
- return fdDup(fileno(popen(cmd, "r")));
+FD_t hdlists(const char *hdlist) {
+ return fdDup(fileno(popen(((string) "cat " + hdlist + " 2>/dev/null").c_str(), "r")));
}
int main(int argc, char **argv)
@@ -334,14 +343,15 @@ int main(int argc, char **argv)
cerr << "usage: gendepslist2 [-o <depslist>] hdlists_cz2...\n";
return 1;
}
- string cmd = "bzip2 -dc ";
- for (int i = 1; i < argc; i++) cmd = cmd + argv[i] + " ";
- cmd += "2>/dev/null";
- getRequires(hdlists(cmd.c_str()));
+ nb_hdlists = argc - 1;
+
+ for (int i = 1; i < argc; i++) getRequires(hdlists(argv[i]));
cerr << "getRequires done\n";
- getProvides(hdlists(cmd.c_str()));
+
+ for (int i = 1; i < argc; i++) getProvides(hdlists(argv[i]), i - 1);
cerr << "getProvides done\n";
+
printDepslist(out1, out2);
delete out1;
delete out2;
diff --git a/rpmtools.spec b/rpmtools.spec
index 8c77900..14f66a8 100644
--- a/rpmtools.spec
+++ b/rpmtools.spec
@@ -1,5 +1,5 @@
%define name rpmtools
-%define release 1mdk
+%define release 3mdk
# do not modify here, see Makefile in the CVS
%define version 1.1
@@ -53,6 +53,7 @@ rm -rf $RPM_BUILD_ROOT
%files devel
%defattr(-,root,root)
/usr/bin/hdlist2prereq
+/usr/bin/genhdlists
%changelog
* Tue Mar 7 2000 Pixel <pixel@mandrakesoft.com> 1.1-1mdk