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 

    # 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 <to-install> node which conatins a list 
of <solvable> nodes for all items to be installed:

  <solvable type="package" name="bash" edition="4.2-51.6.1" arch="x86_64"
            summary="The GNU Bourne-Again Shell">description</solvable>

    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

Reply via email to