1

I have a Qt application that I want to deploy as a deb package. I have been reading so many sources, all slightly different - most of what I did follows this How To: preparing an application for submission to the Ubuntu Software Centre

I must create a folder structure in /usr/share/My Company's Folder/ (The spaces and special characters in the path are an unfortunate requirement; the uppercase names also... the program was ported from windows).

/usr/share/My Company's Folder/MainProject/content

I created a package... and it seems to work, installs in the correct location, and surprisingly the program even works after that.

The Problem: I cannot use space in path names. I created an "install" file as shown in the link above. It does what it is supposed to - but I get a error if I am trying to place items in /usr/share/My Company's Folder/ - I could only get it to work by using /usr/share/MyCompanyFolder/ (no spaces or special characters".

Setup:

~/working_directory
  mainproject-1.0
     mainproject_1
        content
  mainproject-1.0.tar.gz

Inside mainproject-1.0 I ran

dh_make --copyright gpl -f ../mainproject-1.0.tar.gz 

select s, press enter... Then I modified the files in the debian folder created.

Created an "install" file in debian folder as well:

mainproject_1/* /usr/share/My Company's Folder/MainProject

Ran

dpkg-buildpackage -rfakeroot -my@email.com

It works, creates installer, installer works...

But I cannot make a folder path with spaces, which is what I really need.

Note:

Tried unsuccessfully

"/usr/share/My\ Company\'s\ Folder/"
"/usr/share/My Company's Folder/"
/usr/share/My\ Company\'s\ Folder/
/usr/share/My\040Company's\040Folder/
/usr/share/My?Company's?Folder/

After much searching I found this info

you can't install files with space with dh_install (= debian/*install files)
you have to rename/install them explicitly in debian/rules with install, mv or cp
e.g. with dh tiny rules:

override_dh_install
     dh_install
     install -m 644 "fi le" "debian/tmp/usr/share/fi_le"

So I tried to add in the debian/rules file (showing line numbers)

12 %:
13  dh $@ 
14
15 override_dh_install:
16  dh_install
17  install -m 644 "debian/mainproject/usr/share/MyCompanyFolder" "debian/mainproject/usr/share/My Company's Folder"

latest error - with this command:

make[1]: Entering directory `/home/me/working_directory/mainproject-1.0'
dh_install
install -m 644 "My Company's Folder" "debian/mainproject/usr/share/MyCompanyFolder"
install: cannot stat `My Company's Folder': No such file or directory
make[1]: *** [override_dh_install] Error 1
make[1]: Leaving directory `/home/me/working_directory/mainproject-1.0'
make: *** [binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary gave error exit status 2

Alternatively tried

12 %:
13  dh $@ 
14
15 override_dh_install:
16  dh_install
17  mv -r "debian/mainproject/usr/share/MyCompanyFolder" "debian/mainproject/usr/share/My Company's Folder"

And as result the folder structure inside debian looks correct, but I got errors about invalid folders...

objdump: 'debian/mainproject/usr/share/My': No such file
objdump: 'Company's': No such file
.....

mkdir then cp should have the same result as mv but unfortunately they kept placing one folder inside the other... * is seen as an actual name...

It really seems like I am getting nowhere.

Update: the answer to my question is, use the mv command in a postinstall file.

Thalia
  • 351

3 Answers3

1

Well, your final approach to use the postinstall is a good way to do so. But the reason, for the failure of your first try ,is actually that , the patch inside the Debian's install script (that is debian/rules debian/install also probably something else) is based on the Debian package, not the path you are thinking on your computer. It is the path compared with the whole package's folder. That's why it will give you the output that "no such file"

Sorry for my poor English, I wish I've got your problem right,and explained it well.

If I were you , I would reach for the Debian maintainers I knew for help, or see other packages packed by others. (You can get the sources of most of the packages easily in your terminal)

Y00
  • 121
1

It's a trick

There is directories layout:
mytest-0.1/debian/changelog
             /compat
             /control
             /install
             /rules
mytest-0.1/usr/share/my company/file_a
                               /file_b
                               /file_c'

Modify install file as follows

usr/share/           /usr/

Then packs your deb package

$mytest-0.1>dpkg-buildpackage -rfakeroot -uc -us -tc

Wish it can help you

0

You last example didn't have the -p argument in the mkdir, so the directory did not get created in the specified path. The rest should have worked. You will have continuous problems with names containing special characters like quotes, but if the requirement is to install to such a name, your approach to simply do the install to a normal directory, then rename it at the end is a good one. You avoid all the nonsense with the required quoting in your script, and let the end uses deal with it. When the end users cry loud enough, maybe something reasonable will happen like not having to use such names on a Linux system, where they will cause problems.

ubfan1
  • 19,049