Возникли проблемы при сборке пакета python для deb, жалуйтесь на модифицированный бинарный файл - PullRequest
7 голосов
/ 13 марта 2012

Я собрал свои пакеты перед использованием debhelper, но у меня очень неприятная проблема.

Это мое файловое дерево:

usr/
`-- share
    |-- applications
    |   `-- create-launcher.desktop
    `-- create-launcher
        |-- bin
        |   |-- callbacks.py
        |   |-- callbacks.pyc
        |   |-- create_launcher.py
        |   |-- create_launcher.pyc
        |   |-- file_handler.py
        |   |-- file_handler.pyc
        |   |-- make_launcher.py
        |   |-- make_launcher.pyc
        |   |-- message_dialog.py
        |   |-- message_dialog.pyc
        |   `-- session
        |-- data
        |   `-- gui.glade
        |-- images
        |   `-- icon_48x48.png
        `-- README

А вы видите, у меня есть несколько pyc-файлов python, которые являются двоичными файлами и двоичным изображением. Я не знаю, если это моя проблема, но я запустил

dh_make

создаю каталог debian, и я изменил все необходимые файлы.

Если я бегу:

dh_install

Все идет в правильные местоположения debian / create-launcher / usr ....

Тем не менее, если я бегу:

debuild -uc -us

Я получаю следующий вывод:

 dpkg-buildpackage -rfakeroot -D -us -uc
dpkg-buildpackage: source package create-launcher
dpkg-buildpackage: source version 0.1.2+alpha-1
dpkg-buildpackage: source changed by Narnie Harshoe <signupnarnie@gmail.com>
 dpkg-source --before-build create-launcher-0.1.2+alpha
dpkg-buildpackage: host architecture amd64
 fakeroot debian/rules clean
dh clean 
   dh_testdir
   dh_auto_clean
   dh_clean
 dpkg-source -b create-launcher-0.1.2+alpha
dpkg-source: info: using source format `3.0 (quilt)'
dpkg-source: info: building create-launcher using existing ./create-launcher_0.1.2+alpha.orig.tar.gz
dpkg-source: warning: ignoring deletion of directory share
dpkg-source: warning: ignoring deletion of directory share/applications
dpkg-source: warning: ignoring deletion of file share/applications/create-launcher.desktop
dpkg-source: warning: ignoring deletion of directory share/create-launcher
dpkg-source: warning: ignoring deletion of file share/create-launcher/README
dpkg-source: warning: ignoring deletion of directory share/create-launcher/data
dpkg-source: warning: ignoring deletion of file share/create-launcher/data/gui.glade
dpkg-source: warning: ignoring deletion of directory share/create-launcher/images
dpkg-source: warning: ignoring deletion of file share/create-launcher/images/icon_48x48.png
dpkg-source: warning: ignoring deletion of directory share/create-launcher/bin
dpkg-source: warning: ignoring deletion of file share/create-launcher/bin/message_dialog.py
dpkg-source: warning: ignoring deletion of file share/create-launcher/bin/create_launcher.py
dpkg-source: warning: ignoring deletion of file share/create-launcher/bin/callbacks.py
dpkg-source: warning: ignoring deletion of file share/create-launcher/bin/make_launcher.py
dpkg-source: warning: ignoring deletion of file share/create-launcher/bin/file_handler.py
dpkg-source: warning: newly created empty file 'usr/share/applications/create-launcher.desktop' will not be represented in diff
dpkg-source: error: cannot represent change to create-launcher-0.1.2+alpha/usr/share/create-launcher/images/icon_48x48.png: binary file contents changed
dpkg-source: error: add usr/share/create-launcher/images/icon_48x48.png in debian/source/include-binaries if you want to store the modified binary in the debian tarball
dpkg-source: error: cannot represent change to create-launcher-0.1.2+alpha/usr/share/create-launcher/bin/file_handler.pyc: binary file contents changed
dpkg-source: error: add usr/share/create-launcher/bin/file_handler.pyc in debian/source/include-binaries if you want to store the modified binary in the debian tarball
dpkg-source: warning: executable mode 0755 of 'usr/share/create-launcher/bin/create_launcher.py' will not be represented in diff
dpkg-source: error: cannot represent change to create-launcher-0.1.2+alpha/usr/share/create-launcher/bin/message_dialog.pyc: binary file contents changed
dpkg-source: error: add usr/share/create-launcher/bin/message_dialog.pyc in debian/source/include-binaries if you want to store the modified binary in the debian tarball
dpkg-source: error: cannot represent change to create-launcher-0.1.2+alpha/usr/share/create-launcher/bin/make_launcher.pyc: binary file contents changed
dpkg-source: error: add usr/share/create-launcher/bin/make_launcher.pyc in debian/source/include-binaries if you want to store the modified binary in the debian tarball
dpkg-source: error: cannot represent change to create-launcher-0.1.2+alpha/usr/share/create-launcher/bin/create_launcher.pyc: binary file contents changed
dpkg-source: error: add usr/share/create-launcher/bin/create_launcher.pyc in debian/source/include-binaries if you want to store the modified binary in the debian tarball
dpkg-source: error: cannot represent change to create-launcher-0.1.2+alpha/usr/share/create-launcher/bin/callbacks.pyc: binary file contents changed
dpkg-source: error: add usr/share/create-launcher/bin/callbacks.pyc in debian/source/include-binaries if you want to store the modified binary in the debian tarball
dpkg-source: error: unrepresentable changes to source
dpkg-buildpackage: error: dpkg-source -b create-launcher-0.1.2+alpha gave error exit status 2

Понятия не имею, почему речь идет об "игнорировании удаления общей папки" и так далее. Во-первых, он должен начинаться с папки usr, а не с share. Во-вторых, они не удаляются.

Ни один файл не изменился с тех пор, как я свернул архив, поэтому я не понимаю, почему двоичные файлы делают эту ошибку.

Почему он ищет в разделе share / а не usr /?

Кажется, он умирает еще до запуска части dh_install в dh.

Помощь очень ценится.

Ответы [ 2 ]

10 голосов
/ 13 марта 2012

После долгих чтений, проб и ошибок я понял, что случилось.Я запустил

dpkg-source -b create-launcher_0.1.2+alpha

И по какой-то причине он не смог удалить распакованный каталог файла create-launcher_0.1.2 + alpha.orig.tar.gz, который выглядит как create-launcher-0.1.2+ alpha.orig.6h0gQo.Я посмотрел в нем, и оно началось с папки: share, а не usr, как это должно быть, как я уже упоминал в предыдущем вопросе.Это заставило меня задуматься о том, как я мог запутаться в создании смолы.Конечно же, я собрал его с помощью usr в качестве верхней папки, и он «отрубает» его для сравнения.Мне нужно было собрать tar, используя create-launcher_0.1.2 + alpha / в качестве верхнего каталога.Таким образом, он обрезается, позволяя различать «usr» dir вниз по каждому дереву.

Он все еще не строил правильно.Мне нужна была эта команда:

dpkg-source --include-binaries -b create-launcher_0.1.2+alpha

Я обнаружил, что вы делаете это с параметром "--source-option", например:

debuild -uc -us --source-option=--include-binaries

Это все равно не удалось, потому что мой файл сеанса vim вкаталог / bin показал изменение (я не знаю почему, но мне нужно было его игнорировать. У dpkg-source есть некоторые параметры игнорирования. Эта последняя команда добилась цели:

debuild -uc -us --source-option=--include-binaries --source-option=-isession

Мне удалосьбросьте деб успешно.

Надеюсь, это кому-то поможет. Глупая ошибка с моей стороны. Я должен научиться использовать свои старые сценарии (для создания tar) вместо того, чтобы каждый раз придумывать. Урок усвоен.

1 голос
/ 27 апреля 2014

Не следует включать все файлы *.pyc в ваш пакет с исходным кодом. У Debian есть механизм для их автоматической компиляции при сборке бинарного пакета. На этапе установки убедитесь, что вы поместили все файлы на место или напишите debian/install файл, который это делает.

Существует python аддон для dh, который может автоматически обрабатывать проекты Python, если вы используете стандартный набор инструментов. Вы можете указать dh_make использовать его (это просто опция dh в файле debian/rules, в основном).

...