-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set microdnf and tdnf as part of the minimal set, remove git-all for now
- Loading branch information
1 parent
2fd3f08
commit 8eccb36
Showing
11 changed files
with
282 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
AC_PREREQ(2.65) | ||
AC_INIT([sgug-rpm-tools], | ||
[0.1.5], | ||
[0.1.6], | ||
[[email protected]]) | ||
|
||
AC_SUBST(ACLOCAL_AMFLAGS, "-I macros") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include <dependencyset.hpp> | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <unordered_set> | ||
|
||
#include <algorithm> | ||
|
||
#include <iostream> | ||
|
||
using std::string; | ||
using std::vector; | ||
using std::unordered_set; | ||
|
||
namespace sgug_rpm | ||
{ | ||
void rpmds_read_deps( Header package_header, | ||
std::vector<std::string> & provides, | ||
std::vector<std::string> & requires ) { | ||
// Provides | ||
rpmds_h rpmds_prov( package_header, RPMTAG_PROVIDENAME, 0); | ||
unordered_set<string> prov_set; | ||
while( rpmds_prov.next() >= 0 ) { | ||
const char * DNEVR; | ||
if((DNEVR = rpmdsDNEVR(rpmds_prov.dependency_set)) != NULL) { | ||
string prov(DNEVR + 2); | ||
if( strncmp(prov.c_str(), "rpmlib(", 7) == 0 ) { | ||
continue; | ||
} | ||
if( prov_set.find(prov) != prov_set.end() ) { | ||
// cerr << "Warning: Dupe provide dep on package for " << | ||
// specfile.get_name() << ":" << pkg << ":" << | ||
// prov << endl; | ||
} | ||
else { | ||
prov_set.insert(prov); | ||
} | ||
} | ||
} | ||
for( const string & s : prov_set ) { | ||
provides.push_back(s); | ||
// std::cout << "Found provide: " << s << std::endl; | ||
} | ||
// Requires | ||
rpmds_h rpmds_req( package_header, RPMTAG_REQUIRENAME, 0); | ||
unordered_set<string> req_set; | ||
while( rpmds_req.next() >= 0 ) { | ||
const char * DNEVR; | ||
if((DNEVR = rpmdsDNEVR(rpmds_req.dependency_set)) != NULL) { | ||
string req(DNEVR + 2); | ||
if( strncmp(req.c_str(), "rpmlib(", 7) == 0 ) { | ||
continue; | ||
} | ||
if( req_set.find(req) != req_set.end() ) { | ||
// cerr << "Warning: Dupe require dep on package for " << | ||
// specfile.get_name() << ":" << pkg << ":" << | ||
// req << endl; | ||
} | ||
else { | ||
req_set.insert(req); | ||
} | ||
} | ||
} | ||
for( const string & s : req_set ) { | ||
requires.push_back(s); | ||
// std::cout << "Found require: " << s << std::endl; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
#include "helpers.hpp" | ||
#include "specfile.hpp" | ||
#include "installedrpm.hpp" | ||
#include "standalonerpm.hpp" | ||
#include "dependencyset.hpp" | ||
|
||
#include <iostream> | ||
#include <fstream> | ||
#include <sstream> | ||
#include <filesystem> | ||
#include <optional> | ||
|
||
#include <rpm/header.h> | ||
#include <rpm/rpmcli.h> | ||
#include <rpm/rpmdb.h> | ||
#include <rpm/rpmds.h> | ||
#include <rpm/rpmts.h> | ||
#include <rpm/rpmarchive.h> | ||
#include <rpm/rpmlog.h> | ||
|
||
// C++ structures/algorithms | ||
#include <algorithm> | ||
#include <unordered_map> | ||
#include <unordered_set> | ||
#include <vector> | ||
#include <functional> | ||
|
||
using std::string; | ||
using std::cout; | ||
using std::cerr; | ||
using std::cin; | ||
using std::endl; | ||
using std::ofstream; | ||
using std::stringstream; | ||
using std::vector; | ||
using std::unordered_map; | ||
using std::unordered_set; | ||
|
||
using std::optional; | ||
|
||
using std::filesystem::path; | ||
|
||
namespace fs = std::filesystem; | ||
|
||
static struct poptOption optionsTable[] = { | ||
{ | ||
NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0, | ||
"Common options for all rpm modes and executables", | ||
NULL }, | ||
POPT_AUTOALIAS | ||
POPT_AUTOHELP | ||
POPT_TABLEEND | ||
}; | ||
|
||
optional<string> calculate_expected_specfile_path( string sgug_rse_git_root, | ||
string package_name ) { | ||
path srgr_path = std::filesystem::path(sgug_rse_git_root); | ||
path package_spec_path = srgr_path / "packages" / package_name / "SPECS" / (package_name + ".spec"); | ||
if( fs::exists(package_spec_path) ) { | ||
return {fs::canonical(package_spec_path)}; | ||
} | ||
else { | ||
return {}; | ||
} | ||
} | ||
|
||
int main(int argc, char**argv) | ||
{ | ||
sgug_rpm::poptcontext_h popt_context( argc, argv, optionsTable ); | ||
rpmlogSetMask(RPMLOG_ERR); | ||
|
||
if( popt_context.context == NULL ) { | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
// Process the package passed on the command line | ||
vector<string> names_in; | ||
const char * extra_arg; | ||
while( (extra_arg = poptGetArg(popt_context.context)) != NULL ) { | ||
names_in.push_back(extra_arg); | ||
} | ||
|
||
if( names_in.size() == 0 ) { | ||
cerr << "No packages specified. Exiting." << endl; | ||
exit(EXIT_FAILURE); | ||
} | ||
|
||
bool verbose = popt_context.verbose; | ||
|
||
sgug_rpm::progress_printer pprinter; | ||
|
||
sgug_rpm::specfile specfile; | ||
for( const string & one_package : names_in ) { | ||
if( verbose ) { | ||
cout << "# Opening spec " << one_package << endl; | ||
} | ||
rpmSpecFlags flags = (RPMSPEC_FORCE); | ||
if( !sgug_rpm::read_specfile( one_package, | ||
flags, | ||
specfile, | ||
pprinter ) ) { | ||
cerr << "Unable to read specfile " << one_package << endl; | ||
exit(EXIT_FAILURE); | ||
} | ||
} | ||
|
||
cout << "PackageName: " << specfile.get_name() << endl; | ||
cout << "PackagePath: " << specfile.get_filepath() << endl; | ||
const vector<string> & packages = specfile.get_packages(); | ||
for( const string & sub_package : packages ) { | ||
cout << "OutputRPM: " << sub_package << endl; | ||
} | ||
const unordered_map<string,vector<string>> & build_deps = | ||
specfile.get_build_deps(); | ||
for( auto & entry : build_deps ) { | ||
if( verbose ) { | ||
cout << "# Examining entry " << entry.first << endl; | ||
} | ||
const vector<string> & entry_deps = entry.second; | ||
for( const string & builddep_package : entry_deps ) { | ||
cout << "BuildDep: " << builddep_package << endl; | ||
} | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.