You are not logged in.

#1 2018-09-16 15:30:04

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,794
Website

openbsd calendar PKGBUILD critique

So after reading this I found out we don't have this iconic util in our repos and aur, so I had to come up with something...

https://aur.archlinux.org/cgit/aur.git/ … h=calendar

I found the linux patches and code snippets on the Fedora repos. All I did is to put it toghether in a PKGBUILD

Last edited by ugjka (2018-09-16 16:06:13)


https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...

Offline

#2 2018-09-16 16:10:01

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: openbsd calendar PKGBUILD critique

BSD licenses need to be installed to /usr/share/licenses/$pkgname

Also ew, cvs wink but not much to be done about that...

The pkgver() function only tracks the version of calendar.c, not other files that can change, but I don't know if cvs can even fix that. I tried discovering a command to see the max revision count of a directory, with no success... then I tried seeing if I could find the revision count of *all* files and sort them afterwards, using

find . -name CVS -prune -o -type f -exec cvs status {} +

but a bunch of files spat out errors about "cvs server: ostern.c is no longer in the repository"

Then I tried seeing if using \; instead of +, to find each revision count in a separate process, would work -- but I got:

ssh: connect to host anoncvs1.ca.openbsd.org port 22: Connection refused
cvs [status aborted]: end of file from server (consult above messages if any)

Apparently they don't like my trying to experiment with their terrible revision control system. wink


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2018-09-16 16:24:24

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,794
Website

Re: openbsd calendar PKGBUILD critique

Ugh yeah when you browse the https://cvsweb.openbsd.org/src/usr.bin/calendar/ you can see that versions for some files are higher than 1.35. I only did this because that's what fedora guys did.

I'll fix the license issue, though

Edit: found something!

cvs -q status -R . | grep 'Working revision:' | awk '{ print $3; }'

^ that will print revisions for all files, now I need to sort it pick the highest

Last edited by ugjka (2018-09-16 16:33:13)


https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...

Offline

#4 2018-09-16 16:40:23

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

Re: openbsd calendar PKGBUILD critique

I'm looking at the pkgver function - and I can't get that command to run at all.  First it seems inetutils shouls be a depends/makedepends ... unless there is a different 'rsh' that is needed.  Without inetutils:

$ cvs status calendar.c
cvs [status aborted]: cannot exec rsh: No such file or directory
cvs [status aborted]: end of file from server (consult above messages if any)

But with inetutils installed that command seems to hang indefinitely (or is it expected to take more than 10s or so?)

I wanted to test it as you should be able to get the status from all files and just use the highest version number.

And in any case, never pipe grep to awk, just use awk:

cvs status calendar.c | awk '/Working revision:/ { print $3; }'

EDIT: for your edit, you are now getting all the versions, but there is still no need for grep, and definitely no need for sort:

... | awk '/Working revision:/ { if ($3 > n) n = $3;} END { print n; }'

Though the cvs command is still just hanging indefinitely for me.

Last edited by Trilby (2018-09-16 16:48:02)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2018-09-16 17:01:06

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,794
Website

Re: openbsd calendar PKGBUILD critique

Trilby you need this apparenly

CVS_RSH=ssh ; export CVS_RSH

Edit: I took your advice trilby regarding awk

Looks like I'm done, I'm getting the correct version and LICENSE is added

Last edited by ugjka (2018-09-16 17:06:27)


https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...

Offline

#6 2018-09-16 17:11:23

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,794
Website

Re: openbsd calendar PKGBUILD critique

OK FACEPALM 1.9 is not greater than 1.32

Edit:

This

cvs -q status -R . | awk '/Working revision:/ { print $3; }' | sort -uV | tail -n 1

sort -V does version number sorting

Last edited by ugjka (2018-09-16 17:28:56)


https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...

Offline

#7 2018-09-16 17:38:11

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: openbsd calendar PKGBUILD critique

Not sure if awk has a way to compare numbers as though they are versions rather than assuming a trailing 0 for "1.90"

pacman-contrib's pacsort implements this though. big_smile
EDIT: or yeah, sort -V

Last edited by eschwartz (2018-09-16 17:38:50)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#8 2018-09-16 19:06:09

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

Re: openbsd calendar PKGBUILD critique

Oops.  This could be done in awk, but not trivially, so it's probably not worth it.  `sort -V` looks good.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#9 2018-09-16 19:26:11

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,463

Re: openbsd calendar PKGBUILD critique

Some quick observations.

You should be downloading to $SRCDEST then copying to $srcdir, not downloading directly to $srcdir.
Indentation issues in lines 32-38
Inconsistent use of of curly braces on variables
Variables you don't control could contain spaces. Need to use quotes.

Offline

#10 2018-09-17 14:11:20

ugjka
Member
From: Latvia
Registered: 2014-04-01
Posts: 1,794
Website

Re: openbsd calendar PKGBUILD critique

@Scimmia took your advice

@everyone_else
I completely overhauled the version thing. There is a big problem with cvs: each file's revision is independent, there is no global revision. A file with lower revision could be newer than a file with high revision. So I can't really use it. I realized it after looking at the dates and revisions on their web cvs thing.

but I discovered the "cvs log" command where you can find dates for all changes and figured I'd use that

What I came up with is to use the release tag version as a base for pkgver (6.3 in this case) and add the latest date when a change had happenned. I  used awk totally for this, no sort and stuff, yay.

Edit: some obsd guy kindly informed they don't have any kind versioning for apps that are in their "base", the whole "base" gets upgraded at once

Last edited by ugjka (2018-09-17 17:30:02)


https://ugjka.net
paru > yay | webcord > discord
pacman -S spotify-launcher
mount /dev/disk/by-...

Offline

Board footer

Powered by FluxBB