xsuchy / rpmconf

Tool to handle rpmnew and rpmsave files
44 stars 19 forks source link

sdiff support #35

Closed mikccc closed 4 years ago

mikccc commented 6 years ago

Please consider adding support for sdiff.

The sdiff command merges two files and interactively outputs the results. Its arguments are as follows:

sdiff -o outfile options… from-file to-file This merges from-file with to-file, with output to outfile. If from-file is a directory and to-file is not, sdiff compares the file in from-file whose file name is that of to-file, and vice versa. from-file and to-file may not both be directories.

sdiff options begin with ‘-’, so normally from-file and to-file may not begin with ‘-’. However, -- as an argument by itself treats the remaining arguments as file names even if they begin with ‘-’. You may not use - as an input file.

sdiff without --output (-o) produces a side-by-side difference. This usage is obsolete; use the --side-by-side (-y) option of diff instead.

An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble.

https://www.gnu.org/software/diffutils/manual/diffutils.html#Invoking-sdiff

xsuchy commented 6 years ago

Hmm, I tried to start on this, but contradictory to man page I am getting exit code 1 when error (e.g. ed command failed) and 2 when some differences found (v command).

gissf1 commented 5 years ago

etc-update, which is a tool for Gentoo that performs a similar function to rpmconf, uses sdiff by default. Perhaps looking at their code can give you some insight? See: https://github.com/gentoo/portage/blob/master/bin/etc-update

Looking at their code, it seems they use the following call syntax: "sdiff -s -o %merged %old %new" where %merged is the target output filename, %old is the original file, and %new is the newer file to compare with.

This is handled from within the function "do_merge()" around line 567

xsuchy commented 4 years ago

Done in 1f3577916678c391614c8e1091645a8a1f3c8347