You are not logged in.

#1 2024-05-14 10:18:30

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,085

[Solved] increasing pkgrel from cli

I build -git packages rather often. To ensure they are build against the latest version of their deps I increase the pkgrel by 1 before starting build .

This goes like follows (from within the directory the PKGBUILD resides in)

nano PKGBUILD
adjust cursor until pkgrel is reached
increase value by 1
save
close

if I was replacing one value with another, sed would be first choice.

Which tools are usable to increase an integer value inside of a file ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#2 2024-05-14 10:23:58

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,543
Website

Re: [Solved] increasing pkgrel from cli

Not used it myself, but 'pkgctl build' has a '--rebuild' flag which claims to do this: https://man.archlinux.org/man/pkgctl-bu … LD_OPTIONS


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2024-05-14 10:40:26

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,085

Re: [Solved] increasing pkgrel from cli

Thanks, but last time I checked pkgctl-build doesn't support custom pacman.conf and/or makepkg.conf.
I use makepkg and graysky' Clean Chroot Manager .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#4 2024-05-14 11:08:02

just4arch
Member
Registered: 2023-01-07
Posts: 126

Re: [Solved] increasing pkgrel from cli

sed -i -r 's/pkgrel=([0-9]+)/echo "pkgrel=$((\1+1))"/ge' PKGBUILD

Stolen and adapted from https://stackoverflow.com/questions/143 … th-sed-awk

Offline

#5 2024-05-14 12:24:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Solved] increasing pkgrel from cli

awk -F= '!/^pkgrel/;/^pkgrel/{print "pkgrel=" $2+1;}' PKGBUILD

Though if you know that pkgrel is never greater than 8, a simpler version could work:

sed '/^pkgrel/y/012345678/123456789/' PKGBUILD

But if you are doing this regularly, I doubt it is safe to assume the pkgrel remains that low.

But this really isn't needed.  Just rebuild the package with makepkg.  What do you think incrementing pkgrel does for you that simply running `makepkg -f` would not?  Contrary to your claim, increasing the pkgrel has no effect on whether or not the package is built against the newest version of the dependencies: it is build against whatever is installed on the build machine completely independent of what the pkgrel is set to.

Last edited by Trilby (2024-05-14 12:55:32)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2024-05-14 13:44:16

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,085

Re: [Solved] increasing pkgrel from cli

What do you think incrementing pkgrel does for you that simply running `makepkg -f` would not? 

A1 = installed version, A2 = new version .

The situation i want to prevent is this :
A has dependencies that have been updated with invasive changes
A upstream has no new commits

using makepkg -f will force a rebuild but not change pkgver / pkgrel . this produces A2 .
A2 is added to custom repo , run pacman -Syu .

A1 and A2 have same pkgver.pkgrel >> pacman sees no reason to upgrade.

increasing pkgrel when I know / strongly suspect dep changes require rebuild is the simplest way to ensure pacman will note the difference between A1 and A2.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#7 2024-05-14 13:47:48

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Solved] increasing pkgrel from cli

Ah yes, increasing the pkgrel is called for here for deploying the package to a repo to be used by others.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2024-05-14 14:55:16

just4arch
Member
Registered: 2023-01-07
Posts: 126

Re: [Solved] increasing pkgrel from cli

Not perfect but maybe helps: rebuild-detector

Offline

#9 2024-05-14 16:24:52

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,085

Re: [Solved] increasing pkgrel from cli

It does help, but detects soname changes .

Some (many ?) projects don't change sonames between releases but do break stuff in trunk.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#10 2024-05-18 20:04:00

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,085

Re: [Solved] increasing pkgrel from cli

The sed command from #4 works, the awk command from #5 outputs the new PKGBUILD content to standard output, but doesn't change the PKGBUILD.

But if you are doing this regularly, I doubt it is safe to assume the pkgrel remains that low.

correct, at one time pkgrel was 12 for one of those packages.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#11 2024-05-18 20:20:32

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Solved] increasing pkgrel from cli

Lone_Wolf wrote:

the awk command from #5 outputs the new PKGBUILD content to standard output, but doesn't change the PKGBUILD.

Well of course not - that's how awk and sed work.  Sed has the -i flag which just outputs to a temporary file then moves the file back in place all behind the scenes.  Allegedly, gnu's awk can have a similar behavior with the "-i inplace" passed on the command line - or you could just move the new content into place as a separate step:

awk -F= '!/^pkgrel/;/^pkgrel/{print "pkgrel=" $2+1;}' PKGBUILD > tmp
mv tmp PKGBUILD

# or, only with gnu's awk:

awk -i inplace -F= '!/^pkgrel/;/^pkgrel/{print "pkgrel=" $2+1;}' PKGBUILD

"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

Board footer

Powered by FluxBB