Mailinglist Archive: zypp-commit (233 mails)

< Previous Next >
[zypp-commit] <libzypp> ma-misc : backup
  • From: Michael Andres <ma@xxxxxxx>
  • Date: Tue, 3 Nov 2009 02:39:25 +0100
  • Message-id: <E1N58NV-0001wg-LX@xxxxxxxxxxxxxxxx>
ref: refs/heads/ma-misc
commit 97d6a25210c4dac826c19b55eeec6aee60470deb
Author: Michael Andres <ma@xxxxxxx>
Date: Tue Nov 3 02:35:28 2009 +0100

backup
---
devel/devel.ma/Main.cc | 222 ++++++++++++++++++++++++++++++-------
devel/devel.ma/NewPool.cc | 20 +++-
tools/zypp-Orphans.cc | 146 ++++++++++++++++++++++++
zypp/CMakeLists.txt | 2 +
zypp/ResolverTransaction.cc | 109 ++++++++++++++++++
zypp/ResolverTransaction.h | 77 +++++++++++++
zypp/sat/detail/PoolImpl.cc | 2 +-
zypp/solver/detail/SATResolver.cc | 5 +
8 files changed, 537 insertions(+), 46 deletions(-)

diff --git a/devel/devel.ma/Main.cc b/devel/devel.ma/Main.cc
index 7fe1c36..9704d9e 100644
--- a/devel/devel.ma/Main.cc
+++ b/devel/devel.ma/Main.cc
@@ -6,7 +6,7 @@
///////////////////////////////////////////////////////////////////

//static const Pathname sysRoot( getenv("SYSROOT") ? getenv("SYSROOT") :
"/Local/ROOT" );
-static const Pathname sysRoot( "/tmp/ToolScanRepos" );
+static const Pathname sysRoot( "/" );

///////////////////////////////////////////////////////////////////

@@ -55,65 +55,207 @@ namespace zypp
}
}

+void changePriority( const std::string & alias_r, int prio_r )
+{
+ sat::Pool satpool( sat::Pool::instance() );
+ Repository r( satpool.reposFind( alias_r ) );
+ MIL << r << endl;
+ RepoInfo ri( r.info() );
+ ri.setPriority( prio_r );
+ r.setInfo( ri );
+ MIL << r << endl;
+}
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ /** Alignment flags. */
+ enum AlignmentFlag
+ {
+ AlignLeft = (1 << 0),
+ AlignRight = (1 << 1),
+ AlignHCenter= (1 << 2),
+ AlignTop = (1 << 3),
+ AlignBottom = (1 << 4),
+ AlignVCenter= (1 << 5),
+ AlignCenter = AlignHCenter | AlignVCenter,
+ AlignHMask = AlignLeft | AlignRight | AlignHCenter,
+ AlignVMask = AlignTop | AlignBottom | AlignVCenter
+ };
+
+ /** \relates AlignmentFlag Type-safe way of storing OR-combinations. */
+ ZYPP_DECLARE_FLAGS_AND_OPERATORS( Alignment, AlignmentFlag );
+
+
+ /** Decoration flags.
+ * \verbatim
+ * +-+
+ * ++ |c|
+ * ++ +-+
+ * \endverbatim
+ */
+ enum DecorationFlag
+ {
+ // Corners
+ TopLeftCorner = (1 << 0),
+ TopRightCorner = (1 << 1),
+ BottomLeftCorner = (1 << 2),
+ BottomRightCorner = (1 << 3),
+ TopCorners = TopLeftCorner | TopRightCorner,
+ BottomCorners = BottomLeftCorner | BottomRightCorner,
+ LeftCorners = TopLeftCorner | BottomLeftCorner,
+ RightCorners = TopRightCorner | BottomRightCorner,
+ Corners = TopLeftCorner | TopRightCorner | BottomLeftCorner |
BottomRightCorner,
+ // Edges
+ TopEdge = (1 << 4),
+ BottomEdge = (1 << 5),
+ LeftEdge = (1 << 6),
+ RightEdge = (1 << 7),
+ HEdges = TopEdge | BottomEdge,
+ VEdges = LeftEdge | RightEdge,
+ Edges = HEdges | VEdges,
+ // Sides
+ TopSide = TopEdge | TopCorners,
+ BottomSide = BottomEdge | BottomCorners,
+ LeftSide = LeftEdge | LeftCorners,
+ RightSide = RightEdge | RightCorners,
+ HSides = TopSide | BottomSide,
+ VSides = LeftSide | RightSide,
+ Sides = HSides | VSides,
+ // Inner
+ HInner = (1 << 8),
+ VInner = (1 << 9),
+ Inner = HInner | VInner
+ };
+
+ /** \relates DecorationFlag Type-safe way of storing OR-combinations. */
+ ZYPP_DECLARE_FLAGS_AND_OPERATORS( Decoration, DecorationFlag );
+
+
+
+ ///////////////////////////////////////////////////////////////////
+ namespace table
+ { /////////////////////////////////////////////////////////////////
+
+ class Decorated
+ {
+ public:
+ Decorated() {}
+ Decorated( Decoration decoration_r ) : _decoration( decoration_r ) {}
+ virtual ~Decorated() {}
+ public:
+ Decoration decoration() const { return _decoration; }
+ Decoration & decoration() { return _decoration; }
+ private:
+ Decoration _decoration;
+ };
+
+ class Cell : public Decorated
+ {
+ public:
+ typedef size_t size_type;
+ public:
+ Cell() {}
+ Cell( const std::string & str_r ) : _str( str_r ) {}
+ public:
+ virtual bool empty() const { return _str.empty(); }
+ virtual size_type hSize() const { return _str.empty() ? 0 : 1; }
+ virtual size_type vSize() const { return _str.size(); }
+ private:
+ std::string _str;
+ };
+
+
+
+ /////////////////////////////////////////////////////////////////
+ } //table
+ ///////////////////////////////////////////////////////////////////
+
+ class TableData
+ {
+ public:
+ TableData() {}
+ TableData( const std::string & str_r ) : _str( str_r ) {}
+ public:
+ size_type hSize() const { return _str.size(); }
+ size_type vSize() const { return _str.empty() ? 0 : 1; }
+ private:
+ std::string _str;
+ };
+
+ typedef shared_ptr<TableData> TableDataPtr;
+
+ class Table : public table::Decorated
+ {
+ public:
+ typedef size_t size_type;
+ typedef table::Cell Cell;
+
+ public:
+
+ void addItem( const TableDataPtr & data_r, unsigned row_r, unsigned
col_r );
+
+ public:
+ bool empty() const { return _table.empty(); }
+ size_type rows() const { return _table.size(); }
+ size_type cols() const { return _table.empty() ? 0 : _table[0].size();
}
+
+ private:
+ typedef std::vector<Cell> Cells;
+ struct Row : public Decorated
+ { Cells _cells; };
+ typedef std::vector<Row> Rows;
+ private:
+ Rows _rows;
+ Decoration _defaultRowDecoration;
+ Decoration _defaultCellDecoration;
+ };
+
+ /** \relates Table Stream output. */
+ std::ostream & operator<<( std::ostream & str, const Table & obj )
+ {
+ str << "Table[" << obj.rows() << "," << obj.cols() << "] {";
+
+
+
+ return str << endl << "}";
+ }
+
+ /////////////////////////////////////////////////////////////////
+} //zypp
+///////////////////////////////////////////////////////////////////
+
+
int main( int argc, char * argv[] )
try {
--argc;
++argv;
zypp::base::LogControl::instance().logToStdErr();
INT << "===[START]==========================================" << endl;
+#if 0
::unsetenv( "ZYPP_CONF" );
ZConfig::instance();
- TestSetup::LoadSystemAt( sysRoot, Arch_i586 );
+ TestSetup::LoadSystemAt( sysRoot );
///////////////////////////////////////////////////////////////////
ResPool pool( ResPool::instance() );
sat::Pool satpool( sat::Pool::instance() );
///////////////////////////////////////////////////////////////////
dumpRange( USR, satpool.reposBegin(), satpool.reposEnd() ) << endl;
USR << "pool: " << pool << endl;
+#endif

- sat::AttrMatcher matches( "^aaa_base$", Match::REGEX );
+ Table t;
+ USR << t << endl;

- getZYpp()->resolver()->addRequire( Capability("aaa_base") );

- solve();
+#if 0
+ upgrade();
for_( it, make_filter_begin<resfilter::ByTransact>(pool),
make_filter_end<resfilter::ByTransact>(pool) )
{
- USR << *it << " " << (*it)->repoInfo().name() << endl;
- if ( matches( (*it)->name() ) )
- {
- SEC << *it << " " << (*it)->repoInfo().name() << endl;
- }
- }
-
- std::vector<std::string> words;
- str::split( "3ddiag ConsoleKit-x11 FZFangSong FZKaiTiB IPAGothic ImageMagick
MozillaFirefox MozillaFirefox-branding-Moblin MozillaFirefox-translations
NetworkManager OpenOffice_org OpenOffice_org-LanguageTool
OpenOffice_org-LanguageTool-de OpenOffice_org-LanguageTool-en
OpenOffice_org-LanguageTool-es OpenOffice_org-LanguageTool-fr
OpenOffice_org-LanguageTool-it OpenOffice_org-LanguageTool-nl
OpenOffice_org-LanguageTool-pl OpenOffice_org-LanguageTool-sv
OpenOffice_org-base OpenOffice_org-base-extensions OpenOffice_org-branding-SLED
OpenOffice_org-calc OpenOffice_org-calc-extensions OpenOffice_org-components
OpenOffice_org-draw OpenOffice_org-draw-extensions OpenOffice_org-filters
OpenOffice_org-filters-optional OpenOffice_org-gnome OpenOffice_org-hyphen
OpenOffice_org-icon-themes OpenOffice_org-impress
OpenOffice_org-impress-extensions OpenOffice_org-l10n-de OpenOffice_org-l10n-el
OpenOffice_org-l10n-en-GB OpenOffice_org-l10n-es OpenOffice_org-l10n-extras
OpenOffice_org-l10
n-fi OpenOffice_org-l10n-fr OpenOffice_org-l10n-it OpenOffice_org-l10n-ja
OpenOffice_org-l10n-ko OpenOffice_org-l10n-nl OpenOffice_org-l10n-pl
OpenOffice_org-l10n-pt OpenOffice_org-l10n-pt-BR OpenOffice_org-l10n-ru
OpenOffice_org-l10n-sv OpenOffice_org-l10n-zh-CN OpenOffice_org-l10n-zh-TW
OpenOffice_org-libs-core OpenOffice_org-libs-extern OpenOffice_org-libs-gui
OpenOffice_org-math OpenOffice_org-openclipart OpenOffice_org-templates-en
OpenOffice_org-templates-labels-a4 OpenOffice_org-templates-labels-letter
OpenOffice_org-templates-presentation-layouts OpenOffice_org-thesaurus-de
OpenOffice_org-thesaurus-en OpenOffice_org-thesaurus-es
OpenOffice_org-thesaurus-fr OpenOffice_org-thesaurus-pl
OpenOffice_org-thesaurus-pt OpenOffice_org-thesaurus-ru
OpenOffice_org-thesaurus-sk OpenOffice_org-thesaurus-sv OpenOffice_org-ure
OpenOffice_org-writer OpenOffice_org-writer-extensions PackageKit PolicyKit
PolicyKit-gnome SDL SDL_image SDL_mixer SDL_net SDL_ttf SuSEfirewall2
WorldOfGooD
emo a2ps aaa_base acct acl acpid acroread agfa-fonts alsa alsa-tools
amavisd-new anerley anjal ash at atk attr audit-libs autoyast2-installation
avahi backup-manager baekmuk-ttf banshee-1 banshee-1-backend-engine-gstreamer
banshee-1-backend-platform-gnome banshee-1-backend-platform-unix
banshee-1-extensions-default banshee-1-novell-aac bash bc bind-libs bind-utils
binutils bisho bitstream-vera blt bluez bluez-alsa bluez-cups bluez-firmware
bluez-gnome bluez-gstreamer bootchart bootsplash-branding-SLED branding-SLED
brasero bzip2 cabextract cairo cdrkit-cdrtools-compat checkmedia cheese
cifs-mount clutter-mozembed compat convmv coreutils cpio cpp cpufrequtils
cracklib cracklib-dict-full cron cryptconfig csync cubano cups cups-autoconfig
cups-backends cups-client cups-drivers cups-libs curl cyrus-sasl
cyrus-sasl-crammd5 cyrus-sasl-digestmd5 cyrus-sasl-gssapi cyrus-sasl-plain
dalston dates db-utils dbus-1 dbus-1-glib dbus-1-x11 dejavu deltarpm
desktop-file-utils desktop-transla
tions device-mapper dhcpcd dialog diffutils dirmngr dmraid dos2unix dosfstools
e2fsprogs ed eject elfutils empathy ethtool evince evolution evolution-pilot
expat extreme-tuxracer f-spot fbset file file-roller filesystem fillup filters
findutils finger flash-player fontconfig fonts-config foomatic-filters freeglut
freetype freetype2 fribidi frozen-bubble gammu gawk gcalctool
gconf2-branding-SLED gdb gdbm gdm gdm-branding-upstream gedit geoclue
gettext-runtime gftp gfxboot-branding-SLED ghostscript-fonts-other
ghostscript-fonts-std ghostscript-library ghostscript-x11 giflib gimp glib
glib2 glib2-branding-Moblin glibc glibc-locale gnome-audio gnome-control-center
gnome-desktop gnome-games gnome-icon-theme gnome-keyring gnome-keyring-pam
gnome-media gnome-menus gnome-mime-data gnome-mount gnome-packagekit
gnome-panel gnome-pilot gnome-session gnome-spell2 gnome-system-monitor
gnome-terminal gnome-themes gnome-utils gnome-vfs2 gnome-web-photo gpart gpg2
gpgme gphoto gpm gpsd grep
groff grub gstreamer-0_10 gstreamer-0_10-plugins-base
gstreamer-0_10-plugins-farsight gstreamer-0_10-plugins-good
gstreamer-0_10-schroedinger gstreamer-0_10-utils gsynaptics gtk gtk2
gtk2-branding-SLED gtk2-engines gtk2-theme-SLED gtk2-themes gtkhtml2 gtkspell
gutenprint gvfs-backends gypsy gzip hal hdparm hornsey hwinfo ifplugd imlib
info initviocons inkscape insserv iproute2 iptables iputils ipw-firmware ispell
ispell-american ispell_english_dictionary iw iwl3945-ucode iwl4965-ucode
iwl5000-ucode jana java-1_6_0-sun java-1_6_0-sun-plugin json-glib
kernel-default kernel-default-base kernel-default-extra kernel-firmware klogd
krb5 ksymoops laptop-mode-tools lcms less libQtWebKit4 libacl libattr
libblocxx6 libbluetooth3 libclutter-box2d-0_10-0 libclutter-glx-1_0-0
libclutter-gst-1_0-0 libclutter-gtk-1_0-0 libclutter-qt-1_0-0 libdb-4_5
libevent-1_4-2 libfakekey0 libfprint0 libgcc43 libgcrypt11 libgimpprint
libgpg-error0 libgsf-gnome libjpeg libmikmod libmng libmoon0 libnetpbm
10 libnscd libopensync-plugin-file libpcap0 libpng12-0 libproxy-tools
libproxy0 libproxy0-gnome libproxy0-mozjs libproxy0-networkmanager libreadline5
librpcsecgss libsmbios-bin libstdc++33 libstdc++43 libtiff3 libusbpp-0_1-4
libxcrypt libxml2 libxslt libzio libzypp lilo limal limal-perl linux-atm-lib
login logrotate lsof lukemftp m4 mailx make man man-pages manufacturer-PPDs
master-boot-code mdadm meerkat metacity metamail microcode_ctl mingetty
mkinitrd moblin-branding-Samsung moblin-gtk-engine moblin-icon-theme
moblin-menus moblin-registration moblin-release moblin-sound-theme
moblin-ux-settings moblin-web-browser module-init-tools mojito monsoon
moonlight-plugin moonshine moonshine-plugin mousetweaks mozilla-filesystem
mozilla-xulrunner190 mtools mutter mutter-moblin myspell-american
myspell-british myspell-dutch myspell-french myspell-german myspell-greek
myspell-italian myspell-polish myspell-portuguese myspell-russian
myspell-spanish myspell-swedish nautilus nautilus-c
d-burner nautilus-eiciel nautilus-open-terminal nautilus-sendto nautilus-share
nbtk ncurses-utils net-tools netcat netcfg network-manager-netbook neverball
nfsidmap notification-daemon novell-ipsec-tools novell-ldapext
novell-nortelplugins nscd nspluginwrapper nss_ldap ntfs-3g ntfsprogs ntp
numlockx openclipart-svg openldap2-client openmotif-libs openobex opensc
openslp openssh openssh-askpass openssl padevchooser pam pam-config pam-modules
pam_csync pam_krb5 pam_ldap pam_p11 pam_pkcs11 pam_radius pam_smb pam_ssh paman
paprefs parted pavucontrol pavumeter pciutils pcmciautils pcre pcsc-lite perl
perl-Bootloader perl-Config-Crontab perl-Crypt-SmbHash perl-Digest-MD4
perl-Digest-SHA1 perl-Parse-RecDescent perl-TermReadKey perl-X500-DN
perl-XML-XPath perl-base perl-gettext perl-satsolver permissions pinentry-gtk2
planner plymouth-lite pmtools polkit-default-privs popt postfix ppp pptp
preload procinfo procmail procps psmisc pulseaudio-esound-compat
pulseaudio-module-bluetooth p
ulseaudio-module-gconf pulseaudio-module-lirc pulseaudio-module-x11
pulseaudio-module-zeroconf pulseaudio-utils pwdutils python python-gnome
python-gtk python-numeric python-qt python-tk python-xml rdesktop recode
reiserfs release-notes-sled rest rpm rsh rsync rsyslog rtc-tzset samba
samba-client sample-media-images samsung-icon-theme samsung-manual sash sax2
sax2-gui sax2-ident sax2-libsax sax2-libsax-perl sax2-tools scim scim-bridge
scim-bridge-clutter scim-bridge-gtk scim-bridge-qt scim-chewing scim-m17n
scim-pinyin scim-tables scim-tables-zh screen seahorse sed setserial sg3_utils
shared-mime-info sled-manuals_en sled-moblinquick_en sled-moblinquick_en-pdf
splashy splashy-branding-SLED sqlite3 sreadahead star startup-notification
strace sudo supportutils suse-build-key suse-sam suseRegister susehelp
susehelp_en suspend syncevolution sysconfig sysfsutils syslinux
system-config-printer sysvinit tango-icon-theme tar tcl-devel tcpd tcsh telnet
terminfo tightvnc timezone tk-d
evel translation-update tsclient turnpike twitter-glib udev ulimit unrar unzip
usbutils utempter util-linux uxlaunch vbetool vim vim-data vte w3m wdiff wget
wimax-tools wireless-tools wol words wpa_supplicant wvdial wvstreams
x11-input-synaptics x11-tools x86info xchat xdmbgrd xfsprogs xkeyboard-config
xorg-x11 xorg-x11-Xvnc xorg-x11-driver-input xorg-x11-driver-video
xorg-x11-fonts xorg-x11-libX11-ccache xorg-x11-libs xorg-x11-server
xorg-x11-server-extra xorg-x11-xauth xpdf-tools xterm xtermset xulrunner yast2
yast2-bootloader yast2-branding-SLED yast2-control-center-gnome yast2-core
yast2-country yast2-firewall yast2-firstboot yast2-gtk yast2-hardware-detection
yast2-installation yast2-kerberos-client yast2-ldap yast2-ldap-client
yast2-metapackage-handler yast2-mouse yast2-ncurses yast2-ncurses-pkg
yast2-network yast2-ntp-client yast2-online-update yast2-online-update-frontend
yast2-packager yast2-pam yast2-perl-bindings yast2-pkg-bindings yast2-qt
yast2-qt-pkg yast2-rdp
yast2-registration yast2-registration-branding-SLE yast2-repair yast2-runlevel
yast2-samba-client yast2-schema yast2-security yast2-slp yast2-sound
yast2-storage yast2-storage-lib yast2-support yast2-sysconfig yast2-theme-SLE
yast2-trans-en_GB yast2-trans-en_US yast2-trans-es yast2-trans-fi
yast2-trans-fr yast2-trans-ja yast2-trans-ko yast2-trans-pt_BR
yast2-trans-stats yast2-trans-sv yast2-trans-zh_CN yast2-trans-zh_TW
yast2-transfer yast2-tune yast2-update yast2-users yast2-wagon yast2-x11
yast2-xml yelp youtube-player zenity zip zlib",
- std::back_inserter(words) );
- for_( it, words.begin(), words.end() )
- {
- getZYpp()->resolver()->addRequire( Capability(*it) );
- }
-
- getZYpp()->resolver()->addRequire( Capability("aaa_base > 11-6.2") );
-
- solve();
- for_( it, make_filter_begin<resfilter::ByTransact>(pool),
make_filter_end<resfilter::ByTransact>(pool) )
- {
- USR << *it << " " << (*it)->repoInfo().name() << endl;
- if ( matches( (*it)->name() ) )
- {
- SEC << *it << " " << (*it)->repoInfo().name() << endl;
- }
- }
-
-
- if ( 0 )
- {
- getZYpp()->resolver()->addRequire( Capability("emacs") );
- solve();
- vdumpPoolStats( USR << "Transacting:"<< endl,
- make_filter_begin<resfilter::ByTransact>(pool),
- make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+ MIL << *it << endl;
}
+#endif

///////////////////////////////////////////////////////////////////
INT << "===[END]============================================" << endl <<
endl;
diff --git a/devel/devel.ma/NewPool.cc b/devel/devel.ma/NewPool.cc
index 1596cdc..f2606de 100644
--- a/devel/devel.ma/NewPool.cc
+++ b/devel/devel.ma/NewPool.cc
@@ -482,7 +482,7 @@ void cut( const Capability & cap )
}
else
{
- MIL << "---???---" << endl;
+ MIL << "--- ???? ---" << endl;
}
}

