[[autopkg]]
=== Snapshot (*Autotools*)

Let's make this upstream source in the VCS more fun to use the Autotools (=Autoconf + Automake).  The upstream VCS does not contain auto-generated files while the distributed tarball for the snapshot package has many auto-generated files.

Let's inspect files.

.VCS source tree
----
include::../hello-c-1.5_d/ref/step101.log[]
----

Here are minimalistic configuration files for Autotools specifying the upstream version to be *1.5*.

.*configure.ac*:
----
include::../hello-c-1.5_d/ref/step103.log[]
----

.*Makefile.am*:
----
include::../hello-c-1.5_d/ref/step104.log[]
----

The C source *hello.c* is the same one as before.

You create a non-native Debian package source tree from the above upstream example using the *debmake*(1) command.

.*git* and *debmake*
----
sys::[head -n25  ../hello-c-1.5_d/ref/step200.log]
 ...
sys::[grep '^I: debmake -x' ../hello-c-1.5_d/ref/step200.log]
 ...
sys::[tail -n5  ../hello-c-1.5_d/ref/step200.log]
----

Let's clean *vcsdir/* since it has so many Autotools generated files.

----
include::../hello-c-1.5_d/ref/step202.log[]
----

Let’s inspect files.

----
include::../hello-c-1.5_d/ref/step400.log[]
----

There are many files:

* the snapshot upstream tarball: *hello-1.5.tar.gz* (*hello-c_1.5.orig.tar.gz*)
* the snapshot upstream source tree with template files generated by the *debmake* command: *hello-c-1.5/**
* the cleaned VCS directory: *vcsdir/**

For the proper packaging, you are required to make further modification using these auto-generated template files in the *hello-c-1.5/debian* directory. For learning purpose, let's leave such details and move on. You can create a non-native Debian package using the *debuild* command (or its equivalent) in this source tree.

----
sys::[head -n3  ../hello-c-1.5_d/ref/step500.log]
 ...
sys::[grep -A 1 -e '^ fakeroot debian\/rules clean' ../hello-c-1.5_d/ref/step500.log]
 ...
sys::[grep -A 1 -e '^ debian\/rules build' ../hello-c-1.5_d/ref/step500.log]
 ...
sys::[grep -A 1 -e '^ fakeroot debian\/rules binary' ../hello-c-1.5_d/ref/step500.log]
 ...
sys::[tail -n1  ../hello-c-1.5_d/ref/step500.log]
----

Let’s inspect the result.

----
include::../hello-c-1.5_d/ref/step600.log[]
----

----
include::../hello-c-1.5_d/ref/step700.log[]
----

----
include::../hello-c-1.5_d/ref/step701.log[]
----

Your development branch holding the real upstream source tree is the *devel* branch.

The following will import generated Debian packages to *master*, *upstream*, and *pristine-tar* branches.

----
include::../hello-c-1.5_d/ref/step800.log[]
----

The *gitk* command shows the VCS history nicely.

