freight icon indicating copy to clipboard operation
freight copied to clipboard

Should freight-add exit non-zero in case package is already present?

Open antaflos opened this issue 11 years ago • 2 comments

Running freight-add on a package that already exists in the library exits with an informative (error?) message but with exit code 0:

$ freight-add foobar_0.9.0_amd64.deb apt/precise
# [freight] apt/precise already has foobar_0.90.0_amd64.deb
$ echo $?
0

Shouldn't it exit with 1 or another non-zero value so that one doesn't have to rely on parsing the message in order to find out what freight-add actually did?

I understand that the end result of running freight-add is always that a package is present in the library (i.e. /var/lib/freight) but when scripting a package deployment process it'd be nice to be able to easily fail when the script tries to add a package that already exists.

antaflos avatar Sep 24 '14 22:09 antaflos

I'll think on it. I didn't realize that was an erroneous condition.

You can work around it by looking in $VARLIB/$MANAGER/$DIST for the file you're trying to add.

rcrowley avatar Oct 05 '14 00:10 rcrowley

Freight's current behavior is what I would expect... My build scripts don't check to see if packages already exist before trying to add them. It's not an erroneous condition in my case.

@antaflos curious, why do you want dupes to be a fatal error?

bronson avatar May 05 '15 00:05 bronson