16

I'm trying to find a way to run dch in non-interactive mode, in order to incorporate the debian/changelog file creation and manipulation within a shell script.

It seems that only when running it with the argument -r "" it works (as specified here). However, I need to use different arguments.

2 Answers 2

16

Found the problem,

It appears that dch will open an editor if it doesn't get all the information that it considers mandatory. So in order to create a debian/changelog without opening an editor I've found that the following combination of options is sufficient:

dch --create --distribution unstable --package "pkgpkg" --newversion 0.0.0.0-0.test "some nice message"
3
  • 1
    dch -n "some nice message" is enough.
    – uav
    Aug 2, 2017 at 16:39
  • 1
    @uav the -n flag doesn't work if you need to create a new change log for the first time: dch: fatal error at line 573: Cannot find debian/changelog anywhere! Are you in the source code tree? (You could use --create if you wish to create this file.)
    – Wimateeka
    Dec 10, 2019 at 19:40
  • 1
    Working exelent, thanks Oct 27, 2022 at 23:28
0

That depends on what you intend to do with it. dch picks up on the VISUAL/EDITOR variables to determine the editor, and the only condition is that it understand/ignore an initial option of the form +n. So I can do:

$ cat edit.sh 
#! /bin/bash

shift
sed -i 's/UNRELEASED/trusty/' "$@"
$ VISUAL='bash edit.sh' dch -i
$ head -3 debian/changelog
mypackage (1.24ubuntu1) trusty; urgency=medium

  * 

And get reasonably automated operation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .