pfr I've noticed that the FreeBSD port has py-setuptools also.. Does this also need to be added or is it covered by that egg.mk?

setuptools is redundant here, I think--it's used for standalone python pkg. mgmt. Somebody correct me.
EDIT: correcting myself: setuptools is needed for building ueberzug; not needed afterwards (ie. for running it).

pfr it's not so much adding the patches but finding the patches. Where are they?

Follow the links marked SVNWeb or git in Description on the Freshports page--just like @pin did.

  • pfr replied to this.
  • pfr likes this.

    I need to give this another go. I was mid-semester during my principles of distributed computing class, and that was just time consuming so I didnt get to dedicate as much time playing around with pkgsrc. Definitely keep documenting your progress and what you learn! Ill be done with this session of classes soon and able to play again. So anything you can share, Ill definitely be looking at it!

    pfr Do these patches need tweaking for NetBSD or will they do as they are?

    You should be able to use the same patches if you use the same version as FreeBSD. A newer version might need different patches because the code has changed.

    • pin replied to this.

      rvp A newer version might need different patches because the code has changed.

      And this is the painfull part of maintaing patches ๐Ÿ˜‰

      • rvp replied to this.
      • pfr likes this.

        pin Yah--Another headache is what I term "patrolling"--keeping an eye on the various websites/mailing-lists/whatever to see if new versions have dropped; then judging if the new versions merit a new package or should be skipped... Our friend will learn all this in due course.

        @pfr: if you get a taste for this, tell me. I have another thing lined up for you to package (I've done the NetBSD-related work already; just got to do the FreeBSD stuff, then send it upstream). It's something you've already requested... but I'll keep it as a surprise for the time being.

        it primarily matters that stuff in pkgsrc works, not that it's the freshest version, especially when it's a leaf package and not security critical.

        of course, this wouldn't matter if the freshest software always worked and didn't introduce incompatibilities and portability sins.

        Coolio, thanks everyone. I have been super busy lately so no progress on this. I did start this on the latest release v18.1.9 whereas the FreeBSD ports are still on v18.1.8.

        Obviously waiting for the package, along with the patches, to be updated on FreeBSD ports would make it a little easier.
        When I get time though, I will look at the patches in detail and see if the patches will need changes, if so hopefully only the line numbers. Probably wise that I actually understand what the patches do hey ๐Ÿ˜‰

        • Jay likes this.

        pfr Use mkpatches from pkgtools/pkgdiff to regenerate the patch files from the patched sources. You're gonna need to learn to use it at some point if you're doing pkgsrc - I assure you it's much easier than how other package managers deal with patches ๐Ÿ™‚

          pfr So I couldn't get it to work with the lates version

          Try this (a minor update was needed):

          diff -urN ueberzug-18.1.9.orig/Xshm/Xshm.c ueberzug-18.1.9/Xshm/Xshm.c
          --- ueberzug-18.1.9.orig/Xshm/Xshm.c	2021-01-09 11:39:14.000000000 +0000
          +++ ueberzug-18.1.9/Xshm/Xshm.c	2021-06-22 07:39:45.134536810 +0000
          @@ -67,9 +67,6 @@
           
               if (self->segmentInfo.shmaddr != INVALID_SHM_ADDRESS) {
                   self->segmentInfo.readOnly = true;
          -        // Mark the shared memory segment for removal
          -        // It will be removed even if this program crashes
          -        shmctl(self->segmentInfo.shmid, IPC_RMID, 0);
                   return true;
               }
           
          @@ -111,6 +108,7 @@
           Image_free_shared_memory(Image *self) {
               if(self->segmentInfo.shmaddr != INVALID_SHM_ADDRESS) {
                   shmdt(self->segmentInfo.shmaddr);
          +        shmctl(self->segmentInfo.shmid, IPC_RMID, 0);
                   self->segmentInfo.shmaddr = INVALID_SHM_ADDRESS;
               }
           }
          diff -urN ueberzug-18.1.9.orig/examples/fzfimg.sh ueberzug-18.1.9/examples/fzfimg.sh
          --- ueberzug-18.1.9.orig/examples/fzfimg.sh	2021-01-09 11:39:14.000000000 +0000
          +++ ueberzug-18.1.9/examples/fzfimg.sh	2021-06-22 07:39:45.135089990 +0000
          @@ -18,7 +18,7 @@
           readonly REDRAW_COMMAND="toggle-preview+toggle-preview"
           readonly REDRAW_KEY="ยต"
           declare -r -x DEFAULT_PREVIEW_POSITION="right"
          -declare -r -x UEBERZUG_FIFO="$(mktemp --dry-run --suffix "fzf-$$-ueberzug")"
          +declare -r -x UEBERZUG_FIFO="$(T="$(mktemp -t fzf-$$-ueberzug)"; rm -f "$T"; echo "$T")"
           declare -r -x PREVIEW_ID="preview"
           
           
          diff -urN ueberzug-18.1.9.orig/ueberzug/query_windows.py ueberzug-18.1.9/ueberzug/query_windows.py
          --- ueberzug-18.1.9.orig/ueberzug/query_windows.py	2021-01-09 11:39:14.000000000 +0000
          +++ ueberzug-18.1.9/ueberzug/query_windows.py	2021-06-22 07:39:45.135911143 +0000
          @@ -2,6 +2,7 @@
           import signal
           import errno
           
          +import psutil
           
           def get_command(pid):
               """Figures out the associated command name
          @@ -13,8 +14,7 @@
               Returns:
                   str: the associated command name
               """
          -    with open('/proc/{}/comm'.format(pid), 'r') as commfile:
          -        return '\n'.join(commfile.readlines())
          +    psutil.Process(pid=pid).name()
           
           
           def is_same_command(pid0, pid1):
          diff -urN ueberzug-18.1.9.orig/ueberzug/xutil.py ueberzug-18.1.9/ueberzug/xutil.py
          --- ueberzug-18.1.9.orig/ueberzug/xutil.py	2021-01-09 11:39:14.000000000 +0000
          +++ ueberzug-18.1.9/ueberzug/xutil.py	2021-06-22 07:40:05.091510744 +0000
          @@ -1,6 +1,7 @@
           """This module contains x11 utils"""
           import functools
           import asyncio
          +import psutil
           
           import Xlib
           import Xlib.display as Xdisplay
          @@ -144,9 +145,9 @@
               the first process in the passed list which owns one.
               """
               for pid in pids:
          -        pty_slave_file = process.get_pty_slave(pid)
          -        if pty_slave_file:
          -            return pty_slave_file
          +        process = psutil.Process(pid=pid)
          +        if process is not None and process.terminal() is not None:
          +            return process.terminal()
           
               return None

            nia Thanks. Yes, I did use mkpatches after manually editing each file. Now I have the patch files that were auto generated with mkpatches

            rvp Thanks buddy, this worked. I did as @nia suggested and used mkpatches after manually editing each file.

            I know I did this the hard way. How could I patch all these files at once using patch ?

            Thanks.

            Proof that it works:

            The next step I suppose it pushing it to pkgsrc/wip ?

            I'll try and package ytfzf as well ๐Ÿ‘๏ธ

              pfr Nice! Minor nitpick...
              On your Makefile,

              # $NetBSD$
              
              GITHUB_PROJECT= ueberzug
              GITHUB_TAG= refs/tags/18.1.9
              DISTNAME=   18.1.9
              PKGNAME=    ${GITHUB_PROJECT}-${DISTNAME}
              CATEGORIES= local
              MASTER_SITES=   ${MASTER_SITE_GITHUB:=seebye/}
              DIST_SUBDIR=    ${GITHUB_PROJECT}# $NetBSD$

              this can be simplified to the following,

              # $NetBSD$
              
              DISTNAME=	ueberzug-18.1.9
              CATEGORIES=	graphics
              MASTER_SITES=	${MASTER_SITE_GITHUB:=seebye/}

              Also, this might actually be more correct as a py-pkg.

              • pfr replied to this.
              • Jay likes this.

                pin pkglint doesn't like that?

                $ pkglint -e
                WARN: Makefile:4: The primary category should be "local", not "graphics".
                
                        The primary category of a package should be its location in the
                        pkgsrc directory tree, to make it easy to find the package. All
                        other categories may be added after this primary category.
                
                1 warning found.
                • pin replied to this.

                  pfr Always run pkglint -F before running pkglint -e

                  As for WARN: Makefile:4: The primary category should be "local", not "graphics".
                  This has to do with your build environment, there's no such thing as local for official packages.

                    @pfr Oh c'mon, you keep editing your post and my replies get out of sync.

                    • pfr replied to this.
                    • pfr likes this.

                      pfr How could I patch all these files at once using patch ?

                      Check the patch first:

                      $ tar -xf /some/path/ueberzug-18.1.9.tar.gz
                      $ ls
                      ueberzug-18.1.9/
                      $ patch -C -p0 < /tmp/ueberzug-18.1.9.patch

                      If there are no errors, apply the patch for real:

                      $ patch -p0 -V none < /tmp/ueberzug-18.1.9.patch

                      You can also cd ueberzug-18.1.9 and apply the same patch from there, but then, you'll have to strip one path component from the file paths in the patch file:

                      $ cd ueberzug-18.1.9
                      $ patch -p1 -V none < /tmp/ueberzug-18.1.9.patch

                      You can also use -p2 and strip 2 components, but, for that to work, you'll have to:

                      a) split the patch file itself into 3 or 4 pieces (one for each directory, or, one for each file to be patched, resp.,), and
                      b) cd into each of the directories in turn and apply the correct patch fragments in each.