[opensuse-buildservice] bug in set_version service
I noticed a bug in the set_version service. If the destination file is a specfile, then the file gets overwritten /twice/ - once with the new version, and once with 'Release: 0' which throws out the first (version) change. Here is my recommended fix: if [ "${FILE%.spec}" != "$FILE" ]; then # set release back to zero after version upgrade, will be increased by OBS during build sed -e "s,^Release:.*,Release: 0," -e "s,^Version:.*,Version: $MYVERSION," "$FILE" > "$MYOUTDIR/$FILE" || exit 1 else sed -e "s,^Version:.*,Version: $MYVERSION," "$FILE" > "$MYOUTDIR/$FILE" || exit 1 fi I generally prefer to see '-e' used whenever possible. -- Jon -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
Am Sonntag, 24. Oktober 2010, 21:46:38 schrieb Jon Nelson:
I noticed a bug in the set_version service. If the destination file is a specfile, then the file gets overwritten /twice/ - once with the new version, and once with 'Release: 0' which throws out the first (version) change.
Here is my recommended fix:
if [ "${FILE%.spec}" != "$FILE" ]; then # set release back to zero after version upgrade, will be increased by OBS during build sed -e "s,^Release:.*,Release: 0," -e "s,^Version:.*,Version: $MYVERSION," "$FILE" > "$MYOUTDIR/$FILE" || exit 1
The problem with that is that it would also remove any possible used special hacks which modify the release number. So, we would need an option here to disable it. Would be great if you could submit that to the openSUSE:Tools package via a submit request.
else sed -e "s,^Version:.*,Version: $MYVERSION," "$FILE" > "$MYOUTDIR/$FILE" || exit 1 fi
I generally prefer to see '-e' used whenever possible.
-- Adrian Schroeter SUSE Linux Products GmbH email: adrian@suse.de -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
On Mon, Oct 25, 2010 at 4:20 AM, Adrian Schröter
Am Sonntag, 24. Oktober 2010, 21:46:38 schrieb Jon Nelson:
I noticed a bug in the set_version service. If the destination file is a specfile, then the file gets overwritten /twice/ - once with the new version, and once with 'Release: 0' which throws out the first (version) change.
Here is my recommended fix:
if [ "${FILE%.spec}" != "$FILE" ]; then # set release back to zero after version upgrade, will be increased by OBS during build sed -e "s,^Release:.*,Release: 0," -e "s,^Version:.*,Version: $MYVERSION," "$FILE" > "$MYOUTDIR/$FILE" || exit 1
The problem with that is that it would also remove any possible used special hacks which modify the release number.
That's true, but I did not want to change the (apparently) intended behavior of the code - just correct it. As it stands, it *does not* work for specfiles - for specfiles, it will reset the release number but not the version.
So, we would need an option here to disable it.
Would be great if you could submit that to the openSUSE:Tools package via a submit request.
Would you prefer a submission which doesn't fiddle with the release number or one which changes both release and version (as above)? -- Jon -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
Am Montag, 25. Oktober 2010, 20:30:21 schrieb Jon Nelson:
On Mon, Oct 25, 2010 at 4:20 AM, Adrian Schröter
wrote: Am Sonntag, 24. Oktober 2010, 21:46:38 schrieb Jon Nelson:
I noticed a bug in the set_version service. If the destination file is a specfile, then the file gets overwritten /twice/ - once with the new version, and once with 'Release: 0' which throws out the first (version) change.
Here is my recommended fix:
if [ "${FILE%.spec}" != "$FILE" ]; then # set release back to zero after version upgrade, will be increased by OBS during build sed -e "s,^Release:.*,Release: 0," -e "s,^Version:.*,Version: $MYVERSION," "$FILE" > "$MYOUTDIR/$FILE" || exit 1
The problem with that is that it would also remove any possible used special hacks which modify the release number.
That's true, but I did not want to change the (apparently) intended behavior of the code - just correct it. As it stands, it *does not* work for specfiles - for specfiles, it will reset the release number but not the version.
hm, right, seems to depend on sed version or I would have spotted this before.
So, we would need an option here to disable it.
Would be great if you could submit that to the openSUSE:Tools package via a submit request.
Would you prefer a submission which doesn't fiddle with the release number or one which changes both release and version (as above)?
your code as it was posted looks good to me, after looking in the code again ;) -- Adrian Schroeter SUSE Linux Products GmbH email: adrian@suse.de -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-buildservice+help@opensuse.org
participants (2)
-
Adrian Schröter
-
Jon Nelson