LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-01-2020, 05:33 PM   #1
thethinker
Member
 
Registered: Jul 2006
Location: Peabody, MA, USA
Distribution: Xubuntu, Slackware, Pop!_OS
Posts: 297
Blog Entries: 2

Rep: Reputation: 37
Question Need a little Slackbuilds training Re: maintaining patches


I am working on learning how to maintain Slackbuilds packages, and I'm having trouble dealing with patches. I think I understand the basic functionality of diff and patch, but they don't seem to be behaving how I expect.

So sagemath just got updated from 9.0 to 9.1. So I download the current SB, get the new source, change the version number in the Slackbuilds, and when I run it I got an error, apparently a file that is getting patched got a name change.

The patch in question is this:

Code:
--- build/pkgs/pynac/spkg-install.orig	2014-08-11 20:52:14.220516400 +0700
+++ build/pkgs/pynac/spkg-install	2014-08-11 20:52:27.906551659 +0700
@@ -31,6 +31,7 @@
 
 build_pynac()
 {
+    chmod -R g-w ${PYNACDIR}
     cd ${PYNACDIR}
     PKG_CONFIG_PATH=${SAGE_LOCAL}/lib/pkgconfig; export PKG_CONFIG_PATH
     ./configure --disable-static --prefix=${SAGE_LOCAL} --libdir="$SAGE_LOCAL/l
ib"
But unzipping the source shows the name change:

Code:
$ ls build/pkgs/pynac/
SPKG.txt       dependencies         spkg-install.in
checksums.ini  package-version.txt  type
So here's my attempted fix. Add the change ("add the line chmod.....") to a new file spkg-install-new.in. Then get the diff:

Code:
diff -u build/pkgs/pynac/spkg-install.in build/pkgs/pynac/spkg-install-new.in > pynac.patch
$ more pynac.patch
--- build/pkgs/pynac/spkg-install.in	2020-05-20 18:33:41.000000000 -0400
+++ build/pkgs/pynac/spkg-install-new.in	2020-06-01 18:11:44.231568081 -0
400
@@ -9,6 +9,7 @@
 
 build_pynac()
 {
+    chmod -R g-w ${PYNACDIR}
     cd ${PYNACDIR}
     PKG_CONFIG_PATH=${SAGE_LOCAL}/lib/pkgconfig; export PKG_CONFIG_PATH
     sdh_configure --disable-static --with-giac=no PYTHON=sage-python23

Then take that new patch and replace the old patch in the SB. However, when I run the Slackbuild, I get

Code:
patching file build/pkgs/pynac/spkg-install.in
patching file configure
Reversed (or previously applied) patch detected!  Assume -R? [n]
But I didn't apply the patch to the tarred sourceball yet, so I don't really understand why the script thinks I have. Do I need to more literally follow the naming scheme used by the original author (rename to .orig before editing)? Or am I just totally borking how this is supposed to work?

BTW, the patch is being applied like

Code:
patch -p0 < $CWD/pynac.patch
in the SB script.
 
Old 06-01-2020, 10:25 PM   #2
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,969

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
Just a rhetorical question here. Did you attempt to run the SlackBuild without the patch?
 
1 members found this post helpful.
Old 06-01-2020, 10:54 PM   #3
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
As chrisretusn implied, it seems that the patch is no longer needed as it seems upstream has fixed the source directly.

When bumping SlackBuild versions, it's usually best to try comment out any patches as hopefully they were already accepted in upstream. If the build fails (or the resulting package is still broken), you may want to uncomment the patch and try again.
 
1 members found this post helpful.
Old 06-02-2020, 09:06 AM   #4
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,950

Rep: Reputation: Disabled
Since the patch doesn't cleanly apply and is a single line, take a look at the code and if its still needed reapply it manually and then regenerate the patch with diff(1).

Quote:
Originally Posted by bassmadrigal View Post
When bumping SlackBuild versions, it's usually best to try comment out any patches as hopefully they were already accepted in upstream. If the build fails (or the resulting package is still broken), you may want to uncomment the patch and try again.
And if the patch fixes an issue more subtle than a build failure you may very well not notice how its broken right away.
 
Old 06-02-2020, 09:50 AM   #5
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by orbea View Post
And if the patch fixes an issue more subtle than a build failure you may very well not notice how its broken right away.
I suppose it is best to look into the patch on each version bump and see if it is still necessary. I tend to comment the reason for the patches I use in my SlackBuilds, so it will hopefully be easier to see if they're still needed with version bumps.
 
Old 06-02-2020, 10:17 AM   #6
orbea
Senior Member
 
Registered: Feb 2015
Distribution: Slackware64-current
Posts: 1,950

Rep: Reputation: Disabled
Yes, I agree with adding comments. I try to at least provide the reason as well as links to any relevant upstream issues, commits and pull requests.
 
Old 06-03-2020, 08:39 AM   #7
thethinker
Member
 
Registered: Jul 2006
Location: Peabody, MA, USA
Distribution: Xubuntu, Slackware, Pop!_OS
Posts: 297

Original Poster
Blog Entries: 2

Rep: Reputation: 37
Quote:
Originally Posted by chrisretusn View Post
Just a rhetorical question here. Did you attempt to run the SlackBuild without the patch?
It's not rhetorical - I tried to give the clear impression that I didn't know what I was doing!


Quote:
Originally Posted by bassmadrigal
When bumping SlackBuild versions, it's usually best to try comment out any patches as hopefully they were already accepted in upstream. If the build fails (or the resulting package is still broken), you may want to uncomment the patch and try again.
Indeed, I see why this is best practice, and it solved the problem. I guess I wasn't expecting upstream to care that much about our little corner of the community, but of course a) they might, and b) they might have fixed something unintentionally.

More to the point, c) maybe the patch does something I'm not aware of / can't test on my system, but if it can't build on my vanilla system, that point is moot.

Thanks all for the help - just trying to learn and contribute in whatever small way I can, rather then being a total mooch over here!
 
Old 06-03-2020, 10:18 AM   #8
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,969

Rep: Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548Reputation: 1548
Quote:
Originally Posted by thethinker View Post
It's not rhetorical - I tried to give the clear impression that I didn't know what I was doing!
Oh... it was pretty clear. I don't always assume though, I've been there too. In a lot of areas I still am there. Clueless. hehe

Quote:
Indeed, I see why this is best practice, and it solved the problem. I guess I wasn't expecting upstream to care that much about our little corner of the community, but of course a) they might, and b) they might have fixed something unintentionally.
Most of the patches are found from other distributions and even from upstream but have not been implemented. Some are created from scratch. As already mentioned, commenting on patches is a good thing. I always add a comment on why I needed the patch and the source were I got the patch. I do this also with "patches" to code or layout that are done within the SlackBuild for example using sed to make a few quick changes or moving files around. Always good to document why.

I normally run a rebuild of a program without doing anything to the patches unless I know ahead of time a patch has been cleared. ChangeLogs help in that regard. If the build succeeds then good to go. I the build fails, then I start looking at why and if a patch could be the reason. My SlackBuild's are all coded to produce log output so I can go back and review problems. Have fun in your adventures with Slackware.
 
1 members found this post helpful.
  


Reply

Tags
diff, patch, slackbuilds



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Little error (not harmful) exists in tcl.SlackBuild (source slackbuilds for Tcl) blancamolinos Slackware 3 01-14-2013 05:46 AM
SBo-git - slackbuilds.org on git (with patches for current) ponce Slackware 47 03-12-2011 05:12 AM
patches for a release version or slackware/slackware-ver.#/patches acummings Slackware 2 07-05-2007 01:05 AM
Use SlackBuilds.org or my own hosting to offer up SlackBuilds? hollywoodb Slackware 6 11-30-2006 08:56 PM
RedHat patches vs open source patches paulsh2k4 Linux - Software 1 10-14-2004 03:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration