Probably comes from here:
cmCPackDebGenerator.cxx:
this->SetOptionIfNotSet("CPACK_PACKAGING_INSTALL_PREFIX", "/usr");Try setting that variable in your CMakeLists.txt file, too. HTH, David On Thu, Feb 10, 2011 at 4:44 PM, Nathan J. Mehl <[email protected]> wrote: > 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 (http://pypi.python.org/pypi/virtualenv) as the > build destination. > > The problem: cpack keeps prepending '/usr' to the install paths in > install_manifest.txt, and hence in the generated deb package. > > The cmake file, slightly edited for clarity: > > PROJECT(thingy) > > SET(VIRTUAL_ENV $ENV{VIRTUAL_ENV}) > IF(VIRTUAL_ENV) > MESSAGE(STATUS "Detected a python virtualenv in use, setting install > prefix to ${VIRTUAL_ENV}") > SET(CMAKE_INSTALL_PREFIX ${VIRTUAL_ENV} ) > ELSE(VIRTUAL_ENV) > SET(CMAKE_INSTALL_PREFIX / ) > ENDIF(VIRTUAL_ENV) > > EXEC_PROGRAM("python -c 'from sys import version; print version[:3]'" > OUTPUT_VARIABLE PYTHON_VERSION) > SET(thingy_python_install_DIR > usr/lib/python${PYTHON_VERSION}/dist-packages/herd) > > SET(thingy_python_SOURCES __init__.py main.py) > SET(thingy_service_DIR rc ) > > INSTALL(FILES ${thingy_python_SOURCES} DESTINATION > ${thingy_python_install_DIR}) > INSTALL(DIRECTORY ${thingy_service_DIR} DESTINATION etc > FILE_PERMISSIONS WORLD_EXECUTE WORLD_READ > PATTERN "supervise" EXCLUDE ) > > # cpack comes at the end > SET(CPACK_GENERATOR "DEB") > SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) > SET(CPACK_PACKAGE_NAME "thingy") > SET(CPACK_PACKAGE_CONTACT "[email protected]") > SET(CPACK_PACKAGE_VENDOR "blank.org") > SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Thingy Runner") > SET(CPACK_PACKAGE_VERSION_MAJOR "0") > SET(CPACK_PACKAGE_VERSION_MINOR "2") > SET(CPACK_PACKAGE_INSTALL_DIRECTORY "/") > SET(CPACK_TOPLEVEL_TAG "/") > SET(CPACK_DEBIAN_PACKAGE_NAME "thingy") > SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") > SET(CPACK_DEBIAN_PACKAGE_DEPENDS "python") > SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "[email protected]") > SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA > > "${CMAKE_CURRENT_SOURCE_DIR}/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/debian/postrm;" > > ) > include(CPack) > > What this produces is a correct direct installation (the files end up in > $VIRTUAL_ENV/usr/lib/python2.6), but a broken package: > > $ VIRTUAL_ENV=/home/memory/sandbox cmake .. > [standard output elided] > -- Detected a python virtualenv in use, setting install prefix to > /home/memory/sandbox > -- Configuring done > -- Generating done > -- Build files have been written to: /home/memory/thingy/build > > $ make install > Install the project... > -- Install configuration: "" > -- Installing: > /home/memory/sandbox/usr/lib/python2.6/dist-packages/thingy/__init__.py > -- Installing: > /home/memory/sandbox/usr/lib/python2.6/dist-packages/thingy/main.py > -- Installing: /home/memory/sandbox/etc/rc > -- Installing: /home/memory/sandbox/etc/rc/run > > $ make package > Run CPack packaging tool... > CPack: Create package using DEB > CPack: Install projects > CPack: - Run preinstall target for: thingy > CPack: - Install project: thingy > CPack: Compress package > CPack: Finalize package > CPack: Package /home/memory/thingy/build/thingy-0.2-Linux.deb generated. > > $ dpkg-deb -c thingy-0.2.0-Linux.deb > drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/ > drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/usr/ > drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/usr/lib/ > drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/usr/lib/python2.6/ > drwxr-xr-x memory/memory 0 2011-02-10 21:23 > ./usr/usr/lib/python2.6/dist-packages/ > drwxr-xr-x memory/memory 0 2011-02-10 21:23 > ./usr/usr/lib/python2.6/dist-packages/thingy/ > -rw-r--r-- memory/memory 13054 2011-02-03 20:52 > ./usr/usr/lib/python2.6/dist-packages/thingy/job.py > -rw-r--r-- memory/memory 22 2011-02-03 20:52 > ./usr/usr/lib/python2.6/dist-packages/thingy/__init__.py > -rw-r--r-- memory/memory 1063 2011-02-03 20:52 > ./usr/usr/lib/python2.6/dist-packages/thingy/control.py > -rw-r--r-- memory/memory 5347 2011-02-03 20:52 > ./usr/usr/lib/python2.6/dist-packages/thingy/main.py > -rw-r--r-- memory/memory 2971 2011-02-03 20:52 > ./usr/usr/lib/python2.6/dist-packages/thingy/util.py > drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/etc/ > drwxr-xr-x memory/memory 0 2011-02-10 21:23 ./usr/etc/rc/ > -r-xr-xr-x memory/memory 595 2011-02-10 01:15 ./usr/etc/rc/run > > Note the extra /usr prepended to all of the paths inside the debian > package. If I build the package *without* $VIRTUAL_ENV being set, the > same thing happens. > > I've trawled a bit through the various CPack module files, but can't see > where that /usr is coming from. > > 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: > > $ dpkg-deb -c herd-0.2.0-Linux.deb > drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/ > drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/memory/ > drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/memory/sandbox/ > drwxr-xr-x memory/memory 0 2011-02-10 21:32 ./home/memory/sandbox/usr/ > drwxr-xr-x memory/memory 0 2011-02-10 21:32 > ./home/memory/sandbox/usr/lib/ > drwxr-xr-x memory/memory 0 2011-02-10 21:32 > ./home/memory/sandbox/usr/lib/python2.6/ > drwxr-xr-x memory/memory 0 2011-02-10 21:32 > ./home/memory/sandbox/usr/lib/python2.6/dist-packages/ > drwxr-xr-x memory/memory 0 2011-02-10 21:32 > ./home/memory/sandbox/usr/lib/python2.6/dist-packages/herd/ > -rw-r--r-- memory/memory 22 2011-02-03 20:52 > ./home/memory/sandbox/usr/lib/python2.6/dist-packages/herd/__init__.py > > So... where the heck is cpack picking up that /usr from? > > > -- > Everyone knows history moves in circles; > the surprise is how big the circles are. > (--Greil Marcus) > > > _______________________________________________ > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake >
_______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
