From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adonay Felipe Nogueira Subject: bug#29365: openmolar looking in /usr/share/openmolar Date: Wed, 22 Nov 2017 15:13:32 -0200 Message-ID: <871skq2q4j.fsf@hyperbola.info> References: <878tf0x3bq.fsf@riseup.net> <87tvxmfyf4.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHYb7-0000bM-Gh for bug-guix@gnu.org; Wed, 22 Nov 2017 12:14:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHYb4-0006nH-8d for bug-guix@gnu.org; Wed, 22 Nov 2017 12:14:05 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:44326) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eHYb4-0006mf-4I for bug-guix@gnu.org; Wed, 22 Nov 2017 12:14:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eHYb3-0003ct-T5 for bug-guix@gnu.org; Wed, 22 Nov 2017 12:14:01 -0500 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <87tvxmfyf4.fsf@gmail.com> (Chris Marusich's message of "Wed, 22 Nov 2017 01:35:59 -0800") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 29365@debbugs.gnu.org Adding to what Chris Marusich described: 'substitute* works somewhat in the following way: --8<---------------cut here---------------start------------->8--- (substitute FILE-string-or-FILE-list-of-strings ((EREGEX-string SYMBOLS-to-put-both-entire-match-and-captures-or-NOTHING) REPLACEMENT-string)) --8<---------------cut here---------------end--------------->8--- For example: --8<---------------cut here---------------start------------->8--- (substitute "file1.txt" (("a") "b") ;; ... would replace every "a" with "b". (("1([[:digit:]]*)([^[:digit:]])" full capture1 capture2) (string-append full " 2" capture1 capture2))) ;; ... would replace "1234A" and "1A" with "1234A 2234A" and "1A 2A", ;; respectively. (substitute '("file2.txt" "file3.txt" "file4.txt") (("a\\*\n") ; matches literal asterisk (*) followed by a new ; line/line feed. "b") ;; ... from "a*[newline]" to "b". (("(1)[^[:digit:]]*" _ interesting-one) ; use "_" capture to not save ; the whole match. (string-append interesting-one " 1"))) ;; ... from "1A" or from "1ABC" to "1 1" ("A" and "ABC" parts are ;; discarded). --8<---------------cut here---------------end--------------->8--- Notice that the regular expression that GNU Guile uses is the extended one (Extended Regular Expression). See the info page for Guile for more details (type `info guile' in the terminal, and go to the section "Regular Expressions", inside that section notice that there is one talking about backslash escapes, this one is also important for reasons that you'll see in the next paragrah). Notice that in Guile backslashes in strings also have special meaning, so one has to take into account string+regex special meaning when doing backslash escapes. In the examples given, the replacement for "file2.txt" onwards shows us how to deal with this. I hope this helps! ;) 2017-11-22T01:35:59-0800 Chris Marusich wrote: > > Based on your assessment, it looks like the problem is that the > application hard-codes the "/usr" directory path. > > One solution for this problem is to replace that line of code in the > source with the correct path. You can do this in the package definition > by using the substitute* macro provided by the (guix build utils) > module. In fact, it looks like the current package definition for > openmolar already attempts to do this. Run "guix edit openmolar" to > view the current package definition. > > Perhaps you could modify the package definition to also replace the path > in localsettings.py? You might also want to look around in the source > for other paths that need to be fixed (a command such as "grep -r /usr" > might be helpful). > > For information on how to use substitute*, please refer to > guix/build/utils.scm in the Guix source tree. For general information > on hacking on Guix, check the section titled "Contributing" in the > manual (e.g., run info '(guix) Contributing' in a terminal). --=20 - https://libreplanet.org/wiki/User:Adfeno - Palestrante e consultor sobre /software/ livre (n=C3=A3o confundir com gratis). - "WhatsApp"? Ele n=C3=A3o =C3=A9 livre. Por favor, veja formas de se comun= icar instantaneamente comigo no endere=C3=A7o abaixo. - Contato: https://libreplanet.org/wiki/User:Adfeno#vCard - Arquivos comuns aceitos (apenas sem DRM): Corel Draw, Microsoft Office, MP3, MP4, WMA, WMV. - Arquivos comuns aceitos e enviados: CSV, GNU Dia, GNU Emacs Org, GNU GIMP, Inkscape SVG, JPG, LibreOffice (padr=C3=A3o ODF), OGG, OPUS, PDF (apenas sem DRM), PNG, TXT, WEBM.