Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to change the default directory structure of dh_make so that dpkg-buildpackage does not throw any errors

I am trying to create a debian package for a postgreSQL extension Apache-age release 1.1.1 and created the directory structure using dh_make command.
The directory structure is as follows:

age-1.1.1 (project root)
├── debian
│   ├── changelog
│   ├── compat
│   ├── control
│   ├── docs
│   ├── examples
│   ├── links
│   ├── manpages
│   ├── menu
│   ├── postinst
│   ├── postrm
│   ├── preinst
│   ├── prerm
│   ├── rules
│   ├── source
│   └── watch
├── src
└── Makefile

The dpkg-buildpackage -b when run from project-root folder it looks for debian folder, then reads the rule file, then reads the Makefile located in the project root to build the package.

I want to change the directory structure to the following:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.project root
    ├── packaging
    │   ├── debian
    │   │   ├── control
    │   │   ├── control.in
    │   │   ├── changelog
    │   │   ├── copyright
    │   │   ├── pgversions
    │   │   ├── rules
    │   │   └── ...
    │   └──
    ├── src
    ├── LICENSE
    ├── README.md
    ├── Makefile
    └── ...

I want to change the directory structure so that the dpkg-buildpackage -b command can be run from the packaging folder and it should build the package.

>Solution :

I’m not sure if this is the best way to do this but it’s working for me:

Here are the steps:

  • First run the dh_make_pgxs command from the project root directory.

  • Create a packaging directory in the project root and move the debian directory created in step 1 to this directory along with the Makefile, age.control and the age–1.1.1.sql.

    Your file structure should look like this:

      .project root
      ├── packaging
      │   ├── debian
      │   │   ├── control
      │   │   ├── control.in
      │   │   ├── changelog
      │   │   ├── copyright
      │   │   ├── pgversions
      │   │   ├── rules
      │   │   └── ...
      │   ├── age--1.1.1.sql
      │   ├── age.control
      │   ├── Makefile
      │   └── ...
      ├── src
      ├── LICENSE
      ├── README.md
      └── ...
    
  • Change the file paths in the Makefile like:

    • src/backend/age.o should be ../src/backend/age.o.
    • ./tools/ should be ./../tools/.
    • and so on.
  • Now you can simply run the dpkg-buildpackage -b command from the packaging directory to build the debian package.

Note: In step 1 we are running dh_make_pgxs in the project root first, this is to make sure that the project name in the control files and the version in the changelog file are correct. In this case the name/source in control, control.in & changelog files should be apache-age and the version number in changelog file should be 1.1.1-1.
Alternatively, you can run the command from the packaging directory and manually change the name and version in the control and changelog files.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading