You are not logged in.

#1 2020-11-02 00:05:21

MountainX
Member
Registered: 2016-02-08
Posts: 371

[SOLVED] help fixing PKGBUILD for brother-ql1060n

This package has had a problem for a while:
AUR (en) - brother-ql1060n
I left comments on that page, but no response. Now that I'm learning about PKGBUILD files, I would like to see if I can help fix this package.

The problem happened when the maintainer did this:

I've bumped the version to 1.0.6, please try and verify whether it is working as expected.

He did not test, obviously. I did test, and I told him:

@kbabioch FYI this package is no longer working. It creates a brother-ql1060n-1.0.6r0-1-x86_64.pkg.tar.xz file that is missing the cups filter. Other files appear to be missing too. For example, the path /usr/share/cups/model/ in the package is empty.

I believe Brother has renamed the filter so it no longer matches the pattern lpdwrapper

I don't know if my guess about the problem was correct, but I am willing to put in some time now to see if I can help figure it out (or at least do the testing).

Does anyone have any suggestions to help me understand the problem?

Last edited by MountainX (2020-11-03 05:56:03)

Offline

#2 2020-11-02 17:40:18

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED] help fixing PKGBUILD for brother-ql1060n

From 1.0.5 to 1.0.6 ql1060ncupswrapper-1.0.5-0.i386.rpm became ql1060ncupswrapper-1.0.6-0.i386rpm.tar.gz the rpm being archived inside the .tar.gz.
The rpm contents now needs to be extracted at the start of prepare with something such as:

bsdtar -xf ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm

Offline

#3 2020-11-03 05:02:46

MountainX
Member
Registered: 2016-02-08
Posts: 371

Re: [SOLVED] help fixing PKGBUILD for brother-ql1060n

loqs wrote:

From 1.0.5 to 1.0.6 ql1060ncupswrapper-1.0.5-0.i386.rpm became ql1060ncupswrapper-1.0.6-0.i386rpm.tar.gz the rpm being archived inside the .tar.gz.
The rpm contents now needs to be extracted at the start of prepare with something such as:

bsdtar -xf ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm

Thank you for helping me get started. This is what I used to extract the rpm contents:

bsdtar -xf ql1060ncupswrapper-1.0.6-0.i386rpm.tar.gz ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm

The created package is still missing two important files:
brother-ql1060n W: Directory (usr/lib/cups/filter) is empty
brother-ql1060n W: Directory (usr/share/cups/model) is empty

I stepped through each command in the PKBGUILD prepare() function by hand, and it did generate those files:

└── usr
    ├── bin
    │   ├── brpapertoollpr_ql1060n
    │   ├── brprintconfpt1_ql1060n
    │   └── brps2ps_ql1060n
    ├── lib
    │   └── cups
    │       └── filter
    │           └── brother_lpdwrapper_ql1060n
    └── share
        └── cups
            └── model
                └── brother_ql1060n_printer_en.ppd

I believe what the prepare function is doing is editing the $_wrapper_source file, then executing it. So I guess that when I do this in an interactive shell, the execution succeeds, while it seems to fail in the prepare() function. Any idea why?

The only things I changed were to replace backticks with "$()" to execute stuff. (But running the PKGBUILD with that change produces the same result -- the two files are missing.) I also tried building the package outside of a chroot, but again the two files are still missing.

Full output:

Checking PKGBUILD
PKGBUILD (brother-ql1060n) W: Variable depends is not an array.
Checking brother-ql1060n-1.0.6r0-1-x86_64.pkg.tar.zst
brother-ql1060n E: ELF files outside of a valid path ('opt/').
brother-ql1060n W: ELF file ('opt/brother/PTouch/ql1060n/lpd/brpapertoolcups') lacks FULL RELRO, check LDFLAGS.
brother-ql1060n W: ELF file ('opt/brother/PTouch/ql1060n/lpd/rastertobrpt1') lacks FULL RELRO, check LDFLAGS.
brother-ql1060n W: ELF file ('usr/bin/brpapertoollpr_ql1060n') lacks FULL RELRO, check LDFLAGS.
brother-ql1060n W: ELF file ('usr/bin/brprintconfpt1_ql1060n') lacks FULL RELRO, check LDFLAGS.
brother-ql1060n W: ELF file ('usr/bin/brps2ps_ql1060n') lacks FULL RELRO, check LDFLAGS.
brother-ql1060n W: ELF file ('opt/brother/PTouch/ql1060n/lpd/brpapertoolcups') lacks PIE.
brother-ql1060n W: ELF file ('opt/brother/PTouch/ql1060n/lpd/rastertobrpt1') lacks PIE.
brother-ql1060n W: ELF file ('usr/bin/brpapertoollpr_ql1060n') lacks PIE.
brother-ql1060n W: ELF file ('usr/bin/brprintconfpt1_ql1060n') lacks PIE.
brother-ql1060n W: ELF file ('usr/bin/brps2ps_ql1060n') lacks PIE.
brother-ql1060n W: Directory (usr/lib/cups/filter) is empty
brother-ql1060n W: Directory (usr/share/cups/model) is empty
brother-ql1060n W: Dependency included and not needed ('cups')
pkgver=1.0.6r0
/path/to/packages/trial/brother-ql1060n/brother-ql1060n-1.0.6r0-1-x86_64.pkg.tar.zst
namcap -i /path/to/packages/trial/brother-ql1060n/brother-ql1060n-1.0.6r0-1-x86_64.pkg.tar.zst:
brother-ql1060n E: ELF files outside of a valid path ('opt/').
brother-ql1060n I: ELF file ('opt/brother/PTouch/ql1060n/lpd/brpapertoolcups') outside of a valid path.
brother-ql1060n I: ELF file ('opt/brother/PTouch/ql1060n/lpd/rastertobrpt1') outside of a valid path.
brother-ql1060n W: ELF file ('opt/brother/PTouch/ql1060n/lpd/brpapertoolcups') lacks FULL RELRO, check LDFLAGS.
brother-ql1060n W: ELF file ('opt/brother/PTouch/ql1060n/lpd/rastertobrpt1') lacks FULL RELRO, check LDFLAGS.
brother-ql1060n W: ELF file ('usr/bin/brpapertoollpr_ql1060n') lacks FULL RELRO, check LDFLAGS.
brother-ql1060n W: ELF file ('usr/bin/brprintconfpt1_ql1060n') lacks FULL RELRO, check LDFLAGS.
brother-ql1060n W: ELF file ('usr/bin/brps2ps_ql1060n') lacks FULL RELRO, check LDFLAGS.
brother-ql1060n W: ELF file ('opt/brother/PTouch/ql1060n/lpd/brpapertoolcups') lacks PIE.
brother-ql1060n W: ELF file ('opt/brother/PTouch/ql1060n/lpd/rastertobrpt1') lacks PIE.
brother-ql1060n W: ELF file ('usr/bin/brpapertoollpr_ql1060n') lacks PIE.
brother-ql1060n W: ELF file ('usr/bin/brprintconfpt1_ql1060n') lacks PIE.
brother-ql1060n W: ELF file ('usr/bin/brps2ps_ql1060n') lacks PIE.
brother-ql1060n W: Directory (usr/lib/cups/filter) is empty
brother-ql1060n W: Directory (usr/share/cups/model) is empty
brother-ql1060n I: Script link detected (sh) in file ['opt/brother/PTouch/ql1060n/lpd/filterql1060n', 'opt/brother/PTouch/ql1060n/lpd/psconvertpt1']
brother-ql1060n W: Referenced library 'libc.so.6' is an uninstalled dependency
brother-ql1060n E: Dependency bash detected and not included (programs ['sh'] needed in scripts ['opt/brother/PTouch/ql1060n/lpd/filterql1060n', 'opt/brother/PTouch/ql1060n/lpd/psconvertpt1'])
brother-ql1060n W: Dependency included and not needed ('cups')
brother-ql1060n W: Dependency included and not needed ('lib32-glibc')
brother-ql1060n I: Dependency covered by dependencies from link dependence (libncursesw.so)
brother-ql1060n I: Dependency covered by dependencies from link dependence (ncurses)
brother-ql1060n I: Dependency covered by dependencies from link dependence (iana-etc)
brother-ql1060n I: Dependency covered by dependencies from link dependence (linux-api-headers)
brother-ql1060n I: Dependency covered by dependencies from link dependence (gcc-libs)
brother-ql1060n I: Dependency covered by dependencies from link dependence (glibc)
brother-ql1060n I: Dependency covered by dependencies from link dependence (tzdata)
brother-ql1060n I: Dependency covered by dependencies from link dependence (filesystem)
brother-ql1060n I: Dependency covered by dependencies from link dependence (readline)
brother-ql1060n I: Depends as namcap sees them: depends=(bash)

Last edited by MountainX (2020-11-03 05:15:07)

Offline

#4 2020-11-03 05:32:49

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED] help fixing PKGBUILD for brother-ql1060n

git diff
diff --git a/PKGBUILD b/PKGBUILD
index 9a02e2b..424de9d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -21,6 +21,7 @@ sha256sums=('6111c4b13d8ae7a09d23461643b31f06df5973e1babc7fc3e1ef5cec4ede20b6'
 
 prepare()
 {
+  bsdtar -xf ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm
   #  do not install in '/usr/local'
   if [ -d $srcdir/usr/local/Brother ]; then
     install -d $srcdir/usr/share
pacman -Qlp brother-ql1060n-1.0.6r0-1-x86_64.pkg.tar.zst
brother-ql1060n /opt/
brother-ql1060n /opt/brother/
brother-ql1060n /opt/brother/PTouch/
brother-ql1060n /opt/brother/PTouch/ql1060n/
brother-ql1060n /opt/brother/PTouch/ql1060n/cupswrapper/
brother-ql1060n /opt/brother/PTouch/ql1060n/cupswrapper/brcupsconfpt1
brother-ql1060n /opt/brother/PTouch/ql1060n/inf/
brother-ql1060n /opt/brother/PTouch/ql1060n/inf/ImagingArea
brother-ql1060n /opt/brother/PTouch/ql1060n/inf/brPrintListpt1
brother-ql1060n /opt/brother/PTouch/ql1060n/inf/brql1060nfunc
brother-ql1060n /opt/brother/PTouch/ql1060n/inf/brql1060ninit
brother-ql1060n /opt/brother/PTouch/ql1060n/inf/brql1060nrc
brother-ql1060n /opt/brother/PTouch/ql1060n/inf/paperinfql1060npt1
brother-ql1060n /opt/brother/PTouch/ql1060n/lpd/
brother-ql1060n /opt/brother/PTouch/ql1060n/lpd/brpapertoolcups
brother-ql1060n /opt/brother/PTouch/ql1060n/lpd/filterql1060n
brother-ql1060n /opt/brother/PTouch/ql1060n/lpd/psconvertpt1
brother-ql1060n /opt/brother/PTouch/ql1060n/lpd/rastertobrpt1
brother-ql1060n /usr/
brother-ql1060n /usr/bin/
brother-ql1060n /usr/bin/brpapertoollpr_ql1060n
brother-ql1060n /usr/bin/brprintconfpt1_ql1060n
brother-ql1060n /usr/bin/brps2ps_ql1060n
brother-ql1060n /usr/lib/
brother-ql1060n /usr/lib/cups/
brother-ql1060n /usr/lib/cups/filter/
brother-ql1060n /usr/lib/cups/filter/brother_lpdwrapper_ql1060n
brother-ql1060n /usr/share/
brother-ql1060n /usr/share/cups/
brother-ql1060n /usr/share/cups/model/
brother-ql1060n /usr/share/cups/model/brother_ql1060n_printer_en.ppd
brother-ql1060n /usr/share/licenses/
brother-ql1060n /usr/share/licenses/brother-ql1060n/
brother-ql1060n /usr/share/licenses/brother-ql1060n/LICENSE

Offline

#5 2020-11-03 05:43:06

MountainX
Member
Registered: 2016-02-08
Posts: 371

Re: [SOLVED] help fixing PKGBUILD for brother-ql1060n

loqs wrote:
git diff
diff --git a/PKGBUILD b/PKGBUILD
index 9a02e2b..424de9d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -21,6 +21,7 @@ sha256sums=('6111c4b13d8ae7a09d23461643b31f06df5973e1babc7fc3e1ef5cec4ede20b6'
 
 prepare()
 {
+  bsdtar -xf ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm
   #  do not install in '/usr/local'
   if [ -d $srcdir/usr/local/Brother ]; then
     install -d $srcdir/usr/share
pacman -Qlp brother-ql1060n-1.0.6r0-1-x86_64.pkg.tar.zst
...
brother-ql1060n /usr/lib/cups/filter/brother_lpdwrapper_ql1060n
brother-ql1060n /usr/share/cups/model/brother_ql1060n_printer_en.ppd

Thanks. You make it look so easy. Any idea what I am doing wrong? The only way I can get it to work is by adding all 3 of these lines to the beginning of prepare. Then I do get the two missing files included in the package.

prepare()
{
  bsdtar -xf $srcdir/ql1060ncupswrapper-1.0.6-0.i386rpm.tar.gz ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm
  bsdtar -xf $srcdir/ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm
  bsdtar -xf $srcdir/ql1060nlpr-1.0.6-0.i386.rpm

That looks kinda crazy, but it worked. The way you show did not work for me. Does it need "$srcdir/" as a prefix?

Anyway, since you got it to work, I trust that's the final solution. Thank you. Now, if only the maintainer will incorporate your patch...

Offline

#6 2020-11-03 05:55:38

MountainX
Member
Registered: 2016-02-08
Posts: 371

Re: [SOLVED] help fixing PKGBUILD for brother-ql1060n

@loqs - I tested your patch from scratch on another machine and it works for me like it did for you. Issue solved. Comment left on AUR page. Thank you.

Offline

#7 2020-11-03 05:57:24

loqs
Member
Registered: 2014-03-06
Posts: 17,192

Re: [SOLVED] help fixing PKGBUILD for brother-ql1060n

  bsdtar -xf $srcdir/ql1060ncupswrapper-1.0.6-0.i386rpm.tar.gz ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm

Extract from ql1060ncupswrapper-1.0.6-0.i386rpm.tar.gz  the archive ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm.
makepkg already extracted ql1060ncupswrapper-1.0.6-0.i386rpm.tar.gz.

  bsdtar -xf $srcdir/ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm

Extract ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm matches the command I suggested.

  bsdtar -xf $srcdir/ql1060nlpr-1.0.6-0.i386.rpm

Extract all the contents of ql1060nlpr-1.0.6-0.i386.rpm which makepkg has already extracted.

No it does not need $srcdir as makepkg will set the working directory to $srcdir before calling prepare().  Note $srcdir should be quote i.e. "$srcdir" when used in PKGBUILD incase the path contains a space.
How are you building the package after changing the PKGBUILD.

Offline

#8 2020-11-03 06:25:01

MountainX
Member
Registered: 2016-02-08
Posts: 371

Re: [SOLVED] help fixing PKGBUILD for brother-ql1060n

loqs wrote:

How are you building the package after changing the PKGBUILD.

Thanks for the explanations. For my successful test, I did this:

I edited PKGBUILD as you suggested with exactly this as the first line of prepare():

bsdtar -xf ql1060ncupswrapper-1.0.6-0.i386rpm/ql1060ncupswrapper-1.0.6-0.i386.rpm

Then make the patch file:

git diff PKGBUILD > PKGBUILD.patch

Then I restored PKGBUILD and applied the patch (for a realistic test):

patch -u PKGBUILD -i PKGBUILD.patch

Then I made the pkg with:

makepkg -s

And I checked for the two files:

pacman -Qlp brother-ql1060n-1.0.6r0-1-x86_64.pkg.tar.zst

They are present, so all is good.

In the other attempts where I did not have success, I was doing basically the same thing (as far as I can tell), but I was building in a chroot using:

makechrootpkg -c -u -n -r $CHROOT

That line is part of a 400 line script, so maybe something in my script has a side effect? Anyway, I learned some important things about printer packaging. Also your patch works, so thanks for all the help. :-)

Is there a good way to automatically apply patch files for AUR packages when building with aurutils?

My normal way to build AUR packages is like this:

aur build --chroot --sign --database="$reponame" --directory=/"$CHROOT"

I was considering adding this to my script, but maybe there's a better way? Any suggestions?

if [[ -f PKGBUILD.patch ]]; then patch -Ns -u PKGBUILD -i PKGBUILD.patch; fi

Offline

Board footer

Powered by FluxBB