Skip to content

Commit 99040bc

Browse files
committed
spit out a missing deps files too, useful when recalculating new world builds.
1 parent 8eccb36 commit 99040bc

File tree

5 files changed

+30
-9
lines changed

5 files changed

+30
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ worldrebuilder.sh
4141
src/sgug-rpm-tools/sgug_minimal_computer
4242
leaveinstalled.txt
4343
removeexisting.sh
44+
missingdeps.txt

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AC_PREREQ(2.65)
22
AC_INIT([sgug-rpm-tools],
3-
[0.1.6],
3+
[0.1.7],
44
55

66
AC_SUBST(ACLOCAL_AMFLAGS, "-I macros")

src/sgug-rpm-tools/sgug_dep_engine.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
#include <utility>
1212

1313
#include <iostream>
14+
#include <sstream>
1415

1516
using std::function;
1617
using std::optional;
1718
using std::pair;
1819
using std::reference_wrapper;
1920
using std::stack;
2021
using std::string;
22+
using std::stringstream;
2123
using std::unordered_map;
2224
using std::unordered_set;
2325
using std::vector;
@@ -27,7 +29,9 @@ using std::cout;
2729

2830
namespace sgug_rpm {
2931

30-
static optional<uint32_t> recursive_flatten_deps( resolvedrpm & driving_pkg,
32+
static optional<uint32_t> recursive_flatten_deps(
33+
vector<string> & missing_deps_out,
34+
resolvedrpm & driving_pkg,
3135
vector<resolvedrpm> & known_packages,
3236
unordered_map<string,std::reference_wrapper<resolvedrpm> > & pid_to_package,
3337
unordered_map<string,std::reference_wrapper<resolvedrpm> > & provides_to_package,
@@ -117,9 +121,9 @@ namespace sgug_rpm {
117121
}
118122

119123
if( !provider_ref_opt ) {
120-
cout << "Package " << pkg_name << " has missing requires: " << pkg_require <<
121-
endl;
122-
// exit(-1);
124+
stringstream missing_deps_buf;
125+
missing_deps_buf << "Package " << pkg_name << " has missing requires: " << pkg_require;
126+
missing_deps_out.push_back(missing_deps_buf.str());
123127
continue;
124128
}
125129

@@ -137,7 +141,8 @@ namespace sgug_rpm {
137141
// cout << "It is " << child_pkg.get_package().get_name() << endl;
138142

139143
optional<uint32_t> child_sequence_no_opt =
140-
recursive_flatten_deps( driving_pkg,
144+
recursive_flatten_deps( missing_deps_out,
145+
driving_pkg,
141146
known_packages,
142147
pid_to_package,
143148
provides_to_package,
@@ -175,6 +180,7 @@ namespace sgug_rpm {
175180

176181
vector<resolvedrpm> flatten_sort_packages( vector<installedrpm> & rpms_to_resolve,
177182
const function<bool (const string&)> & special_strategy,
183+
vector<string> & missing_deps_out,
178184
progress_printer & pprinter )
179185
{
180186
vector<resolvedrpm> retval;
@@ -204,7 +210,8 @@ namespace sgug_rpm {
204210
if( special_strategy(pkg_name) ) {
205211
vector<string> pkg_resolution_stack;
206212
// cout << "do erfp on " << pkg.get_package().get_name() << endl;
207-
recursive_flatten_deps( pkg,
213+
recursive_flatten_deps( missing_deps_out,
214+
pkg,
208215
retval,
209216
pid_to_package,
210217
provides_to_package,
@@ -223,7 +230,8 @@ namespace sgug_rpm {
223230
for( resolvedrpm & pkg : retval ) {
224231
vector<string> pkg_resolution_stack;
225232
// cout << "do erfp on " << pkg.get_package().get_name() << endl;
226-
recursive_flatten_deps( pkg,
233+
recursive_flatten_deps( missing_deps_out,
234+
pkg,
227235
retval,
228236
pid_to_package,
229237
provides_to_package,

src/sgug-rpm-tools/sgug_dep_engine.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ namespace sgug_rpm {
3333

3434
std::vector<resolvedrpm> flatten_sort_packages( std::vector<installedrpm> & rpms_to_resolve,
3535
const std::function<bool (const std::string&)> & special_strategy,
36+
std::vector<std::string> & missing_deps_out,
3637
progress_printer & pprinter );
3738
}
3839

src/sgug-rpm-tools/sgug_minimal_computer.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,14 @@ int main(int argc, char**argv)
220220
special_packages.emplace("xz");
221221
special_packages.emplace("unzip");
222222
/*special_packages.emplace("sgugshell");*/
223+
special_packages.emplace("dnf-data");
223224
special_packages.emplace("microdnf");
224225
special_packages.emplace("tdnf");
225226
/*special_packages.emplace("git-all");*/
226227
/*special_packages.emplace("sgug-getopt");*/
227228

229+
vector<string> missing_deps;
230+
228231
vector<sgug_rpm::resolvedrpm> resolved_rpms =
229232
sgug_rpm::flatten_sort_packages( rpms_to_resolve,
230233
[&](const string & pkg_name) -> bool {
@@ -236,6 +239,7 @@ int main(int argc, char**argv)
236239
return false;
237240
}
238241
},
242+
missing_deps,
239243
pprinter );
240244

241245
if( verbose ) {
@@ -259,9 +263,15 @@ int main(int argc, char**argv)
259263
}
260264
}
261265

262-
cout << "Writing leaveinstalled.txt and removeexisting.sh results." <<
266+
cout << "Writing output files..." <<
263267
endl;
264268

269+
ofstream missingdepsfile;
270+
missingdepsfile.open("missingdeps.txt");
271+
for( auto & md : missing_deps ) {
272+
missingdepsfile << md << endl;
273+
}
274+
265275
ofstream leaveinstalledfile;
266276
leaveinstalledfile.open("leaveinstalled.txt");
267277

@@ -308,6 +318,7 @@ int main(int argc, char**argv)
308318

309319
removeexistingfile.close();
310320
leaveinstalledfile.close();
321+
missingdepsfile.close();
311322

312323
return 0;
313324
}

0 commit comments

Comments
 (0)