Probably comes from here:<br>cmCPackDebGenerator.cxx: this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");<br><br>Try setting that variable in your CMakeLists.txt file, too.<br><br><br>
HTH,<br>David<br><br><div class="gmail_quote">On Thu, Feb 10, 2011 at 4:44 PM, Nathan J. Mehl <span dir="ltr"><<a href="mailto:memory@blank.org">memory@blank.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
What I'm trying to do: use cpack to turn a directory of python and shell files into a debian package. The wrinkle: I want the package to install the python files into /usr/lib/python2.6/dist-packages/thingy and the shell scripts into /etc/sv/thingy, and I want to be able to run the entire build process without requiring superuser privileges. In order to do this, I'm using a python virtualenv (<a href="http://pypi.python.org/pypi/virtualenv" target="_blank">http://pypi.python.org/pypi/virtualenv</a>) as the build destination.<br>
<br>The problem: cpack keeps prepending '/usr' to the install paths in install_manifest.txt, and hence in the generated deb package.<br><br>The cmake file, slightly edited for clarity:<br><br><div style="margin-left: 40px;">
PROJECT(thingy)<br><br>SET(VIRTUAL_ENV $ENV{VIRTUAL_ENV})<br>IF(VIRTUAL_ENV)<br> MESSAGE(STATUS "Detected a python virtualenv in use, setting install prefix to ${VIRTUAL_ENV}")<br> SET(CMAKE_INSTALL_PREFIX ${VIRTUAL_ENV} )<br>
ELSE(VIRTUAL_ENV)<br> SET(CMAKE_INSTALL_PREFIX / )<br>ENDIF(VIRTUAL_ENV)<br><br>EXEC_PROGRAM("python -c 'from sys import version; print version[:3]'" OUTPUT_VARIABLE PYTHON_VERSION)<br>SET(thingy_python_install_DIR usr/lib/python${PYTHON_VERSION}/dist-packages/herd)<br>
<br>SET(thingy_python_SOURCES __init__.py main.py)<br>SET(thingy_service_DIR rc )<br><br>INSTALL(FILES ${thingy_python_SOURCES} DESTINATION ${thingy_python_install_DIR})<br>INSTALL(DIRECTORY ${thingy_service_DIR} DESTINATION etc <br>
FILE_PERMISSIONS WORLD_EXECUTE WORLD_READ<br> PATTERN "supervise" EXCLUDE )<br><br># cpack comes at the end<br>SET(CPACK_GENERATOR "DEB")<br>SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0)<br>SET(CPACK_PACKAGE_NAME "thingy")<br>
SET(CPACK_PACKAGE_CONTACT "<a href="mailto:memory@blank.org" target="_blank">memory@blank.org</a>")<br>SET(CPACK_PACKAGE_VENDOR "<a href="http://blank.org" target="_blank">blank.org</a>")<br>SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Thingy Runner")<br>
SET(CPACK_PACKAGE_VERSION_MAJOR "0")<br>SET(CPACK_PACKAGE_VERSION_MINOR "2")<br>SET(CPACK_PACKAGE_INSTALL_DIRECTORY "/")<br>SET(CPACK_TOPLEVEL_TAG "/")<br>SET(CPACK_DEBIAN_PACKAGE_NAME "thingy")<br>
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")<br>SET(CPACK_DEBIAN_PACKAGE_DEPENDS "python")<br>SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "<a href="mailto:memory@blank.org" target="_blank">memory@blank.org</a>")<br>
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA <br> "${CMAKE_CURRENT_SOURCE_DIR}/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/debian/postrm;" <br>)<br>include(CPack)<br clear="all"></div><br>What this produces is a correct direct installation (the files end up in $VIRTUAL_ENV/usr/lib/python2.6), but a broken package:<br>
<br><div style="margin-left: 40px;">$ VIRTUAL_ENV=/home/memory/sandbox cmake ..<br>[standard output elided]<br>-- Detected a python virtualenv in use, setting install prefix to /home/memory/sandbox<br>-- Configuring done<br>
-- Generating done<br>-- Build files have been written to: /home/memory/thingy/build<br><br>$ make install<br>Install the project...<br>-- Install configuration: ""<br>-- Installing: /home/memory/sandbox/usr/lib/python2.6/dist-packages/thingy/__init__.py<br>
-- Installing: /home/memory/sandbox/usr/lib/python2.6/dist-packages/thingy/main.py<br>-- Installing: /home/memory/sandbox/etc/rc<br>-- Installing: /home/memory/sandbox/etc/rc/run<br><br>$ make package<br>Run CPack packaging tool...<br>
CPack: Create package using DEB<br>CPack: Install projects<br>CPack: - Run preinstall target for: thingy<br>CPack: - Install project: thingy<br>CPack: Compress package<br>CPack: Finalize package<br>CPack: Package /home/memory/thingy/build/thingy-0.2-Linux.deb generated.<br>
<br>$ dpkg-deb -c thingy-0.2.0-Linux.deb <br>drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/<br>drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/usr/<br>drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/usr/lib/<br>
drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/usr/lib/python2.6/<br>drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/usr/lib/python2.6/dist-packages/<br>drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/usr/lib/python2.6/dist-packages/thingy/<br>
-rw-r--r-- memory/memory 13054 2011-02-03 20:52 ./usr/usr/lib/python2.6/dist-packages/thingy/job.py<br>-rw-r--r-- memory/memory 22 2011-02-03 20:52 ./usr/usr/lib/python2.6/dist-packages/thingy/__init__.py<br>-rw-r--r-- memory/memory 1063 2011-02-03 20:52 ./usr/usr/lib/python2.6/dist-packages/thingy/control.py<br>
-rw-r--r-- memory/memory 5347 2011-02-03 20:52 ./usr/usr/lib/python2.6/dist-packages/thingy/main.py<br>-rw-r--r-- memory/memory 2971 2011-02-03 20:52 ./usr/usr/lib/python2.6/dist-packages/thingy/util.py <br>drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/etc/<br>
drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/etc/rc/<br>-r-xr-xr-x memory/memory 595 2011-02-10 01:15 ./usr/etc/rc/run<br><br></div>Note the extra /usr prepended to all of the paths inside the debian package. If I build the package <i>without</i> $VIRTUAL_ENV being set, the same thing happens.<br>
<br>I've trawled a bit through the various CPack module files, but can't see where that /usr is coming from.<br><br>A helpful person on the cmake IRC channel suggested setting CPACK_SET_DESTDIR to ON: this solves the problem only in the case of $VIRTUAL_ENV being unset; if it's set, the package ends up being installed into a duplicate of the install directory, ie:<br>
<br><div style="margin-left: 40px;">$ dpkg-deb -c herd-0.2.0-Linux.deb<br>drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/<br>drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/memory/<br>drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/memory/sandbox/<br>
drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/memory/sandbox/usr/<br>drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/memory/sandbox/usr/lib/<br>drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/memory/sandbox/usr/lib/python2.6/<br>
drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/memory/sandbox/usr/lib/python2.6/dist-packages/<br>drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/memory/sandbox/usr/lib/python2.6/dist-packages/herd/<br>-rw-r--r-- memory/memory 22 2011-02-03 20:52 ./home/memory/sandbox/usr/lib/python2.6/dist-packages/herd/__init__.py<br>
</div><br>So... where the heck is cpack picking up that /usr from?<br><font color="#888888"><br><br>-- <br>Everyone knows history moves in circles;<br>the surprise is how big the circles are.<br> (--Greil Marcus)<br><br>
</font><br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br></blockquote></div><br>