|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
Wading through sed and re_format
I'm trying to update x11/tint2 and have the basic port almost ready to go.
Where I am hung up is that upstream has provided multiple rc configuration files that contain multiple Launcher paths; ie /usr/share/applications/tint2conf.desktop and /usr/share/applications/firefox.desktop. The 12.2 source had these in a "sample" directory which in the interim has been renamed "themes". In 12.2, @sthen added a post-intall sed command to edit all the examples Code:
post-install: cp -R ${WRKSRC}/sample/ ${PREFIX}/share/examples/tint2/ sed -i -e '/\/usr\/local\/share\/applications/d' -e \ 's,/usr/share/applications,${LOCALBASE}/share/applications,g' \ ${PREFIX}/share/examples/tint2/*tint2rc rm ${PREFIX}/share/tint2/*.tint2rc In the above code does the cp -R command stream into the sed command on the next line? I understand -i is "inplace" and -e appends /\/usr\/local\/share\/applications/d' to the next command. I'm guessing that .../applications/d' "deletes the pattern space and starts the next cycle which then replaces /usr/share/applications with ${LOCALEBASE}/share/applications,g Code:
[2addr]g Replace the contents of the pattern space with the contents of the hold space. So I modified the post-install command to Code:
post-install: sed -i -e '/\/usr\/local\/share\/applications/d' -e \ 's,/usr/share/applications,${LOCALBASE}/share/applications,g' \ ${PREFIX}/share/examples/tint2/*tint2rc ***Parse Error in /usr/ports/x11/tint2: Need operator in '/share/examples/tint2/*tint2rc. sed(1) and re_format(7) are not easy reading. Both the FreeBSD(v0.14.5) and NetBSD(v0.14.6) did not address this. Any guidance appreciated. |
|
|||||
Quote:
Quote:
Quote:
(d)elete the matched pattern (S)ubstitute the matched pattern with the following string (g)lobally (everywhere it's found, otherwise sed stops at the first match) And the last part is the input files. Quote:
Quote:
Although "needs operator" looks like something else. Make sure you don't have whitespace after a \ at the end of a line. |
|
|||
Code:
make fake x11/tint2 uses CMake and the install directories are listed in a CMakeLists.txt file. The default is to install all the example rc files in /etc/xdg/tint2 which is an OpenBSD no-no. I patched the CMakeLists.txt file to install all the rc files in /usr/local/share/examples/tint2/ and then used @sample in PLIST to generate /etc/xdg/tint2/tint2rc. It looks like the port is error checked prior to the patch that puts tint2rc + examples in /usr/local/share/examples/tint2. Is it possible to run sed on the original source code themes directory? Looking at the porters handbook, there is a post-extract stage. Would a post-extract entry allow me to run the sed on WRKDIST? Thanks Last edited by shep; 19th August 2017 at 02:23 AM. |
|
|||
I'm guessing this is where we left off on ports@...
Quote:
Quote:
Code:
post-install: cp -R ${WRKSRC}/themes/ ${PREFIX}/share/examples/tint2/ sed -i -e '/\/usr\/local\/share\/applications/d' -e \ 's,/usr/share/applications,${LOCALBASE}/share/applications,g' \ ${PREFIX}/share/examples/tint2/*tint2rc rm ${PREFIX}/share/tint2/*.tint2rc |
|
|||
I understood that samples needed to be renamed themes. Initially I had edited the CMakeLists.txt file to directly install the themes into /usr/local/share/examples/tint2. Thought the 1st post-install line was redundant at that point and removed it. I still don't understand it but trying to execute any command like
Quote:
when the 1st line was missing. I did end up modifying the CMakeLists.txt patch and reverting the post-install message but it did seem a little messy to copy ${WRKSRC}/themes to /usr/local/share/examples/tint2/ followed by deleting /usr/local/share/tint2/*.tint2rc. The CMakeList.txt patch just installed them directly. |
|
|||
Quote:
Quote:
|
|
|||
With the 1st post-install line removed, any make * command died with the warning about sed not having an operator. With the 1st post-install line intact, make * commands executed.
By default, /usr/local/share/tint2/ contains a default configuration: tint2rc, multiple example configurations: *.tint2rc and an svg icon. The themes directory in the source contains tint2rc + *.tint2rc + a second CMakeLists.txt file. The goal is to get tint2rc in /etc/xdg/tint2/ and ${PREFIX}/share/examples/tint2, the *.tint2rc in ${PREFIX}/share/examples/tint2, leave the *svg icon in /usr/local/share/tint2/ and lose the CMakeLists.txt file A simple edit to 1st (Upper) CMakeLists.txt + PLIST @sample + no post-install resulted in everything in the right place, The problem with that approach is I could not get the sed command to run. |
|
|