Re: [zypp-devel] resolving dependency chain of named installed packages

2013-04-11 Thread Olaf Hering
On Thu, Apr 11, Olaf Hering wrote:

> env -u LANG LC_ALL=C zypper \
> --root $PWD/tmp/root \
> --reposd-dir /etc/zypp/repos.d \
> --cache-dir tmp/cache-dir \
> --pkg-cache-dir tmp/pkg_cache_dir \
> --gpg-auto-import-keys \
> --non-interactive \
> --xml \
> install \
> --auto-agree-with-licenses \
> --dry-run \
> bash | awk '/^.solvable/ { print $3}' | cut -f 2 -d '"'

Replacing awk with xmlstarlet works like that:

zypper ... --xml install ... | xml sel -t \
-m "stream/install-summary/to-install/solvable[@type='package']" \
-c "string(@name)" -n

I think using an empty --root is a usable workaround to get the list of
packages.


Olaf
-- 
To unsubscribe, e-mail: zypp-devel+unsubscr...@opensuse.org
To contact the owner, e-mail: zypp-devel+ow...@opensuse.org



Re: [zypp-devel] resolving dependency chain of named installed packages

2013-04-11 Thread Michael Andres
On Thursday 11 April 2013 15:31:13 Olaf Hering wrote:
>
> Is there an easy way to get the same list of packages with just the rpm
> database?

AFAIK not.

-- 

cu,
Michael Andres

+--+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862  27AC 3FB8 9E3A 27C6 B0E4
+--+
Michael Andres   SUSE LINUX Products GmbH, Development,   m...@suse.de
GF:Jeff Hawn,Jennifer Guild,Felix Imendörffer, HRB16746(AG Nürnberg) 
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+--+
--
To unsubscribe, e-mail: zypp-devel+unsubscr...@opensuse.org
To contact the owner, e-mail: zypp-devel+ow...@opensuse.org



Re: [zypp-devel] resolving dependency chain of named installed packages

2013-04-11 Thread Olaf Hering
On Thu, Apr 11, Michael Andres wrote:

> Sorry, but I don't get if you are actually interested in downloading all 
> these 
> rpms, or if it would be sufficient to parse the todo list from zyppers xml 
> output:
> 
> # create an 'empty system' /tmp/foo
> rm -rf /tmp/foo
> mkdir /tmp/foo
> 
> # add your repos to /tmp/foo
> zypper --root /tmp/foo ar \
>   http://download.opensuse.org/distribution/12.2/repo/oss oss
> 
> # install
> zypper --root /tmp/foo --xml install --dry-run bash... 
> 
> Unless you actually installed packages below /tmp/foo, the system there is 
> empty and the xml output contains a  node which conatins a list 
> of  nodes for all items to be installed:
> 
> 
>summary="The GNU Bourne-Again Shell">description
>   ...
> 

Thanks, that goes into the right direction.

I want the reuse the files from installed packages. For this its
required to know what other installed packages 'bash' for example needs.

This way I get to the list I would like to have, with an empty --root:

env -u LANG LC_ALL=C zypper \
--root $PWD/tmp/root \
--reposd-dir /etc/zypp/repos.d \
--cache-dir tmp/cache-dir \
--pkg-cache-dir tmp/pkg_cache_dir \
--gpg-auto-import-keys \
--non-interactive \
--xml \
install \
--auto-agree-with-licenses \
--dry-run \
bash | awk '/^.solvable/ { print $3}' | cut -f 2 -d '"'
bash
bash-doc
bundle-lang-common-en
filesystem
glibc
info
libbz2-1
liblzma5
libncurses5
libreadline6
libzio
ncurses-utils
readline-doc
terminfo-base
zlib


Is there an easy way to get the same list of packages with just the rpm
database?

Olaf
-- 
To unsubscribe, e-mail: zypp-devel+unsubscr...@opensuse.org
To contact the owner, e-mail: zypp-devel+ow...@opensuse.org



Re: [zypp-devel] resolving dependency chain of named installed packages

2013-04-11 Thread Michael Andres
On Wednesday 10 April 2013 18:27:12 Olaf Hering wrote:
> I'm working on zypp supprt for supermin, a helper for libguestfs which
> creates an appliance based on a list of package names. My current
> approach is to download all packages from the repo and pass the filename
> of downloaded rpm packages to the tool for further processing.
>
> It does something like this, which downloads over 100 packages in my
> local 11.4 installation:
>
>   zypper --verbose --verbose --verbose \
> --root $PWD/tmp/root \
> --reposd-dir $PWD/zypp/repos.d \
> --cache-dir tmp//cache-dir \
> --pkg-cache-dir tmp/pkg_cache_dir \
> --gpg-auto-import-keys \
> --non-interactive \
> install \
> --auto-agree-with-licenses \
> --download-only \
> \
> bash kernel-default mkinitrd
>
>
> The next step would be to make use of already installed packages. What I
> would like to have is something like this:
>
>   $new_tool --names bash kernel-default mkinitrd
>
> And the output would the name of rpm packages required for the named
> packages, like the following would produce:
>
>   find tmp/pkg_cache_dir -name "*.rpm" | xargs rpm -qp --qf '%{NAME}\n'
>
> If $new_tool would be able to just download missing dependencies of
> uninstalled packages and list all the remaining installaed packages,
> that would be even better.
>
> How can I achieve this?

Sorry, but I don't get if you are actually interested in downloading all these 
rpms, or if it would be sufficient to parse the todo list from zyppers xml 
output:

# create an 'empty system' /tmp/foo
rm -rf /tmp/foo
mkdir /tmp/foo

# add your repos to /tmp/foo
zypper --root /tmp/foo ar \
http://download.opensuse.org/distribution/12.2/repo/oss oss

# install
zypper --root /tmp/foo --xml install --dry-run bash... 

Unless you actually installed packages below /tmp/foo, the system there is 
empty and the xml output contains a  node which conatins a list 
of  nodes for all items to be installed:


  description
  ...

 
-- 

cu,
Michael Andres

+--+
Key fingerprint = 2DFA 5D73 18B1 E7EF A862  27AC 3FB8 9E3A 27C6 B0E4
+--+
Michael Andres   SUSE LINUX Products GmbH, Development,   m...@suse.de
GF:Jeff Hawn,Jennifer Guild,Felix Imendörffer, HRB16746(AG Nürnberg) 
Maxfeldstrasse 5, D-90409 Nuernberg, Germany, ++49 (0)911 - 740 53-0
+--+
--
To unsubscribe, e-mail: zypp-devel+unsubscr...@opensuse.org
To contact the owner, e-mail: zypp-devel+ow...@opensuse.org



[zypp-devel] resolving dependency chain of named installed packages

2013-04-10 Thread Olaf Hering

I'm working on zypp supprt for supermin, a helper for libguestfs which
creates an appliance based on a list of package names. My current
approach is to download all packages from the repo and pass the filename
of downloaded rpm packages to the tool for further processing.

It does something like this, which downloads over 100 packages in my
local 11.4 installation:

  zypper --verbose --verbose --verbose \
--root $PWD/tmp/root \
--reposd-dir $PWD/zypp/repos.d \
--cache-dir tmp//cache-dir \
--pkg-cache-dir tmp/pkg_cache_dir \
--gpg-auto-import-keys \
--non-interactive \
install \
--auto-agree-with-licenses \
--download-only \
\
bash kernel-default mkinitrd


The next step would be to make use of already installed packages. What I
would like to have is something like this:

  $new_tool --names bash kernel-default mkinitrd

And the output would the name of rpm packages required for the named
packages, like the following would produce:

  find tmp/pkg_cache_dir -name "*.rpm" | xargs rpm -qp --qf '%{NAME}\n'

If $new_tool would be able to just download missing dependencies of
uninstalled packages and list all the remaining installaed packages,
that would be even better.

How can I achieve this?
Is there already example code which can be reused?

Olaf
-- 
To unsubscribe, e-mail: zypp-devel+unsubscr...@opensuse.org
To contact the owner, e-mail: zypp-devel+ow...@opensuse.org