Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository?

  1. #1

    Default Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository?

    Hi, As I'm new to OpenSUSE, before this I used Arch Linux. In Arch I used PAMAC and paccache to control how much version of cached packages will be kept in cache. So if I set it to 1, I would have only latest version of any specific package(say Firefox).
    Now I'm looking for any zypper command or configuration to do so in OpenSUSE but I'm unable get any news about that. Please guide me if there is any tool to do so.

    Note: I'm even unaware that how much cache version zypper keep by default.

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,996

    Default Re: Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository

    I am not sure I understand your question complete (pointing to what another operating system/distro might have for features may only help those that used it beside using openSUSE and it is always a bit tricky to assume that something you experienced in another distro will have a 100% equivalent), but according to
    Code:
    man zypper
    you can switch caching for a repo on/off. Normally it is off. When switched on, I assume only the last installed version of a package is kept.
    Henk van Velden

  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,130
    Blog Entries
    2

    Default Re: Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository

    First,
    For details, I'd also recommend the zypper MAN pages for detailed documentation, and if you have follow up questions, post your question...

    For what your'e asking,
    We don't really lock at the repo level, and caching happens pretty much automatically as part of any action you take... for example, when you download a package for installation, then the package is cached and not immediately removed after installation.

    But if you want to lock a particular application version, the the lock is done at the package level.
    Although the zypper MAN pages describes how to do this using the CLI,
    You might also at least as easily do this using the YaST Software Manager...
    First, you search for the package in question, verify it's installed and read the version of the application.
    You then also have the option to lock the package with a few clicks.

    All very intuitive and shouldn't require any documentation but if you have troubles locking your package using zypper or YaST, just provide details what you tried and what you see instead of what you expected.

    TSU
    Beginner Wiki Quickstart - https://en.opensuse.org/User:Tsu2/Quickstart_Wiki
    Solved a problem recently? Create a wiki page for future personal reference!
    Learn something new?
    Attended a computing event?
    Post and Share!

  4. #4
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,493
    Blog Entries
    3

    Default Re: Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository

    Quote Originally Posted by hcvv View Post
    you can switch caching for a repo on/off. Normally it is off. When switched on, I assume only the last installed version of a package is kept.
    No, they are all kept.

    I occasionally run the command:
    Code:
    find . -name '*rpm' -atime +14 -print0 | xargs -0 rm -f
    to delete older kept packages (older than 14 days).
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,996

    Default Re: Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository

    Hm, I looked there and could only find some administrative files, no RPMs. Thus my conclusion
    seems to be wrong.
    I guess (but the OP is not very clear about his goal) that he wants to know if the install of a newer version will then delete the RPM of the older version in the cache.
    Henk van Velden

  6. #6
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,493
    Blog Entries
    3

    Default Re: Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository

    Quote Originally Posted by hcvv View Post
    I guess (but the OP is not very clear about his goal) that he wants to know if the install of a newer version will then delete the RPM of the older version in the cache.
    Looking in my cache, I see:
    Code:
    ls -l zypper*    
    -rw-r--r-- 1 root root 1327608 Jun 15 10:06 zypper-1.14.5-1.2.x86_64.rpm
    -rw-r--r-- 1 root root 1335536 Jun 23 20:17 zypper-1.14.6-1.1.x86_64.rpm
    and
    Code:
    ls -l xdg-desktop-portal-kde*
    -rw-r--r-- 1 root root 100892 Jun 15 11:11 xdg-desktop-portal-kde-5.12.90-1.3.x86_64.rpm
    -rw-r--r-- 1 root root 101092 Jun 17 13:52 xdg-desktop-portal-kde-5.13.0-1.1.x86_64.rpm
    -rw-r--r-- 1 root root 101336 Jun 22 13:28 xdg-desktop-portal-kde-5.13.1-1.1.x86_64.rpm
    -rw-r--r-- 1 root root 101404 Jun 27 15:46 xdg-desktop-portal-kde-5.13.1-1.2.x86_64.rpm
    -rw-r--r-- 1 root root 101688 Jun 30 13:42 xdg-desktop-portal-kde-5.13.2-1.1.x86_64.rpm
    -rw-r--r-- 1 root root 135224 Jul 11 11:29 xdg-desktop-portal-kde-5.13.2-2.1.x86_64.rpm
    No, the older version is not deleted. That's why I manually delete older rpm files when the total size of the cache gets a bit big.

    Code:
    du -h
    5.1G    .
    That's for the Tumbleweed OSS repo. When it grows to more than 10G, I'll do some cleaning up.

    Maybe I should comment on why I keep these. I'm following a suggestion by Carlos, a few years ago. With the aid of some symbolic links, the package cache is actually on an NFS server. I have more than one system running Tumbleweed. The first that I update will download the new packages. Others will use the already downloaded copy. This reduces network load and increases update speed. (I do much the same with Leap 15.0).
    openSUSE Leap 15.1; KDE Plasma 5;
    testing Leap 15.2Alpha

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,996

    Default Re: Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository

    I understand. You have a reason to cache them, thus you switched keep-packages on. The default is: off (what I have and that explains why my caches are empty)..

    Now back to the OP. As he does not explain why he wants this, I am still not sure if he wants to keep the cache as small as possible (where the default would serve him well) or if he indeed wants the last version of every package kept for a reason like you have.

    Oh, when all people understood: Describe the goal, not the step
    Henk van Velden

  8. #8

    Default Re: Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository

    Quote Originally Posted by nrickert View Post
    Looking in my cache, I see:
    Code:
    ls -l zypper*    
    -rw-r--r-- 1 root root 1327608 Jun 15 10:06 zypper-1.14.5-1.2.x86_64.rpm
    -rw-r--r-- 1 root root 1335536 Jun 23 20:17 zypper-1.14.6-1.1.x86_64.rpm
    and
    Code:
    ls -l xdg-desktop-portal-kde*
    -rw-r--r-- 1 root root 100892 Jun 15 11:11 xdg-desktop-portal-kde-5.12.90-1.3.x86_64.rpm
    -rw-r--r-- 1 root root 101092 Jun 17 13:52 xdg-desktop-portal-kde-5.13.0-1.1.x86_64.rpm
    -rw-r--r-- 1 root root 101336 Jun 22 13:28 xdg-desktop-portal-kde-5.13.1-1.1.x86_64.rpm
    -rw-r--r-- 1 root root 101404 Jun 27 15:46 xdg-desktop-portal-kde-5.13.1-1.2.x86_64.rpm
    -rw-r--r-- 1 root root 101688 Jun 30 13:42 xdg-desktop-portal-kde-5.13.2-1.1.x86_64.rpm
    -rw-r--r-- 1 root root 135224 Jul 11 11:29 xdg-desktop-portal-kde-5.13.2-2.1.x86_64.rpm
    No, the older version is not deleted. That's why I manually delete older rpm files when the total size of the cache gets a bit big.

    Code:
    du -h
    5.1G    .
    That's for the Tumbleweed OSS repo. When it grows to more than 10G, I'll do some cleaning up.

    Maybe I should comment on why I keep these. I'm following a suggestion by Carlos, a few years ago. With the aid of some symbolic links, the package cache is actually on an NFS server. I have more than one system running Tumbleweed. The first that I update will download the new packages. Others will use the already downloaded copy. This reduces network load and increases update speed. (I do much the same with Leap 15.0).
    Thank You and all other, at least it is cleared that zypper would keep all of the packages, older versions. I got only solution in mind is to script down this problem, compare files and remove older version(By the way, looking a bit problematic since there is no exact way of writing files names and version inside filename.)

    The cache reason is simple to make it quick and fast to reinstall. I don't want to sit down again and look at screen for half an hour and more waiting for packages being updated.

  9. #9
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,702

    Default Re: Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository

    I don't want to sit down again and look at screen for half an hour and more waiting for packages being updated.
    Why would you need to do that??

  10. #10

    Default Re: Zypper, How to keep exactly only one version of any downloaded(cached) package of any repository

    Quote Originally Posted by nrickert View Post
    No, they are all kept.

    I occasionally run the command:
    Code:
    find . -name '*rpm' -atime +14 -print0 | xargs -0 rm -f
    to delete older kept packages (older than 14 days).
    Hi,

    Might as well use the absolute default path where the rpm's are instead of using the current directory.

    Code:
    /var/cache/zypp*
    Yes the glob is not quoted so the directory expands to both zypp and zypper.

    Running
    Code:
    echo /var/cache/zypp*
    Should give you both directories
    Code:
    /var/cache/zypp /var/cache/zypper
    Just my 2 cents.
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •