aboutsummaryrefslogtreecommitdiffstats
path: root/grpmi
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2004-01-21 10:33:04 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2004-01-21 10:33:04 +0000
commit3b945cc83e7babef2b9e69b2bd75568855f154c6 (patch)
treea7027aac851d5c613cb564a6ffc7c3dcc34b6d84 /grpmi
parent22ac49fd6bed6d19eab68e73a289a43589ca487d (diff)
downloadrpmdrake-3b945cc83e7babef2b9e69b2bd75568855f154c6.tar
rpmdrake-3b945cc83e7babef2b9e69b2bd75568855f154c6.tar.gz
rpmdrake-3b945cc83e7babef2b9e69b2bd75568855f154c6.tar.bz2
rpmdrake-3b945cc83e7babef2b9e69b2bd75568855f154c6.tar.xz
rpmdrake-3b945cc83e7babef2b9e69b2bd75568855f154c6.zip
remove unneeded stuff anymore
Diffstat (limited to 'grpmi')
-rwxr-xr-xgrpmi/grpmi.pl219
-rw-r--r--grpmi/rpm/Makefile13
-rw-r--r--grpmi/rpm/Makefile.PL52
-rw-r--r--grpmi/rpm/grpmi_rpm.pm14
-rw-r--r--grpmi/rpm/grpmi_rpm.xs405
5 files changed, 0 insertions, 703 deletions
diff --git a/grpmi/grpmi.pl b/grpmi/grpmi.pl
deleted file mode 100755
index d72a4615..00000000
--- a/grpmi/grpmi.pl
+++ /dev/null
@@ -1,219 +0,0 @@
-#!/usr/bin/perl
-#*****************************************************************************
-#
-# Copyright (c) 2002 Guillaume Cottenceau (gc at mandrakesoft dot com)
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2, as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-#*****************************************************************************
-
-use strict;
-use MDK::Common;
-
-use curl_download;
-use grpmi_rpm;
-
-use lib qw(/usr/lib/libDrakX);
-use ugtk2 qw(:all);
-$::isStandalone = 1;
-
-@ARGV or die "usage: ", basename($0), " [--no-verify-rpm] <[-noupgrade] PACKAGE>...\n";
-
-c::bind_textdomain_codeset('grpmi', 'UTF8');
-sub translate {
- my ($s) = @_;
- my $r = $s ? c::dgettext('grpmi', $s) : '';
- c::set_tagged_utf8($r);
- $r;
-}
-sub sprintf_fixutf8 {
- my $need_upgrade;
- $need_upgrade |= to_bool(c::is_tagged_utf8($_)) + 1 foreach @_;
- if ($need_upgrade == 3) { c::upgrade_utf8($_) foreach @_ };
- sprintf shift, @_;
-}
-sub N {
- my $s = shift @_; my $t = translate($s);
- sprintf_fixutf8 $t, @_;
-}
-sub utf8ize { c::set_tagged_utf8($_[0]); $_[0] }
-sub mexit { ugtk2::exit(undef, @_) }
-
-sub interactive_msg {
- my ($title, $contents, $yesno) = @_;
- my $d = ugtk2->new($title);
- my $lines; $lines++ while $contents =~ /\n/g;
- my $l = Gtk2::Label->new($contents);
- gtkadd($d->{window},
- gtkpack_(Gtk2::VBox->new(0,5),
- 1, $lines > 20 ? gtkset_size_request(create_scrolled_window($l), 300, 300) : $l,
- 0, gtkpack(create_hbox(),
- ref($yesno) eq 'ARRAY' ? map {
- my $label = $_;
- gtksignal_connect(Gtk2::Button->new($label), clicked => sub { $d->{retval} = $label; Gtk2->main_quit })
- } @$yesno
- : $yesno ? (gtksignal_connect(Gtk2::Button->new(N("Yes")), clicked => sub { $d->{retval} = 1; Gtk2->main_quit }),
- gtksignal_connect(Gtk2::Button->new(N("No")), clicked => sub { $d->{retval} = 0; Gtk2->main_quit }))
- : gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { Gtk2->main_quit })
- )));
- $l->set_justify('left');
- $d->main;
- return $d->{retval};
-}
-
-$> and interactive_msg(N("Error..."),
- N("You need to be root to install packages, sorry.")), mexit -1;
-
-grpmi_rpm::init_rcstuff() and interactive_msg(N("RPM initialization error"),
- N("The initialization of config files of RPM was not possible, sorry.")), mexit -1;
-
-$ENV{HOME} ||= '/root';
-my @grpmi_config = map { chomp_($_) } cat_("$ENV{HOME}/.grpmi");
-
-my $mainw = ugtk2->new('grpmi');
-my $label = Gtk2::Label->new(N("Initializing..."));
-my $progressbar = gtkset_size_request(Gtk2::ProgressBar->new, 400, 0);
-gtkadd($mainw->{window}, gtkpack(gtkadd(create_vbox(), $label, $progressbar)));
-$mainw->{rwindow}->set_position('center');
-$mainw->sync;
-
-my $exitstatus = -1;
-my $forced_exitstatus;
-
-
-# -=-=-=---=-=-=---=-=-=-- download potential URL's, and verify signatures -=-=-=---=-=-=--
-
-my $cache_location = '/var/cache/urpmi/rpms';
-my $url_regexp = '^http://|^https://|^ftp://';
-my $nb_downloads = int(grep { m,$url_regexp, } @ARGV);
-my $download_progress;
-
-foreach my $arg (@ARGV) {
- if ($arg =~ m,$url_regexp,) {
- $download_progress++;
- my $url = $arg;
- $arg = "$cache_location/" . basename($url);
- retry_download:
- $label->set(N("Downloading package `%s' (%s/%s)...", basename($url), $download_progress, $nb_downloads));
- select(undef, undef, undef, 0.1); $mainw->flush; #- hackish :-(
- my $res = utf8ize(curl_download::download($url, $cache_location,
- sub { $_[0] and $progressbar->set_fraction($_[1]/$_[0]); $mainw->flush }));
- if ($res) {
- my $results = interactive_msg(N("Error during download"),
-N("There was an error downloading package:
-
-%s
-
-Error: %s
-Do you want to continue (skipping this package)?", $url, $res),
- [ N("Yes"), N("No"), N("Retry download") ]);
- $results eq N("No") and goto cleanup;
- $results eq N("Retry download") and goto retry_download;
- $arg = "-skipped&$arg&";
- }
- }
-
-}
-
-
-# -=-=-=---=-=-=---=-=-=-- verify signatures -=-=-=---=-=-=--
-
-if (!member('--no-verify-rpm', @ARGV)) {
- my $yes_to_all;
- foreach my $arg (@ARGV) {
- if ($arg !~ /^-/) {
- if (-f $arg) {
- $yes_to_all and next;
- $label->set(N("Verifying signature of `%s'...", basename($arg))); $mainw->flush;
- if (my $res = utf8ize(grpmi_rpm::verify_sig($arg))) {
- my $results = interactive_msg(N("Signature verification error"),
-N("The signature of the package `%s' is not correct:
-
-%s
-Do you want to install it anyway?",
- basename($arg), $res),
- [ N("Yes"), N("Yes to all"), N("No") ]);
- $results eq N("No") and $arg = "-skipped&$arg&";
- $results eq N("Yes to all") and $yes_to_all = 1;
- }
- } else {
- interactive_msg(N("File error"),
-N("The following file is not valid:
-
-%s
-
-Do you want to continue anyway (skipping this package)?",
- $arg), 1) or goto cleanup;
- $arg = "-skipped&$arg&";
- }
- }
- }
-}
-
-
-# -=-=-=---=-=-=---=-=-=-- install packages -=-=-=---=-=-=---=-=-=-
-
-if (grep { /^[^-]/ } @ARGV) {
- $label->set(N("Preparing packages for installation...")); $mainw->flush;
- my $nb_installs = int(grep { /^[^-]/ } @ARGV);
- my $install_progress;
-
- sub install_packages_callback {
- my ($msg) = @_;
- my $retval;
- my %actions = ( 'conflicts' => sub {
- interactive_msg(N("Conflicts detected"),
-N("Conflicts were detected:
-%s
-
-Install aborted.",
- utf8ize(join("\n", split(/\|/, $1)))));
- $forced_exitstatus = -1;
- return 1;
- },
- 'inst-start' => sub { $install_progress++;
- $label->set(N("Installing package `%s' (%s/%s)...", $1, $install_progress, $nb_installs));
- $mainw->flush },
- 'inst-progress' => sub {
- $1 =~ /(\d+) (\d+)/;
- $progressbar->set_fraction($1/$2); $mainw->flush
- },
- );
- $msg =~ /^$_ (.*)/ and return &{$actions{$_}} foreach keys %actions;
- print STDERR "unknown msg:<$msg>\n";
- return 0;
- }
-
- my $res = chomp_(utf8ize(grpmi_rpm::install_packages(\&install_packages_callback, @ARGV)));
- if ($res) {
- interactive_msg(N("Problems occurred during installation"), N("There was an error during packages installation:\n\n%s", $res));
- goto cleanup;
- }
-}
-
-# -=-=-=---=-=-=---=-=-=-- cleanup -=-=-=---=-=-=--
-$exitstatus = 0;
-cleanup:
-if (!member('noclearcache', @grpmi_config)) {
- my @toclean = map { s/^-skipped&([^&]+)&$/$1/; if_(/^\Q$cache_location/, $_) } @ARGV;
- if (@toclean && ($forced_exitstatus || $exitstatus)) {
- interactive_msg(N("Cleanup"),
-N("Cleanup question: there was an error during installation, do you want to
-remove the %d downloaded package(s)?
-(they are located in %s)", scalar(@toclean), $cache_location), 1) or goto exiting;
- }
- unlink @toclean;
-}
-exiting:
-mexit($forced_exitstatus || $exitstatus);
diff --git a/grpmi/rpm/Makefile b/grpmi/rpm/Makefile
deleted file mode 100644
index 3bf1b972..00000000
--- a/grpmi/rpm/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-.PHONY: clean
-
-grpmi_rpm: %: %.xs
- test -e Makefile_c || perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS)
- $(MAKE) -f Makefile_c
-
-install:
- test -e Makefile_c || perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS)
- $(MAKE) -f Makefile_c install
-
-clean:
- test ! -e Makefile_c || $(MAKE) -f Makefile_c clean
- rm -f *~ *.o
diff --git a/grpmi/rpm/Makefile.PL b/grpmi/rpm/Makefile.PL
deleted file mode 100644
index b5022502..00000000
--- a/grpmi/rpm/Makefile.PL
+++ /dev/null
@@ -1,52 +0,0 @@
-use ExtUtils::MakeMaker;
-use Config;
-
-my $rpm_cflags = '-I/usr/include/rpm';
-my $rpm_libs = '-lrpm -lrpmdb -lrpmio -lpopt';
-
-ccompile('#include <rpm/rpmlib.h>
- #include <rpm/misc.h>
- ',
- 'rpmdb db;',
- $rpm_cflags,
- $rpm_libs)
- or
- die_('rpm devel environment is needed');
-
-
-WriteMakefile(
- 'NAME' => 'grpmi_rpm',
- 'LIBS' => [ $rpm_libs ],
- 'VERSION_FROM' => 'grpmi_rpm.pm', # finds VERSION
- 'OBJECT' => 'grpmi_rpm.o',
- 'INC' => $rpm_cflags,
- 'OPTIMIZE' => '-O2 -Wall -Werror -g',
- 'MAKEFILE' => 'Makefile_c',
-);
-
-
-
-
-# Taken from Makefile.PL from Gtk-Perl
-sub ccompile {
- my ($headers, $main, $cflags, $libs) = @_;
- my $fname = "temctest";
- my $r;
- chomp($cflags, $libs);
- open(CTEST, ">$fname.c") || return 0;
- print CTEST <<"EOTEST";
-$headers
-
-int main (int argc, char* argv[]) {
-$main;
-}
-EOTEST
- close(CTEST);
- $r = system("$Config{cc} -o $fname $fname.c $cflags $libs 2>/dev/null 1>/dev/null");
- warn("RUNNING: $Config{cc} -o $fname $fname.c $cflags $libs\n") if $ENV{VERBOSE};
- unlink($fname, "$fname.c");
- return $r == 0;
-}
-
-sub chomp_ { my @l = map { my $l = $_; chomp $l; $l } @_; wantarray ? @l : $l[0] }
-sub die_ { die "\n **ERROR**: @_\n\n" }
diff --git a/grpmi/rpm/grpmi_rpm.pm b/grpmi/rpm/grpmi_rpm.pm
deleted file mode 100644
index 91d15a6b..00000000
--- a/grpmi/rpm/grpmi_rpm.pm
+++ /dev/null
@@ -1,14 +0,0 @@
-package grpmi_rpm;
-
-use strict;
-use vars qw($VERSION @ISA);
-
-require DynaLoader;
-
-@ISA = qw(DynaLoader);
-$VERSION = '1.0';
-
-bootstrap grpmi_rpm $VERSION;
-
-1;
-
diff --git a/grpmi/rpm/grpmi_rpm.xs b/grpmi/rpm/grpmi_rpm.xs
deleted file mode 100644
index 72b4de28..00000000
--- a/grpmi/rpm/grpmi_rpm.xs
+++ /dev/null
@@ -1,405 +0,0 @@
-/* -*- c -*-
- *
- * Copyright (c) 2002 Guillaume Cottenceau (gc at mandrakesoft dot com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- ******************************************************************************/
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <langinfo.h>
-#include <iconv.h>
-
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-
-#undef Fflush
-#undef Mkdir
-#undef Stat
-#include <rpm/rpmlib.h>
-#include <rpm/misc.h>
-
-#include <libintl.h>
-#undef _
-#define _(arg) dgettext("grpmi", arg)
-
-#define streq !strcmp
-
-char * my_asprintf(char *msg, ...)
-{
- char * out;
- va_list args;
- va_start(args, msg);
- if (vasprintf(&out, msg, args) == -1)
- out = "";
- va_end(args);
- return out;
-}
-
-
-char * init_rcstuff_(void)
-{
- char * rpmrc;
-
- rpmrc = getenv("RPMRC_FILE");
- if (rpmrc && !*rpmrc)
- rpmrc = NULL;
- if (rpmReadConfigFiles(rpmrc, NULL))
- return _("Couldn't read RPM config files");
-
- return "";
-}
-
-
-/* bad bad bad.. duplicated code from gi/perl-install/c/stuff.xs */
-char* std_to_utf8(char* s)
-{
- iconv_t cd = iconv_open("UTF-8", nl_langinfo(CODESET));
- char* retval = s;
- if (cd != (iconv_t) (-1)) {
- size_t s_len = strlen(retval);
- /* the maximum expansion when converting happens when converting
- tscii to utf-8; each tscii char can become up to 4 unicode chars
- and each one of those unicode chars can be 3 bytes long */
- char *buf = alloca(4 * 3 * s_len);
- {
- char *ptr = buf;
- size_t ptr_len = 4 * 3 * s_len;
- if ((iconv(cd, &s, &s_len, &ptr, &ptr_len)) != (size_t) (-1)) {
- *ptr = 0;
- retval = buf;
- }
- }
- iconv_close(cd);
- }
- return strdup(retval);
-}
-
-/* these are in rpmlib but not in rpmlib.h */
-int readLead(FD_t fd, struct rpmlead *lead);
-int rpmReadSignature(FD_t fd, Header *header, short sig_type);
-
-char * verify_sig_(char * file)
-{
- struct rpmlead lead;
- Header sig;
- HeaderIterator sigIter;
- const void *ptr;
- int_32 tag, type, count;
- char result[8*BUFSIZ];
- FD_t fd, ofd;
- int i;
- const char *tmpfile = NULL;
- unsigned char buffer[8192];
- int gpg_sig = 0;
-
- fd = fdOpen(file, O_RDONLY, 0);
- if (fdFileno(fd) < 0) {
- return _("Couldn't open file\n");
- }
- memset(&lead, 0, sizeof(lead));
- if (readLead(fd, &lead)) {
- return _("Could not read lead bytes\n");
- }
- if (lead.major == 1) {
- return _("RPM version of package doesn't support signatures\n");
- }
-
- i = rpmReadSignature(fd, &sig, lead.signature_type);
- if (i != RPMRC_OK && i != RPMRC_BADSIZE) {
- return _("Could not read signature block (`rpmReadSignature' failed)\n");
- }
- if (!sig) {
- return _("No signatures\n");
- }
-
- if (makeTempFile(NULL, &tmpfile, &ofd))
- return _("`makeTempFile' failed!\n");
-
- while ((i = fdRead(fd, buffer, sizeof(buffer))) != 0) {
- if (i == -1) {
- fdClose(ofd);
- fdClose(fd);
- unlink(tmpfile);
- return _("Error reading file\n");
- }
- if (fdWrite(ofd, buffer, i) < 0) {
- fdClose(ofd);
- fdClose(fd);
- unlink(tmpfile);
- return _("Error writing temp file\n");
- }
- }
- fdClose(fd);
- fdClose(ofd);
-
- for (sigIter = headerInitIterator(sig); headerNextIterator(sigIter, &tag, &type, &ptr, &count); ptr = headerFreeData(ptr, type)) {
- switch (tag) {
- case RPMSIGTAG_PGP5: case RPMSIGTAG_PGP: case RPMSIGTAG_GPG:
- gpg_sig = 1;
- case RPMSIGTAG_LEMD5_2: case RPMSIGTAG_LEMD5_1: case RPMSIGTAG_MD5:
- case RPMSIGTAG_SIZE:
- break;
- default:
- continue;
- }
-
- i = rpmVerifySignature(tmpfile, tag, ptr, count, result);
- if (i != RPMSIG_OK) {
- unlink(tmpfile);
- return std_to_utf8(result);
- }
- }
- unlink(tmpfile);
- if (!gpg_sig)
- return _("No GPG signature in package\n");
- else
- return "";
-}
-
-
-void rpmError_callback_empty(void) {}
-
-int rpmError_callback_data;
-void rpmError_callback(void) {
- if (rpmErrorCode() != RPMERR_UNLINK && rpmErrorCode() != RPMERR_RMDIR) {
- write(rpmError_callback_data, rpmErrorString(), strlen(rpmErrorString()));
- }
-}
-
-SV * install_packages_callback_data = NULL;
-int install_packages_callback(char * msg, ...) __attribute__ ((format (printf, 1, 2)));
-int install_packages_callback(char * msg, ...)
-{
- int i;
- char * out;
- dSP;
-
- va_list args;
- va_start(args, msg);
- if (vasprintf(&out, msg, args) == -1)
- out = "";
- va_end(args);
-
- if (!SvROK(install_packages_callback_data))
- return 0;
- ENTER;
- SAVETMPS;
- PUSHMARK(SP);
- XPUSHs(sv_2mortal(newSVpv(out, 0)));
- PUTBACK;
- free(out);
- i = call_sv(install_packages_callback_data, G_SCALAR);
- SPAGAIN;
- if (i != 1)
- croak("Big trouble\n");
- else
- i = POPi;
- PUTBACK;
- FREETMPS;
- LEAVE;
- return i;
-}
-
-char * install_packages_(char ** packages)
-{
- void * rpmRunTransactions_callback(const void * h, const rpmCallbackType what, const unsigned long amount, const unsigned long total, const void * pkgKey, void * data) {
- static FD_t fd;
-
- switch (what) {
- case RPMCALLBACK_INST_OPEN_FILE:
- return fd = fdOpen(pkgKey, O_RDONLY, 0);
- case RPMCALLBACK_INST_CLOSE_FILE:
- fdClose(fd);
- break;
- case RPMCALLBACK_INST_START:
- install_packages_callback("inst-start %s", basename(pkgKey));
- break;
- case RPMCALLBACK_INST_PROGRESS:
- install_packages_callback("inst-progress %ld %ld", amount, total);
- break;
- default:
- break;
- }
- return NULL;
- }
- char * returnmsg;
- rpmdb db;
- rpmTransactionSet rpmdep;
- rpmDependencyConflict conflicts;
- int num_conflicts;
- rpmProblemSet probs = NULL;
- char ** pkg;
- int noupgrade = 0;
-
- if (rpmdbOpen("", &db, O_RDWR, 0644)) {
- if (rpmErrorCode() == RPMERR_DBOPEN)
- return _("Couldn't open RPM DB for writing (not superuser?)");
- else
- return _("Couldn't open RPM DB for writing");
- }
-
- if (!(rpmdep = rpmtransCreateSet(db, NULL))) {
- returnmsg = _("Couldn't start transaction");
- goto install_packages_cleanup;
- }
-
- for (pkg = packages; pkg && *pkg; pkg++) {
- if (streq(*pkg, "-noupgrade"))
- noupgrade = 1;
- else {
- Header h;
- int isSource, major;
- char *file = *pkg;
- char *LocalName = basename(file);
- FD_t fd;
-
- if (file[0] == '-')
- continue;
-
- fd = fdOpen(file, O_RDONLY, 0);
- if (fdFileno(fd) < 0) {
- returnmsg = my_asprintf(_("Can't open package `%s'\n"), LocalName);
- goto install_packages_cleanup;
- }
- switch (rpmReadPackageHeader(fd, &h, &isSource, &major, NULL)) {
- case 1:
- returnmsg = my_asprintf(_("Package `%s' is corrupted\n"), LocalName);
- goto install_packages_cleanup;
- default:
- returnmsg = my_asprintf(_("Package `%s' can't be installed\n"), LocalName);
- goto install_packages_cleanup;
- case 0:
- rpmtransAddPackage(rpmdep, h, NULL, file, !noupgrade, NULL);
- }
- fdClose(fd);
- noupgrade = 0;
- }
- }
-
- if (rpmdepCheck(rpmdep, &conflicts, &num_conflicts)) {
- returnmsg = _("Error while checking dependencies");
- goto install_packages_cleanup;
- }
- if (conflicts) {
- int i;
- char * conflict_msg = strdup("conflicts ");
- for (i=0; i<num_conflicts; i++) {
- char * msg1, * msg2;
- char sense = '\0';
- if (conflicts[i].needsFlags & RPMSENSE_SENSEMASK) {
- if (conflicts[i].needsFlags & RPMSENSE_LESS) sense = '<';
- if (conflicts[i].needsFlags & RPMSENSE_GREATER) sense = '>';
- if (conflicts[i].needsFlags & RPMSENSE_EQUAL) sense = '=';
- if (conflicts[i].needsFlags & RPMSENSE_SERIAL) sense = 'S';
- }
- if (sense != '\0')
- msg1 = my_asprintf("%s %c %s", conflicts[i].needsName, sense, conflicts[i].needsVersion);
- else
- msg1 = strdup(conflicts[i].needsName);
- msg2 = my_asprintf("%s %s %s-%s-%s",
- msg1,
- (conflicts[i].sense == RPMDEP_SENSE_REQUIRES) ? _("is needed by") : _("conflicts with"),
- conflicts[i].byName, conflicts[i].byVersion, conflicts[i].byRelease);
- free(msg1);
- msg1 = my_asprintf("%s|%s", conflict_msg, msg2);
- free(msg2);
- free(conflict_msg);
- conflict_msg = msg1;
- }
- if (install_packages_callback(conflict_msg)) {
- free(conflict_msg);
- returnmsg = "";
- goto install_packages_cleanup;
- }
- free(conflict_msg);
- rpmdepFreeConflicts(conflicts, num_conflicts);
- }
-
- if (rpmdepOrder(rpmdep)) {
- returnmsg = _("Error while checking dependencies 2");
- goto install_packages_cleanup;
- }
- if (rpmRunTransactions(rpmdep, rpmRunTransactions_callback, NULL, NULL, &probs, 0, 0)) {
- char * msg;
- int i;
- returnmsg = strdup(_("Problems occurred during installation:\n"));
- for (i = 0; i < probs->numProblems; i++) {
- const char * thispb = rpmProblemString(&(probs->probs[i]));
- msg = my_asprintf("%s%s\n", returnmsg, thispb);
- free(returnmsg);
- returnmsg = msg;
- }
- goto install_packages_cleanup;
- }
-
- rpmdbClose(db);
- return "";
-
- install_packages_cleanup:
- rpmdbClose(db);
- return returnmsg;
-}
-
-
-/************************** Gateway to Perl ****************************/
-
-MODULE = grpmi_rpm PACKAGE = grpmi_rpm
-PROTOTYPES : DISABLE
-
-char *
-init_rcstuff()
- CODE:
- RETVAL = init_rcstuff_();
- OUTPUT:
- RETVAL
-
-char *
-verify_sig(pkg)
-char * pkg
- CODE:
- RETVAL = verify_sig_(pkg);
- OUTPUT:
- RETVAL
-
-char *
-install_packages(callback, ...)
-SV * callback
- PREINIT:
- int i;
- char ** pkgs;
- CODE:
- install_packages_callback_data = callback;
- pkgs = malloc(sizeof(char *) * items);
- for (i=1; i<items; i++)
- pkgs[i-1] = SvPV_nolen(ST(i));
- pkgs[items-1] = NULL;
- RETVAL = install_packages_(pkgs);
- free(pkgs);
- callback = NULL;
- OUTPUT:
- RETVAL
-