From: Karl O. P. <ko...@me...> - 2010-02-01 03:04:05
|
On 01/31/2010 06:33:40 PM, Richard wrote: > Allright found the error but don't know how to solve it in the > intended manner. > > Replace in the makefile this part: > update-version: > sed -i 's/^my $$VERSION = .*;/my $$VERSION = "$(VERSION)";/' > sqlgrey > sed -i 's/^%define ver .*/%define ver $(VERSION)/' > sqlgrey.spec > sed -i 's/^my $$VERSION = .*;/my $$VERSION = "$(VERSION)";/' > sqlgrey-logstats.pl > > With the same code but not so elegant from an older version like > 1.7.6: > update-version: > cat sqlgrey | sed 's/^my $$VERSION = .*;/my $$VERSION = > "$(VERSION)";/' > sqlgrey.new > mv sqlgrey.new sqlgrey > chmod a+x sqlgrey > cat sqlgrey.spec | sed 's/^%define ver .*/%define ver > $(VERSION)/' > sqlgrey.spec.new > mv sqlgrey.spec.new sqlgrey.spec > cat sqlgrey-logstats.pl | sed 's/^my $$VERSION = .*;/my > $$VERSION = "$(VERSION)";/' > sqlgrey-logstats.pl.new > mv sqlgrey-logstats.pl.new sqlgrey-logstats.pl > chmod a+x sqlgrey-logstats.pl Looks like sed -i isn't portable. It's probably a gnu extension. You don't find it in openbsd's sed. I'd say the makefile should be more portable. How about?: ( ;# Run in a subshell just to cleanup early. tfile=sqlgrey.$$ function cleanup () rm -f $tfile trap cleanup EXIT sed 's/^my $$VERSION = .*;/my $$VERSION = "$(VERSION)";/' sqlgrey > $tfile \ && cat $tfile > sqlgrey sed 's/^%define ver .*/%define ver $(VERSION)/' sqlgrey.spec > $tfile \ && cat $tfile > sqlgrey.spec sed 's/^my $$VERSION = .*;/my $$VERSION = "$(VERSION)";/' sqlgrey-logstats.pl > $tfile \ && cat $tfile > sqlgrey-logstats.pl ) Note also that it's probably not a good idea to rely on the file permissions in the tarball. The better approach is to use the install program and set the bits as desired on install. (But the above code does preserve all permissions.) If this was cleaned up I'd get rid of the whole $tfile thing and have the input files named autoconf-ish: sqlgrey.in, sqlgrey.spec.in, etc. and just sed right into the target file (sqlgrey, sqlgrey.spec, etc.). Karl <ko...@me...> Free Software: "You don't pay back, you pay forward." -- Robert A. Heinlein |