Bug 911658

Summary: Enhancement: script for updating repository uris
Product: [openSUSE] openSUSE Distribution Reporter: Geoff Kuenning <geoff>
Component: libzyppAssignee: E-mail List <zypp-maintainers>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Enhancement    
Priority: P5 - None    
Version: 13.2   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: Bash script to update zypper repository lists

Description Geoff Kuenning 2015-01-05 10:19:23 UTC
Created attachment 618607 [details]
Bash script to update zypper repository lists

I wrote the attached script quite a while ago, but only just now (duh!) realized it should be part of the distro.

The script, which I call zyppversion, simply generates shell commands that will rewrite a repository list to reference a new release.  For example, "zyppversion -d 13.1 13.2" will change a 13.1 system to refer to 13.2.  So if you don't encounter any zypper glitches, you can upgrade your 13.1 system to 13.2 as follows:

zypper patch -l
zypper update -l
zyppversion -d 13.1 13.2 | sh
zypper dup -l

Two things you might wish to change about the script: (1) perhaps -d should be the default, and (2) you might want to pipe the output directly to zypper rather than requiring it of the user.  Those are up to you.

(BTW, it would be nice if zypper generated pipeable output, at least as an option.  The "sed 1,2d" is a horribly ugly and fragile hack--and some of my other zypper pipes are even more fragile.)
Comment 1 Michael Andres 2015-01-12 09:49:40 UTC
> $ cat /etc/zypp/repos.d/packman.repo
> [packman]
> name=packman
> baseurl=http://ftp.gwdg.de/pub/linux/packman/suse/$releasever
> type=rpm-md
> enabled=1
> autorefresh=1

Zypp already supports variable substitution in the repository URL. '$releasever' is replaced by the distro version as defined in /etc/products.d/baseproduct (tag: product/version).

(not officially supported, but it's possible to edit the version field in /etc/products.d/baseproduct and then call 'zypper dup').


The missing piece is providing means to override the value found in /etc/products.d/baseproduct. It's probably easy to introduce some environment variable for this (this way it can be used with zypper as well as with yast)

> $ zypper lr packman | grep ^URI
> URI            : http://ftp.gwdg.de/pub/linux/packman/suse/13.1
> $ export ZYPP_REPO_RELEASEVER=13.2
> $ zypper lr packman | grep ^URI
> URI            : http://ftp.gwdg.de/pub/linux/packman/suse/13.2
> $ zypper dup 
> ....upgrades to 13.2...

I'd prefer this approach over the script.
Comment 2 Michael Andres 2015-01-12 10:07:19 UTC
> name=packman for $releasever

JFYI: $releasever can be used within the 'name=' as well
Comment 3 Geoff Kuenning 2015-01-12 10:15:52 UTC
I appreciate the improvements to my idea.  I was confident that it could be done better.

But I also think the last couple of comments highlight a serious--nay, life-threatening--ongoing problem with OpenSUSE: abysmal documentation.  Were any of these features ever publicized in any fashion whatsoever?  Or is this yet one more case of "I implemented it; it's up to the users to read the code and find out that the feture exists."

I know for certain that the instructions for "how to upgrade" never mentioned this approach; otherwise I never would have written the script in the first place.

I think one of my standard .signature lines is appropriate here:

> An undocumented program is as useless as a non-working one.

If SuSE ever wants to rise to its potential, it needs to start taking documentation seriously.  NOTHING SuSE-developed should *ever* be released without full, complete, thorough documentation.  (Wicked, your name is being called...)
Comment 4 Michael Andres 2015-01-14 09:43:16 UTC
(In reply to Geoff Kuenning from comment #3)
> I know for certain that the instructions for "how to upgrade" never
> mentioned this approach; otherwise I never would have written the script in
> the first place.

I should not have mentioned this :(

Of course no official instruction will suggest to manually edit the installed products data. This fakes the installed products version, pretending the product update has already been performed. This impacts dependency resoulution (but I know it usually works if immediately followed by a 'zypper dup' and the dup succeeds...). This is NOT A FEATURE!

---
But your request led to a new zypper feature. zypper-1.11.20 will support 

> --releasever version
>     Set the value of the $releasever variable in all .repo files (default: current distribution
>     version). This can be used to switch to new distribution repositories when performing a
>     distribution upgrade. See section Repository Management and the dist-upgrade (dup) command for
>     details.

That's the correct way for setting the $releasever variable (and will be documented in the zypper man page).
Comment 5 Michael Andres 2015-01-15 10:38:54 UTC
submitted zypper-1.11.20 for online update
Comment 6 Swamp Workflow Management 2015-03-06 13:06:31 UTC
openSUSE-RU-2015:0443-1: An update that has 7 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 828631,896224,909143,909244,909772,911335,911658
CVE References: 
Sources used:
openSUSE 13.2 (src):    libsolv-0.6.8-6.1, libzypp-14.36.0-18.1, zypper-1.11.22-15.1
Comment 7 Swamp Workflow Management 2015-07-02 16:10:35 UTC
SUSE-RU-2015:1175-1: An update that solves one vulnerability and has 45 fixes is now available.

Category: recommended (moderate)
Bug References: 725867,820693,828631,832519,848054,892431,893294,896224,897301,899510,899603,899781,899907,901590,901691,903405,903675,904737,906549,908135,908345,908976,909143,909244,909772,911335,911658,914258,914284,915461,915928,916254,919709,921332,922352,923800,925678,925696,927319,929483,929528,929593,929990,931601,932393,933277
CVE References: CVE-2014-3566
Sources used:
SUSE Linux Enterprise Workstation Extension 12 (src):    PackageKit-0.8.16-11.15
SUSE Linux Enterprise Software Development Kit 12 (src):    PackageKit-0.8.16-11.15, libsolv-0.6.11-8.1, libyui-ncurses-pkg-2.46.1-3.4, libyui-qt-pkg-2.44.7-3.2, libzypp-14.39.0-10.1, libzypp-bindings-0.6.4-5.3
SUSE Linux Enterprise Server 12 (src):    PackageKit-0.8.16-11.15, gnome-packagekit-3.10.1-8.13, libsolv-0.6.11-8.1, libyui-ncurses-pkg-2.46.1-3.4, libyui-qt-pkg-2.44.7-3.2, libzypp-14.39.0-10.1, libzypp-bindings-0.6.4-5.3, yast2-pkg-bindings-3.1.20-3.3, zypper-1.11.32-8.1
SUSE Linux Enterprise Desktop 12 (src):    PackageKit-0.8.16-11.15, gnome-packagekit-3.10.1-8.13, libsolv-0.6.11-8.1, libyui-ncurses-pkg-2.46.1-3.4, libyui-qt-pkg-2.44.7-3.2, libzypp-14.39.0-10.1, libzypp-bindings-0.6.4-5.3, yast2-pkg-bindings-3.1.20-3.3, zypper-1.11.32-8.1