@@ -513,10 +513,18 @@ try {
INT << "===[START]==========================================" << endl;
ZConfig::instance();

+ Url u("http://user:pass@Host/path";);
+ USR << u << endl;
+ USR << u.getHost() << endl;
+ USR << u.getUsername() << endl;
+ USR << u.getPassword() << endl;
+
+ return 0;
+
ResPool pool( ResPool::instance() );
sat::Pool satpool( sat::Pool::instance() );

- if ( 0 )
+ if ( 1 )
{
Measure x( "INIT TARGET" );
{
@@ -620,11 +628,13 @@ try {

///////////////////////////////////////////////////////////////////

+ for_( it, pool.proxy().byKindBegin<Package>(),
pool.proxy().byKindEnd<Package>() )
+ {
+ ((*it)->identicalInstalledCandidate() ? MIL : WAR) << *it << endl;
+ }


-
-
-#if 1
+#if 0
getZYpp()->resolver()->addRequire( Capability("amarok") );
pool.byKindBegin<Package>()->status().setTransact( true, ResStatus::USER );
solve();
diff --git a/tools/zypp-Orphans.cc b/tools/zypp-Orphans.cc
new file mode 100644
index 0000000..4651614
--- /dev/null
+++ b/tools/zypp-Orphans.cc
@@ -0,0 +1,146 @@
+#define INCLUDE_TESTSETUP_WITHOUT_BOOST
+#include "zypp/../tests/lib/TestSetup.h"
+#undef INCLUDE_TESTSETUP_WITHOUT_BOOST
+
+#include <algorithm>
+#include <zypp/PoolQuery.h>
+#include <zypp/misc/DefaultLoadSystem.h>
+
+static std::string appname( "zypp-Orphans" );
+
+#define message cout
+using std::flush;
+
+int errexit( const std::string & msg_r = std::string(), int exit_r = 100 )
+{
+ if ( ! msg_r.empty() )
+ {
+ cerr << endl << msg_r << endl << endl;
+ }
+ return exit_r;
+}
+
+int usage( const std::string & msg_r = std::string(), int exit_r = 100 )
+{
+ if ( ! msg_r.empty() )
+ {
+ cerr << endl << msg_r << endl << endl;
+ }
+ cerr << "Usage: " << appname << " [--root ROOTDIR] [OPTIONS]" << endl;
+ cerr << " Load all enabled repositories (no refresh) and search for" <<
endl;
+ cerr << " orphaned packages. I.e packages wich are inatalled but not" <<
endl;
+ cerr << " available in any repository." << endl;
+ cerr << " --root Load repos from the system located below ROOTDIR. If
ROOTDIR" << endl;
+ cerr << " denotes a sover testcase, the testcase is loaded." <<
endl;
+ cerr << "" << endl;
+ return exit_r;
+}
+
+void tableOut( const std::string & s1 = std::string(),
+ const std::string & s2 = std::string(),
+ const std::string & s3 = std::string(),
+ const std::string & s4 = std::string(),
+ const std::string & s5 = std::string() )
+{
+ message << " ";
+#define TABEL(N) static unsigned w##N = 0; if ( ! s##N.empty() ) w##N =
std::max( w##N, unsigned(s##N.size()) ); message << str::form( " %-*s ", w##N,
s##N.c_str() )
+#define TABER(N) static unsigned w##N = 0; if ( ! s##N.empty() ) w##N =
std::max( w##N, unsigned(s##N.size()) ); message << str::form( " %*s ", w##N,
s##N.c_str() )
+ TABER( 1 ); TABEL( 2 ); TABEL( 3 ); TABEL( 4 ); TABEL( 5 );
+#undef TABEL
+ message << endl;
+}
+
+bool solve()
+{
+ bool rres = false;
+ {
+ rres = getZYpp()->resolver()->resolvePool();
+ }
+ if ( ! rres )
+ {
+ ERR << "resolve " << rres << endl;
+ getZYpp()->resolver()->problems();
+ return false;
+ }
+ MIL << "resolve " << rres << endl;
+ return true;
+}
+
+/******************************************************************
+**
+** FUNCTION NAME : main
+** FUNCTION TYPE : int
+*/
+int main( int argc, char * argv[] )
+{
+ INT << "===[START]==========================================" << endl;
+ appname = Pathname::basename( argv[0] );
+ --argc,++argv;
+
+ ///////////////////////////////////////////////////////////////////
+
+ ZConfig::instance();
+ Pathname sysRoot("/");
+ sat::Pool satpool( sat::Pool::instance() );
+
+ while ( argc )
+ {
+ if ( (*argv) == std::string("--help") )
+ {
+ return usage();
+ }
+
+ if ( (*argv) == std::string("--root") )
+ {
+ --argc,++argv;
+ if ( ! argc )
+ return errexit("--root requires an argument.");
+
+ if ( ! PathInfo( *argv ).isDir() )
+ return errexit("--root requires a directory.");
+
+ sysRoot = *argv;
+ --argc,++argv;
+ }
+
+ }
+
+ if ( TestSetup::isTestcase( sysRoot ) )
+ {
+ message << str::form( "*** Load Testcase from '%s'", sysRoot.c_str() ) <<
endl;
+ TestSetup test;
+ test.loadTestcaseRepos( sysRoot );
+ }
+ else if ( TestSetup::isTestSetup( sysRoot ) )
+ {
+ message << str::form( "*** Load TestSetup from '%s'", sysRoot.c_str() ) <<
endl;
+ TestSetup test( sysRoot, Arch_x86_64 );
+ test.loadRepos();
+ }
+ else
+ {
+ // a system
+ message << str::form( "*** Load system at '%s'", sysRoot.c_str() ) << endl;
+ misc::defaultLoadSystem( sysRoot, misc::LS_READONLY | misc::LS_NOREFRESH );
+ }
+
+ ///////////////////////////////////////////////////////////////////
+
+ ResPool pool( ResPool::instance() );
+ solve();
+ unsigned cnt = 0;
+ message << "Orphaned packages:";
+ for_( it, pool.byStatusBegin(&ResStatus::isOrphaned),
pool.byStatusEnd(&ResStatus::isOrphaned) )
+ {
+ ++cnt;
+ message << endl << " " << (*it).satSolvable().asString();
+ }
+
+ if ( ! cnt )
+ message << " none.";
+
+ message << endl;
+
+ INT << "===[END]============================================" << endl <<
endl;
+ return 0;
+}
diff --git a/zypp/CMakeLists.txt b/zypp/CMakeLists.txt
index bbceaa3..5f8048f 100644
--- a/zypp/CMakeLists.txt
+++ b/zypp/CMakeLists.txt
@@ -60,6 +60,7 @@ SET( zypp_SRCS
Resolvable.cc
Resolver.cc
ResolverProblem.cc
+ ResolverTransaction.cc
ResPool.cc
ResPoolProxy.cc
ResStatus.cc
@@ -157,6 +158,7 @@ SET( zypp_HEADERS
Resolvable.h
Resolver.h
ResolverProblem.h
+ ResolverTransaction.h
ResPool.h
ResPoolProxy.h
ResStatus.h
diff --git a/zypp/ResolverTransaction.cc b/zypp/ResolverTransaction.cc
new file mode 100644
index 0000000..cadf232
--- /dev/null
+++ b/zypp/ResolverTransaction.cc
@@ -0,0 +1,109 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ResolverTransaction.cc
+ *
+*/
+extern "C"
+{
+#include <satsolver/transaction.h>
+}
+
+#include <iostream>
+
+#include "zypp/base/LogTools.h"
+#include "zypp/sat/detail/PoolMember.h"
+
+#include "zypp/ResolverTransaction.h"
+
+using std::endl;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ void remember_transaction( const _Transaction & trans_r )
+ {
+ ResolverTransaction trans( &trans_r );
+ USR << trans << endl;
+ }
+
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ResolverTransaction::Impl
+ //
+ /** ResolverTransaction implementation. */
+ struct ResolverTransaction::Impl
+ {
+ public:
+ Impl( const ::_Transaction * sattrans_r = 0 )
+ {
+ if ( sattrans_r )
+ ::transaction_init_clone( &_trans, const_cast< ::_Transaction*>(
sattrans_r ) );
+ else
+ ::transaction_init( &_trans, myPool().getPool() );
+ }
+
+ Impl( const Impl & rhs )
+ { ::transaction_init_clone( &_trans, const_cast< ::_Transaction*>(
&rhs._trans ) ); }
+
+ ~Impl()
+ { ::transaction_free( &_trans ); }
+
+ public:
+
+ ::_Transaction _trans;
+
+ private:
+ friend Impl * rwcowClone<Impl>( const Impl * rhs );
+ /** clone for RWCOW_pointer */
+ Impl * clone() const
+ { return new Impl( *this ); }
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates ResolverTransaction::Impl Stream output */
+ inline std::ostream & operator<<( std::ostream & str, const
ResolverTransaction::Impl & obj )
+ {
+ return str << "ResolverTransaction::Impl";
+ }
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ResolverTransaction
+ //
+ ///////////////////////////////////////////////////////////////////
+
+ ResolverTransaction::ResolverTransaction()
+ : _pimpl( new Impl )
+ {}
+
+ ResolverTransaction::ResolverTransaction( const ::_Transaction * sattrans_r )
+ : _pimpl( new Impl( sattrans_r ) )
+ {}
+
+ ///////////////////////////////////////////////////////////////////
+
+ bool ResolverTransaction::empty() const
+ { return true; }
+
+ ::_Transaction * ResolverTransaction::get() const
+ { return const_cast< ::_Transaction*>( &_pimpl->_trans ); }
+
+ /******************************************************************
+ **
+ ** FUNCTION NAME : operator<<
+ ** FUNCTION TYPE : std::ostream &
+ */
+ std::ostream & operator<<( std::ostream & str, const ResolverTransaction &
obj )
+ { return str << *obj._pimpl; }
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/ResolverTransaction.h b/zypp/ResolverTransaction.h
new file mode 100644
index 0000000..be64d35
--- /dev/null
+++ b/zypp/ResolverTransaction.h
@@ -0,0 +1,77 @@
+/*---------------------------------------------------------------------\
+| ____ _ __ __ ___ |
+| |__ / \ / / . \ . \ |
+| / / \ V /| _/ _/ |
+| / /__ | | | | | | |
+| /_____||_| |_| |_| |
+| |
+\---------------------------------------------------------------------*/
+/** \file zypp/ResolverTransaction.h
+ *
+*/
+#ifndef ZYPP_RESOLVERTRANSACTION_H
+#define ZYPP_RESOLVERTRANSACTION_H
+
+#include <iosfwd>
+
+#include "zypp/base/SafeBool.h"
+#include "zypp/sat/detail/PoolImpl.h"
+
+#include "zypp/base/PtrTypes.h"
+
+extern "C"
+{
+struct _Transaction;
+}
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+ void remember_transaction( const _Transaction & );
+
+ ///////////////////////////////////////////////////////////////////
+ //
+ // CLASS NAME : ResolverTransaction
+ //
+ /** */
+ class ResolverTransaction: protected sat::detail::PoolMember,
+ private base::SafeBool<ResolverTransaction>
+ {
+ friend std::ostream & operator<<( std::ostream & str, const
ResolverTransaction & obj );
+
+ public:
+ /** Default ctor */
+ ResolverTransaction();
+
+ /** Ctor taking satsolver data. */
+ ResolverTransaction( const ::_Transaction * sattrans_r );
+
+ public:
+ /** */
+ bool empty() const;
+
+ public:
+ /** Expert backdoor. */
+ ::_Transaction * get() const;
+ private:
+#ifndef SWIG // Swig treats it as syntax error
+ friend base::SafeBool<ResolverTransaction>::operator bool_type() const;
+#endif
+ bool boolTest() const { return ! empty(); }
+ public:
+ /** Implementation */
+ class Impl;
+ private:
+ /** Pointer to implementation */
+ RWCOW_pointer<Impl> _pimpl;
+ };
+ ///////////////////////////////////////////////////////////////////
+
+ /** \relates ResolverTransaction Stream output */
+ std::ostream & operator<<( std::ostream & str, const ResolverTransaction &
obj );
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_RESOLVERTRANSACTION_H
diff --git a/zypp/sat/detail/PoolImpl.cc b/zypp/sat/detail/PoolImpl.cc
index 951756f..873e382 100644
--- a/zypp/sat/detail/PoolImpl.cc
+++ b/zypp/sat/detail/PoolImpl.cc
@@ -184,7 +184,7 @@ namespace zypp
if (verbose)
::pool_setdebuglevel( _pool, 2 );
else
- ::pool_setdebugmask(_pool, SAT_DEBUG_JOB|SAT_DEBUG_STATS);
+ ::pool_setdebugmask(_pool,
SAT_DEBUG_JOB|SAT_DEBUG_STATS|SAT_DEBUG_RESULT);

::pool_setdebugcallback( _pool, logSat, NULL );

diff --git a/zypp/solver/detail/SATResolver.cc
b/zypp/solver/detail/SATResolver.cc
index f3b5f23..88c371b 100644
--- a/zypp/solver/detail/SATResolver.cc
+++ b/zypp/solver/detail/SATResolver.cc
@@ -27,6 +27,7 @@ extern "C"
#include <satsolver/policy.h>
#include <satsolver/bitmap.h>
#include <satsolver/queue.h>
+#include <satsolver/solverdebug.h>
}

#include "zypp/solver/detail/Helper.h"
@@ -55,6 +56,7 @@ extern "C"
/////////////////////////////////////////////////////////////////////////
namespace zypp
{ ///////////////////////////////////////////////////////////////////////
+ void remember_transaction( const _Transaction & );
///////////////////////////////////////////////////////////////////////
namespace solver
{ /////////////////////////////////////////////////////////////////////
@@ -652,6 +654,9 @@ SATResolver::solverInit(const PoolItemList & weakItems)
void
SATResolver::solverEnd()
{
+ ::solver_printdecisions( _solv );
+ ::solver_printtransaction( _solv );
+ remember_transaction( _solv->trans );
// cleanup
solver_free(_solv);
_solv = NULL;
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >