From: Michael Andres Date: Wed, 21 Dec 2011 09:44:43 +0000 (+0100) Subject: New subpackage zypper-aptitude X-Git-Tag: 1.7.0~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9292ece273d0cec5b31d0bea232df0701a938511;p=platform%2Fupstream%2Fzypper.git New subpackage zypper-aptitude --- diff --git a/CMakeLists.txt b/CMakeLists.txt index d334fe8..88a145a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,3 +85,8 @@ INSTALL( DESTINATION ${INSTALL_PREFIX}/sbin ) +# zypper-aptitude compat tool +INSTALL( + PROGRAMS tools/aptitude + DESTINATION ${INSTALL_PREFIX}/bin +) diff --git a/tools/aptitude b/tools/aptitude new file mode 100755 index 0000000..b6e3bc8 --- /dev/null +++ b/tools/aptitude @@ -0,0 +1,45 @@ +#!/usr/bin/perl -w +# version 0.8 +# by Bernhard M. Wiedemann +# License: GPL v2 or later + +use strict; +my @options=(); +foreach(@ARGV) { + last unless (m/^-/); + push(@options, $_); +} + +my @zopt; +my @zopt2; +foreach(@options) { + shift @ARGV; + if($_ eq "-s" || $_ eq "--simulate") {push @zopt2, "--dry-run"} + if($_ eq "-d" || $_ eq "--download-only") {push @zopt2, "--download-only"} + if($_ eq "-y" || $_ eq "--assume-yes") {push @zopt, "--non-interactive"} + if($_ eq "-q" || $_ eq "--quiet") {push @zopt, "--quiet"} + if($_ eq "-V" || $_ eq "-v" || $_ eq "--verbose") {push @zopt, "--verbose"} + if($_ eq "-u") {system("zypper", "refresh")} + if($_ eq "--without-recommends") {push @zopt2, "--no-recommends"} + if($_ eq "--with-recommends") {push @zopt, "--recommends"} +} + +my $action=shift; +if(!defined($action)) {exec "/sbin/yast2", "-i"} + +if($action eq "show") {$action="info"} +elsif($action eq "purge") {$action="remove"} +elsif($action eq "hold") {$action="addlock"} +elsif($action eq "unhold") {$action="removelock"} +elsif($action eq "update") {$action="refresh"} +elsif($action eq "upgrade" || $action eq "safe-upgrade") {$action="update"} +elsif($action eq "full-upgrade" || $action eq "dist-upgrade") {$action="dist-upgrade"} +elsif($action eq "download") {$action="install"; unshift(@zopt2, "--download-only");} +elsif($action eq "reinstall") {$action="install"; unshift(@zopt2, "--force");} +elsif($action eq "source") {$action="source-install"} +elsif($action=~m/build-dep(?:ends)?/) {$action="source-install"; unshift(@zopt2, "--build-deps-only");} +elsif($action eq "changelog") {exec qw"rpm -q --changelog", @ARGV} +elsif($action=~m/markauto|unmarkauto|forbid-version|autoclean|why|why-not/) { die "$action unavailabe?"} + +#system "echo", "zypper", @zopt, $action, @zopt2, @ARGV; +exec "zypper", @zopt, $action, @zopt2, @ARGV; diff --git a/zypper.spec.cmake b/zypper.spec.cmake index e50e6c6..782b6ce 100644 --- a/zypper.spec.cmake +++ b/zypper.spec.cmake @@ -75,6 +75,20 @@ Authors: -------- Dominik Heidler +%package aptitude +Summary: aptitude compatibility with zypper +License: GPLv2+ +Requires: perl +Supplements: zypper +BuildArch: noarch +Group: System/Packages +%description aptitude +provides aptitude compatibility using zypper + +Authors: +-------- + Bernhard M. Wiedemann + %prep %setup -q @@ -156,4 +170,8 @@ rm -rf "$RPM_BUILD_ROOT" %{_sbindir}/zypper-log %doc %{_mandir}/man8/zypper-log.8* +%files aptitude +%defattr(-,root,root) +%{_bindir}/aptitude + %changelog