Mailinglist Archive: opensuse-commit (1139 mails)

< Previous Next >
commit yast2-pkg-bindings
  • From: root@xxxxxxxxxxxxxxx (h_root)
  • Date: Thu, 25 Jan 2007 17:26:41 +0100
  • Message-id: <20070125162642.1EB60678181@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package yast2-pkg-bindings
checked in at Thu Jan 25 17:26:41 CET 2007.

--------
--- yast2-pkg-bindings/yast2-pkg-bindings.changes 2007-01-18 14:08:37.000000000 +0100
+++ /mounts/work_src_done/STABLE/yast2-pkg-bindings/yast2-pkg-bindings.changes 2007-01-25 15:36:24.000000000 +0100
@@ -1,0 +2,9 @@
+Thu Jan 25 15:31:34 CET 2007 - lslezak@xxxxxxx
+
+- new binding Pkg::PkgDU() - computes disk usage of the package
+ in the current partitinoning (#222556)
+- new binding Pkg::TargetAvailable() - returns non-root free
+ disk space (#237309)
+- 2.15.4
+
+-------------------------------------------------------------------

Old:
----
yast2-pkg-bindings-2.15.3.tar.bz2

New:
----
yast2-pkg-bindings-2.15.4.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-pkg-bindings.spec ++++++
--- /var/tmp/diff_new_pack.vq1279/_old 2007-01-25 17:26:28.000000000 +0100
+++ /var/tmp/diff_new_pack.vq1279/_new 2007-01-25 17:26:28.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-pkg-bindings (Version 2.15.3)
+# spec file for package yast2-pkg-bindings (Version 2.15.4)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
# norootforbuild

Name: yast2-pkg-bindings
-Version: 2.15.3
+Version: 2.15.4
Release: 1
License: GNU General Public License (GPL)
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-pkg-bindings-2.15.3.tar.bz2
+Source0: yast2-pkg-bindings-2.15.4.tar.bz2
prefix: /usr
BuildRequires: blocxx-devel boost boost-devel dbus-1-devel docbook-xsl-stylesheets doxygen gcc-c++ hal-devel libgcrypt-devel libxcrypt-devel libxslt perl-XML-Writer rpm-devel sgml-skel yast2-core-devel yast2-devtools
BuildRequires: libzypp-devel >= 2.4.0
@@ -40,7 +40,7 @@
Stanislav Visnovsky <visnov@xxxxxxx>

%prep
-%setup -n yast2-pkg-bindings-2.15.3
+%setup -n yast2-pkg-bindings-2.15.4

%build
%{prefix}/bin/y2tool y2autoconf
@@ -71,6 +71,12 @@
%doc %{prefix}/share/doc/packages/yast2-pkg-bindings

%changelog -n yast2-pkg-bindings
+* Thu Jan 25 2007 - lslezak@xxxxxxx
+- new binding Pkg::PkgDU() - computes disk usage of the package
+ in the current partitinoning (#222556)
+- new binding Pkg::TargetAvailable() - returns non-root free
+ disk space (#237309)
+- 2.15.4
* Thu Jan 18 2007 - lslezak@xxxxxxx
- Pkg::SetLocale() and Pkg::GetLocale() have been split into
Pkg::SetTextLocale(), Pkg::GetTextLocale(),

++++++ yast2-pkg-bindings-2.15.3.tar.bz2 -> yast2-pkg-bindings-2.15.4.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.3/configure new/yast2-pkg-bindings-2.15.4/configure
--- old/yast2-pkg-bindings-2.15.3/configure 2007-01-18 13:56:26.000000000 +0100
+++ new/yast2-pkg-bindings-2.15.4/configure 2007-01-25 15:19:24.000000000 +0100
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.60 for yast2-pkg-bindings 2.15.3.
+# Generated by GNU Autoconf 2.60 for yast2-pkg-bindings 2.15.4.
#
# Report bugs to <http://bugs.opensuse.org/>.
#
@@ -713,8 +713,8 @@
# Identity of this package.
PACKAGE_NAME='yast2-pkg-bindings'
PACKAGE_TARNAME='yast2-pkg-bindings'
-PACKAGE_VERSION='2.15.3'
-PACKAGE_STRING='yast2-pkg-bindings 2.15.3'
+PACKAGE_VERSION='2.15.4'
+PACKAGE_STRING='yast2-pkg-bindings 2.15.4'
PACKAGE_BUGREPORT='http://bugs.opensuse.org/'

ac_unique_file="RPMNAME"
@@ -1429,7 +1429,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures yast2-pkg-bindings 2.15.3 to adapt to many kinds of systems.
+\`configure' configures yast2-pkg-bindings 2.15.4 to adapt to many kinds of systems.

Usage: $0 [OPTION]... [VAR=VALUE]...

@@ -1500,7 +1500,7 @@

if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of yast2-pkg-bindings 2.15.3:";;
+ short | recursive ) echo "Configuration of yast2-pkg-bindings 2.15.4:";;
esac
cat <<\_ACEOF

@@ -1608,7 +1608,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-yast2-pkg-bindings configure 2.15.3
+yast2-pkg-bindings configure 2.15.4
generated by GNU Autoconf 2.60

Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1622,7 +1622,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

-It was created by yast2-pkg-bindings $as_me 2.15.3, which was
+It was created by yast2-pkg-bindings $as_me 2.15.4, which was
generated by GNU Autoconf 2.60. Invocation command line was

$ $0 $@
@@ -2423,7 +2423,7 @@

# Define the identity of the package.
PACKAGE='yast2-pkg-bindings'
- VERSION='2.15.3'
+ VERSION='2.15.4'


cat >>confdefs.h <<_ACEOF
@@ -2650,7 +2650,7 @@



-VERSION="2.15.3"
+VERSION="2.15.4"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák <lslezak@xxxxxxx>"

@@ -21612,7 +21612,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by yast2-pkg-bindings $as_me 2.15.3, which was
+This file was extended by yast2-pkg-bindings $as_me 2.15.4, which was
generated by GNU Autoconf 2.60. Invocation command line was

CONFIG_FILES = $CONFIG_FILES
@@ -21665,7 +21665,7 @@
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-yast2-pkg-bindings config.status 2.15.3
+yast2-pkg-bindings config.status 2.15.4
configured by $0, generated by GNU Autoconf 2.60,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"

diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.3/configure.in new/yast2-pkg-bindings-2.15.4/configure.in
--- old/yast2-pkg-bindings-2.15.3/configure.in 2007-01-18 13:56:11.000000000 +0100
+++ new/yast2-pkg-bindings-2.15.4/configure.in 2007-01-25 15:19:11.000000000 +0100
@@ -3,7 +3,7 @@
dnl -- This file is generated by y2autoconf 2.14.0 - DO NOT EDIT! --
dnl (edit configure.in.in instead)

-AC_INIT(yast2-pkg-bindings, 2.15.3, http://bugs.opensuse.org/, yast2-pkg-bindings)
+AC_INIT(yast2-pkg-bindings, 2.15.4, http://bugs.opensuse.org/, yast2-pkg-bindings)
dnl Check for presence of file 'RPMNAME'
AC_CONFIG_SRCDIR([RPMNAME])

@@ -17,7 +17,7 @@
AM_INIT_AUTOMAKE(tar-ustar) dnl searches for some needed programs

dnl Important YaST2 variables
-VERSION="2.15.3"
+VERSION="2.15.4"
RPMNAME="yast2-pkg-bindings"
MAINTAINER="Ladislav Slezák <lslezak@xxxxxxx>"

diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.3/src/Package.cc new/yast2-pkg-bindings-2.15.4/src/Package.cc
--- old/yast2-pkg-bindings-2.15.3/src/Package.cc 2007-01-08 14:36:03.000000000 +0100
+++ new/yast2-pkg-bindings-2.15.4/src/Package.cc 2007-01-25 15:32:42.000000000 +0100
@@ -2469,3 +2469,48 @@

return YCPBoolean(false);
}
+
+
+YCPValue
+PkgModuleFunctions::PkgDU(const YCPString& package)
+{
+ // get partitioning
+ // TODO FIXME: use zypp::DiskUsageCounter::MountPointSet mps = zypp_ptr()->getPartitions();
+ zypp::DiskUsageCounter::MountPointSet mps = zypp_ptr()->diskUsage();
+
+ // reset the package size
+ for (zypp::DiskUsageCounter::MountPointSet::iterator mpit = mps.begin(); mpit != mps.end(); mpit++)
+ {
+ mpit->pkg_size = 0;
+ }
+
+ zypp::PoolItem_Ref item;
+ zypp::Package::constPtr pkg = find_package(package->value(), item, zypp_ptr()->pool() );
+
+ // the package was not found
+ if (pkg == NULL)
+ {
+ return YCPVoid();
+ }
+
+ zypp::DiskUsage du = pkg->diskusage();
+
+ if (du.size() == 0)
+ {
+ y2warning("Disk usage for package %s is unknown", package->value().c_str());
+ return YCPVoid();
+ }
+
+ // iterate trough all mount points, add usage to each directory
+ // directory tree must be processed from leaves to the root directory
+ // so iterate in reverse order so e.g. /usr is used before /
+ for (zypp::DiskUsageCounter::MountPointSet::reverse_iterator mpit = mps.rbegin(); mpit != mps.rend(); mpit++)
+ {
+ // get usage for the mount point
+ zypp::DiskUsage::Entry entry = du.extract(mpit->dir);
+
+ mpit->pkg_size += entry._size;
+ }
+
+ return MPS2YCPMap(mps);
+}
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.3/src/PkgModuleFunctions.cc new/yast2-pkg-bindings-2.15.4/src/PkgModuleFunctions.cc
--- old/yast2-pkg-bindings-2.15.3/src/PkgModuleFunctions.cc 2007-01-18 13:25:54.000000000 +0100
+++ new/yast2-pkg-bindings-2.15.4/src/PkgModuleFunctions.cc 2007-01-18 17:23:41.000000000 +0100
@@ -424,6 +424,12 @@
YCPValue
PkgModuleFunctions::GetPackageLocale ()
{
+ // the locale hasn't been initialized
+ if (preferred_locale == zypp::Locale::noCode)
+ {
+ y2warning("The package locale hasn't been set, call Pkg::SetPackageLocale() before Pkg::GetPackageLocale()");
+ }
+
return YCPString(preferred_locale.code());
}

diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.3/src/PkgModuleFunctions.h new/yast2-pkg-bindings-2.15.4/src/PkgModuleFunctions.h
--- old/yast2-pkg-bindings-2.15.3/src/PkgModuleFunctions.h 2007-01-18 08:46:33.000000000 +0100
+++ new/yast2-pkg-bindings-2.15.4/src/PkgModuleFunctions.h 2007-01-22 14:50:23.000000000 +0100
@@ -119,6 +119,9 @@
// fix it (using USER). --ma
static const zypp::ResStatus::TransactByValue whoWantsIt; // #156875

+ // convert MountPointSet to YCP Map
+ YCPMap MPS2YCPMap(const zypp::DiskUsageCounter::MountPointSet &mps);
+
private:

/**
@@ -400,6 +403,8 @@
/* TYPEINFO: integer(string)*/
YCPInteger TargetUsed (const YCPString&);
/* TYPEINFO: integer(string)*/
+ YCPInteger TargetAvailable (const YCPString&);
+ /* TYPEINFO: integer(string)*/
YCPInteger TargetBlockSize (const YCPString&);
/* TYPEINFO: boolean(string)*/
YCPBoolean TargetInstall (const YCPString&);
@@ -475,6 +480,8 @@
YCPValue PkgPropertiesAll (const YCPString& package);
/* TYPEINFO: list<string>(string,symbol)*/
YCPList PkgGetFilelist (const YCPString& package, const YCPSymbol& which);
+ /* TYPEINFO: map<string,list<integer>>(string)*/
+ YCPValue PkgDU(const YCPString& package);
/* TYPEINFO: boolean()*/
YCPValue IsManualSelection ();
/* TYPEINFO: boolean()*/
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.3/src/Target.cc new/yast2-pkg-bindings-2.15.4/src/Target.cc
--- old/yast2-pkg-bindings-2.15.3/src/Target.cc 2006-11-13 14:46:25.000000000 +0100
+++ new/yast2-pkg-bindings-2.15.4/src/Target.cc 2007-01-22 15:05:20.000000000 +0100
@@ -287,7 +287,7 @@
* return capacity and usage of partition at directory
*/
static void
-get_disk_stats (const char *fs, long long *used, long long *size, long long *bsize)
+get_disk_stats (const char *fs, long long *used, long long *size, long long *bsize, long long *available)
{
struct statvfs sb;
if (statvfs (fs, &sb) < 0)
@@ -297,7 +297,8 @@
}
*bsize = sb.f_frsize ? : sb.f_bsize; // block size
*size = sb.f_blocks * *bsize; // total size
- *used = (sb.f_blocks - sb.f_bfree) * *bsize; // used size
+ *used = (sb.f_blocks - sb.f_bfree) * *bsize;
+ *available = sb.f_bavail * *bsize; // available for non-root user
}


@@ -312,8 +313,8 @@
YCPInteger
PkgModuleFunctions::TargetCapacity (const YCPString& dir)
{
- long long used, size, bsize;
- get_disk_stats (dir->value().c_str(), &used, &size, &bsize);
+ long long used, size, bsize, avail;
+ get_disk_stats (dir->value().c_str(), &used, &size, &bsize, &avail);

return YCPInteger (size);
}
@@ -330,14 +331,32 @@
YCPInteger
PkgModuleFunctions::TargetUsed (const YCPString& dir)
{
- long long used, size, bsize;
- get_disk_stats (dir->value().c_str(), &used, &size, &bsize);
+ long long used, size, bsize, avail;
+ get_disk_stats (dir->value().c_str(), &used, &size, &bsize, &avail);

return YCPInteger (used);
}

/** ------------------------
*
+ * @builtin TargetAvailable
+ *
+ * @short Return free space for non-root user (use Pkg::TargetCapacity(dir) - Pkg::TargetUsed(dir) to get free space including the space reserved for root user).
+ * @param string directory
+ * @return integer
+ *
+ */
+YCPInteger
+PkgModuleFunctions::TargetAvailable(const YCPString& dir)
+{
+ long long used, size, bsize, avail;
+ get_disk_stats (dir->value().c_str(), &used, &size, &bsize, &avail);
+
+ return YCPInteger (avail);
+}
+
+/** ------------------------
+ *
* @builtin TargetBlockSize
*
* @short Return block size of partition at directory
@@ -348,8 +367,8 @@
YCPInteger
PkgModuleFunctions::TargetBlockSize (const YCPString& dir)
{
- long long used, size, bsize;
- get_disk_stats (dir->value().c_str(), &used, &size, &bsize);
+ long long used, size, bsize, avail;
+ get_disk_stats (dir->value().c_str(), &used, &size, &bsize, &avail);

return YCPInteger (bsize);
}
@@ -471,7 +490,39 @@
// set the mount points
zypp_ptr()->setPartitions(system);
}
-
+
+YCPMap PkgModuleFunctions::MPS2YCPMap(const zypp::DiskUsageCounter::MountPointSet &mps)
+{
+ YCPMap dirmap;
+
+ // create result data structure from the stored info and calculated disk usage
+ for (zypp::DiskUsageCounter::MountPointSet::const_iterator mpit = mps.begin();
+ mpit != mps.end();
+ mpit++)
+ {
+ YCPList sizelist;
+ // partition size
+ sizelist->add (YCPInteger (mpit->total_size));
+ // already used
+ sizelist->add (YCPInteger (mpit->used_size));
+ // used size after PkgCommit()
+ sizelist->add (YCPInteger (mpit->pkg_size));
+ // readonly flag
+ sizelist->add (YCPInteger (mpit->readonly ? 1 : 0));
+
+ std::string dir = mpit->dir;
+ if (dir.size() > 1 && dir[0] != '/')
+ {
+ dir.insert(dir.begin(), '/');
+ }
+
+ // add the map
+ dirmap->add (YCPString(mpit->dir), sizelist);
+ }
+
+ return dirmap;
+}
+

/** ------------------------
*
@@ -598,7 +649,6 @@
return YCPVoid();
}

-
/** ------------------------
*
* @builtin TargetGetDU
@@ -640,30 +690,7 @@
mps = zypp_ptr()->diskUsage();
}

- // create result data structure from the stored info and calculated disk usage
- for (zypp::DiskUsageCounter::MountPointSet::const_iterator mpit = mps.begin();
- mpit != mps.end();
- mpit++)
- {
- YCPList sizelist;
- // partition size
- sizelist->add (YCPInteger (mpit->total_size));
- // already used
- sizelist->add (YCPInteger (mpit->used_size));
- // used size after PkgCommit()
- sizelist->add (YCPInteger (mpit->pkg_size));
- // readonly flag
- sizelist->add (YCPInteger (mpit->readonly ? 1 : 0));
-
- std::string dir = mpit->dir;
- if (dir.size() > 1 && dir[0] != '/')
- {
- dir.insert(dir.begin(), '/');
- }
-
- // add the map
- dirmap->add (YCPString(mpit->dir), sizelist);
- }
+ dirmap = MPS2YCPMap(mps);
}
catch (...)
{
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-pkg-bindings-2.15.3/VERSION new/yast2-pkg-bindings-2.15.4/VERSION
--- old/yast2-pkg-bindings-2.15.3/VERSION 2007-01-18 13:38:08.000000000 +0100
+++ new/yast2-pkg-bindings-2.15.4/VERSION 2007-01-24 13:00:53.000000000 +0100
@@ -1 +1 @@
-2.15.3
+2.15.4


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread