How to download source package using Zypper

Hello everyone,
I would like to download source package, a SRPM, for kernel-vanilla-6.14~rc6-1.1.g5af2a0b.rpm. I’m hoping to find kernel-vanilla-6.14~rc6-1.1.g5af2a0b.src.rpm. I would like to try to patch that package and build it myself.

The binary package is coming from this Factory repository,
https://download.opensuse.org/repositories/Kernel:/HEAD/standard/
with the latest vanilla kernel builds. Binary package installs and works well.
Now, how to find the relevant source package.

One option is to use browser and simply search the repo.
I didn’t find kernel-vanilla-6.14~rc6-1.1.g5af2a0b.src.rpm there.
Closest I got was kernel-source-6.14~rc6-1.1.g5af2a0b.src.rpm(0.1 GB) in
https://download.opensuse.org/repositories/Kernel:/HEAD/standard/src/
…or kernel-source-vanilla-6.14~rc6-1.1.g5af2a0b.noarch.rpm (0.2 GB)
under https://download.opensuse.org/repositories/Kernel:/HEAD/standard/noarch/.

Wouldn’t using zypper be more straightforward?

Well, so far it was a total flop :frowning:

One can download source package using:

sudo zypper si kernel-vanilla=6.14~rc6-1.1.g5af2a0b

That “worked”. Unfortunately, I have no clue what it really did.
It seems to leave no trace in the file system. Hmm.

Another try, this time using --download-only:

sudo zypper source-install --download-only --verbose  kernel-vanilla=6.14~rc6-1.1.g5af2a0b
...
Backend:  classic_rpmtrans --download-only
Continue? [y/n/v/...? shows all options] (y): y
Retrieving: kernel-vanilla-6.14~rc6-1.1.g5af2a0b.src (Kernel builds for branch master (standard))                                                  (1/1),   1.7 MiB    
Retrieving: kernel-vanilla-6.14~rc6-1.1.g5af2a0b.nosrc.rpm ......................[done (3.3 MiB/s)]

Where and what it really downloaded?
1.7 MiB that’s too small.

Zypper official manual SDB:Zypper manual (plain) - openSUSE Wiki
mentions, quoting: …downloaded packages will be available in /var/cache/zypper/RPMS. Well, /var/cache/zypper doesn’t even exist.

I found this:
/var/cache/zypp/packages/Kernel_HEAD/nosrc/kernel-vanilla-6.14~rc6-1.1.g5af2a0b.nosrc.rpm
It has the 1.7 MiB size. But what it really is?

Any help is appreciated!

The kernel-vanilla.rpm is build with the kernel-source package.
So download the kernel-source.src.rpm and rebuild it.

https://download.opensuse.org/repositories/Kernel:/HEAD/standard/src/kernel-syms-6.14~rc6-1.1.g5af2a0b.src.rpm
https://download.opensuse.org/repositories/Kernel:/HEAD/standard/src/kernel-source-6.14~rc6-1.1.g5af2a0b.src.rpm

1 Like

I build packages as user in my /home directory, so you can set it up with:

mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
echo '%_tmppath %{_topdir}/tmp' >> ~/.rpmmacros

All executed as User,
SRPMS is the directory for the build src.rpms
RPM is the directory for the to install packages (installation as root) after building without errors
SPEC is the directory for the spec-file
SOURCES is the directory for all sources, patches and more.

So download the src.rpm and execute as User:
rpmbuild --rebuild XXXXX.src.rpm
If no errors it will build and you get the XXXXX.rpm in the RPMS directory.
If it fails rpmbuild will have unzipped the sources to the SOURCES directory, the spec file to the SPEC directory.
After you have corrected the error, goto the SPEC directory and execute as user:
rpmbuild -ba XXXXX.spec
see man rpmbuild or rpmbuild --help for more info.

1 Like

/var/cache/zypp/packages

Awesome help guys!

What about the patches?
I need to place them somewhere before the rpmbuild --rebuild, don’t I?

FYI: There are the two patches I would like to apply:

This is an entirely different question. Start new topic in the Programming/Scripting category.

Download it and execute in the directory where the src.rpm ist stored as User (important):

rpm -i ./XXXX.src.rpm

That will unzip and store the sources to the rmpbuild/SOURCES directory and the spec-file to the rpmbuild/SPEC directory.

Now you can add the patches.

And build it with rpmbuild -ba xxxx.spec
see rpm --help for more help.

I’ve created a new thread about how to build kernel RPM from SRPM:

@Sauerland, Please, I would still need some help.