This module uses gbp and upstream git repository.

As of version 0.254.1, =pristine-tar= branch is no longer updated.

The instructions of this file assume that the branches are:
- master :: Debian work
- upstream :: upstream branch from github

To work on this package, please run:

#+begin_src shell
  git clone https://salsa.debian.org/perl-team/modules/packages/libconfig-model-systemd-perl.git
  git remote add github https://github.com/dod38fr/config-model-systemd.git
#+end_src

To update this package, first import the changes from upstream:
#+begin_src shell :dir .. :exports code :results verbatim
git fetch --all
#+end_src

#+RESULTS:
: Récupération de origin
: Récupération de upstream-repo

Find the latest version:
#+NAME: version
#+begin_src shell :dir .. :exports code :results verbatim
VERSION=$(git describe --tags $(git rev-list '--tags=v*' --max-count=1) | sed 's/^v//')
echo -n $VERSION
#+end_src

#+RESULTS: version
: 0.254.1

Update upstream branch:
#+begin_src shell :dir .. :exports code :results verbatim :var VERSION=version
  git checkout upstream
  git merge v$VERSION
#+end_src

#+RESULTS:
#+begin_example
Votre branche est à jour avec 'origin/upstream'.
Mise à jour 295e5b4..64ee878
Fast-forward
 Changes                                            |   8 +
 contrib/parse-man.pl                               |   6 +
 lib/Config/Model/models/Systemd/Common/Exec.pl     | 194 ++++++++++++++-------
 lib/Config/Model/models/Systemd/Common/Kill.pl     |   2 +-
 .../Model/models/Systemd/Common/ResourceControl.pl |  48 ++---
 lib/Config/Model/models/Systemd/Section/Service.pl | 116 ++++++++----
 lib/Config/Model/models/Systemd/Section/Socket.pl  |   9 +-
 lib/Config/Model/models/Systemd/Section/Timer.pl   |   2 +-
 lib/Config/Model/models/Systemd/Section/Unit.pl    |  52 +++++-
 9 files changed, 302 insertions(+), 135 deletions(-)
#+end_example

Update debian branch:
#+begin_src shell :dir .. :exports code :results verbatim :var VERSION=version
  git checkout master
  git merge upstream
#+end_src

#+RESULTS:
#+begin_example
Votre branche est à jour avec 'origin/master'.
Merge made by the 'ort' strategy.
 Changes                                            |   8 +
 contrib/parse-man.pl                               |   6 +
 lib/Config/Model/models/Systemd/Common/Exec.pl     | 194 ++++++++++++++-------
 lib/Config/Model/models/Systemd/Common/Kill.pl     |   2 +-
 .../Model/models/Systemd/Common/ResourceControl.pl |  48 ++---
 lib/Config/Model/models/Systemd/Section/Service.pl | 116 ++++++++----
 lib/Config/Model/models/Systemd/Section/Socket.pl  |   9 +-
 lib/Config/Model/models/Systemd/Section/Timer.pl   |   2 +-
 lib/Config/Model/models/Systemd/Section/Unit.pl    |  52 +++++-
 9 files changed, 302 insertions(+), 135 deletions(-)
#+end_example

Update the debian/copyright file:
#+begin_src shell :dir .. :exports code :results verbatim :var VERSION=version
  cme update dpkg-copyright
#+end_src

#+RESULTS:
#+begin_example
Updating data...
Dpkg.Copyright.Grant.ByFile Dpkg::Copyright::Grant::ByFile::_warn The following paths are missing information:
- Build.PL
- CONTRIBUTING.md
- Changes
- README-build-from-git.md
- README.md
- contrib/parse-man.pl
- debian/control
- debian/gbp.conf
- debian/libconfig-model-systemd-perl.docs
- debian/patches/rm-git-from-dzil
- debian/rules
- debian/tests/pkg-perl/syntax-skip
- debian/tests/pkg-perl/use-name
- debian/upstream/metadata
- debian/watch
- lib/Config/Model/Backend/Systemd.pm
- lib/Config/Model/Backend/Systemd/Layers.pm
- lib/Config/Model/Backend/Systemd/Unit.pm
- lib/Config/Model/Systemd.pm
- lib/Config/Model/application.d/systemd-service-file
- lib/Config/Model/application.d/systemd-socket-file
- lib/Config/Model/application.d/systemd-timer-file
- lib/Config/Model/models/Systemd.pl
- lib/Config/Model/models/Systemd/Service.pl
- lib/Config/Model/models/Systemd/Socket.pl
- lib/Config/Model/models/Systemd/StandAlone/Service.pl
- lib/Config/Model/models/Systemd/StandAlone/Socket.pl
- lib/Config/Model/models/Systemd/StandAlone/Timer.pl
- lib/Config/Model/models/Systemd/Timer.pl
- lib/Config/Model/system.d/systemd
- lib/Config/Model/system.d/systemd-service
- lib/Config/Model/system.d/systemd-socket
- lib/Config/Model/system.d/systemd-timer
- lib/Config/Model/user.d/systemd-user
- t/README.md
- t/cme-function.t
- t/model_tests.d/systemd-examples/condition-list/main-test
- t/model_tests.d/systemd-examples/disable-service/main-sshd
- t/model_tests.d/systemd-examples/remove-service/default-alsa-state
- t/model_tests.d/systemd-examples/remove-service/default-sshd
- t/model_tests.d/systemd-examples/remove-service/main-sshd
- t/model_tests.d/systemd-examples/remove-service/mpd.service
- t/model_tests.d/systemd-examples/remove-service/mpd.socket
- t/model_tests.d/systemd-examples/sshd-service/main-sshd
- t/model_tests.d/systemd-examples/sshd-service/ssh.service
- t/model_tests.d/systemd-examples/transmission/transmission-daemon.service
- t/model_tests.d/systemd-service-file-examples/basic-service/gmail-imap-tunnel@.service
- t/model_tests.d/systemd-service-file-examples/delete-service/main-obex
- t/model_tests.d/systemd-service-file-examples/delete-service/user-obex
- t/model_tests.d/systemd-service-file-examples/override-service/main-obex
- t/model_tests.d/systemd-service-file-examples/override-service/user-obex
- t/model_tests.d/systemd-service-file-test-conf.pl
- t/model_tests.d/systemd-service-test-conf.pl
- t/model_tests.d/systemd-socket-file-examples/basic-socket/gmail-imap-tunnel.socket
- t/model_tests.d/systemd-socket-file-test-conf.pl
- t/model_tests.d/systemd-test-conf.pl
- t/model_tests.d/systemd-user-examples/basic-service/gmail-imap-tunnel@.service
- t/model_tests.d/systemd-user-examples/basic-socket/gmail-imap-tunnel.socket
- t/model_tests.d/systemd-user-examples/delete-service/main-obex
- t/model_tests.d/systemd-user-examples/delete-service/user-obex
- t/model_tests.d/systemd-user-examples/duplicity/duplicity.service
- t/model_tests.d/systemd-user-examples/duplicity/duplicity.timer
- t/model_tests.d/systemd-user-examples/override-service/main-obex
- t/model_tests.d/systemd-user-examples/override-service/user-obex
- t/model_tests.d/systemd-user-test-conf.pl
- t/model_tests.t
- t/perl-critic.t
- t/perlcriticrc
- t/pod.t
- t/systemd-service.t
- weaver.ini
You may want to add a line in debian/fill.copyright.blanks.yml

 (620) 
Removing dummy license text from license LGPL-2.1 for path *
Removing dummy license text from license LGPL-2.1 for path lib/Config/Model/models/*
Update done
Please follow the instructions given in Config::Model::Dpkg::Copyright man page,
section "Tweak results" if some license and copyright entries are wrong.
Other information, like license text, can be added directly in debian/copyright file 
and will be merged correctly next time this command is run.
See also https://github.com/dod38fr/config-model/wiki/Updating-debian-copyright-file-with-cme
#+end_example

Then review the changes and commit the result.

See also https://github.com/dod38fr/config-model/wiki/Updating-debian-copyright-file-with-cme

Check patches (and cleanup if necessary):
#+begin_src shell :dir .. :exports code :results verbatim :var VERSION=version
  quilt push --refresh -a && quilt pop -a
#+end_src

#+RESULTS:
: Application de rm-git-from-dzil
: patching file dist.ini
: Patch rm-git-from-dzil is unchanged
: 
: Le patch rm-git-from-dzil est maintenant au sommet
: Retrait de rm-git-from-dzil
: Restoring dist.ini
: 
: Aucun patch n'est appliqué

Generate a temporary changelog:
#+begin_src shell :dir .. :exports code :results verbatim :var VERSION=version
  gbp dch --new-version=$VERSION-1 --snapshot --auto debian/
#+end_src

#+RESULTS:
: gbp:info: Found tag for topmost changelog version '1b24b4dc086fd83c2d19d29cc1ee49322b3d357d'
: gbp:info: Continuing from commit '1b24b4dc086fd83c2d19d29cc1ee49322b3d357d'
: gbp:info: Only looking for changes on 'debian/'
: gbp:info: Changelog 0.260.1-1~1.gbp3331ba (snapshot #1) prepared up to 3331ba2

Commit =debian/changelog= (otherwise, =gbp buildpackage= tries to build the
old version):

#+begin_src shell :dir .. :exports code :results verbatim :var VERSION=version
  git commit -m"new upstream version" debian/changelog
#+end_src

#+RESULTS:
: [master 9e9de48] new upstream version
:  1 file changed, 9 insertions(+)

You can build the package with the following command:

# this requires emacs ob-tmux
#+begin_src tmux :session build :results verbatim :exports code :var dir=repo_dir
  cd $dir
  gbp buildpackage --git-ignore-new
#+end_src

Note: only committed changes are used by =gbp buildpackage=

Update the changelog:

#+begin_src tmux :session build :results verbatim :exports code :var dir=repo_dir
  cd $dir
  gbp dch -Ra --commit
#+end_src

Once everything is fine, build a source package and tag:

#+begin_src tmux :session build :results verbatim :exports code :var dir=repo_dir
  cd $dir
  gbp buildpackage -S --git-tag
#+end_src

Push on salsa:

#+begin_src shell :dir ".." :results verbatim :exports code
  gbp push
#+end_src

For more details, see [[https://honk.sigxcpu.org/projects/git-buildpackage/manual-html/gbp.import.upstream-git.html#gbp.import.upstream.git.notarball][gbp import with git documentation]].

# this is a workaround for a bug in ob-tmux. No need to execute this
#+NAME: repo_dir
#+BEGIN_SRC shell :results verbatim :exports no
  cd ..
  echo -n $PWD
#+END_SRC

