# CPACK\_RPM\_EXCLUDE\_FROM\_AUTO\_FILELIST ignored?

**URL:** https://discourse.cmake.org/t/cpack-rpm-exclude-from-auto-filelist-ignored/1503
**Category:** Usage
**Tags:** os:linux
**Created:** [July 7, 2020, 7:57pm UTC](https://discourse.cmake.org/t/cpack-rpm-exclude-from-auto-filelist-ignored/1503 "2020-07-07T19:57:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rickhg12hs](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rickhg12hs/32/743_2.png) [@rickhg12hs](https://discourse.cmake.org/u/rickhg12hs)
#### Post date: [July 7, 2020, 7:57pm UTC](https://discourse.cmake.org/t/cpack-rpm-exclude-from-auto-filelist-ignored/1503/1 "2020-07-07T19:57:38Z")

</div>

Using the latest `cmake`:

```bash
$ cmake --version
cmake version 3.18.20200707-gee781ac

CMake suite maintained and supported by Kitware (kitware.com/cmake).

```

`cmake`ing the `cmake` project from `git clone https://gitlab.kitware.com/cmake/cmake.git` starting with:

```bash
cd cmake
mkdir cmake-build && cd cmake-build
cmake .. -G Ninja -DSPHINX_MAN=ON -DSPHINX_HTML=ON -DCPACK_RPM_PACKAGE_RELEASE_DIST=ON -DCPACK_RPM_FILE_NAME=RPM-DEFAULT -DCPACK_BINARY_RPM=ON -DCPACK_RPM_PACKAGE_RELEASE_DIST=1 -DCPACK_PACKAGING_INSTALL_PREFIX=/usr/local -DCPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST="$(for dir in $(rpm -ql filesystem) ; do [[-d $dir]] && echo -n $dir "" ; done)" -DCMAKE_INSTALL_PREFIX=/usr/local

```

`CPackConfig.cmake` seems OK with a giant `set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "/ /bin /boot ... /var/yp")` line. Or maybe there should be no `"`?

`ninja package` completes without error, but `rpm -qlp cmake-3.18.20200707_gee781ac-1.fc29.x86_64.rpm` shows, among lots of other stuff,

```auto
...
/usr/local
/usr/local/bin
...
/usr/local/doc
...

```

… and lots of other directories that should have been excluded.

`cmake-build/_CPack_Packages/Linux-x86_64/RPM/SPECS/cmake.spec` shows, in part,

```auto
...
%dir "/usr/local"
%dir "/usr/local/bin"
...
%dir "/usr/local/doc"
...

```

How can I `cpack` a RPM and exclude these directories?

---

<div class="post-metadata">

### Author: ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)
#### Post date: [July 7, 2020, 11:51pm UTC](https://discourse.cmake.org/t/cpack-rpm-exclude-from-auto-filelist-ignored/1503/2 "2020-07-07T23:51:42Z")

</div>

auto file list expects a list, you provided a string. try with a list in the form “path;path;path” with no space.

---

<div class="post-metadata">

### Author: ![rickhg12hs](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rickhg12hs/32/743_2.png) [@rickhg12hs](https://discourse.cmake.org/u/rickhg12hs)
#### Post date: [July 8, 2020, 12:43am UTC](https://discourse.cmake.org/t/cpack-rpm-exclude-from-auto-filelist-ignored/1503/3 "2020-07-08T00:43:43Z")

</div>

@hex Thanks! `... -DCPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST=$(for dir in $(rpm -ql filesystem) ; do [[-d $dir]] && echo -n ${dir}\; ; done) ...` seems to fix this problem.

---

<div class="post-metadata">

### Author: ![rickhg12hs](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rickhg12hs/32/743_2.png) [@rickhg12hs](https://discourse.cmake.org/u/rickhg12hs)
#### Post date: [July 8, 2020, 4:57am UTC](https://discourse.cmake.org/t/cpack-rpm-exclude-from-auto-filelist-ignored/1503/4 "2020-07-08T04:57:13Z")

</div>

FYI, my `cmake` incantation that seems to do what I want is:

```bash
cmake .. -G Ninja -DSPHINX_MAN=ON -DSPHINX_HTML=ON -DCPACK_RPM_PACKAGE_RELEASE_DIST=ON -DCPACK_RPM_FILE_NAME=RPM-DEFAULT -DCPACK_BINARY_RPM=ON -DCPACK_RPM_PACKAGE_RELEASE_DIST=ON -DCPACK_PACKAGING_INSTALL_PREFIX=/usr/local -DCPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST=$(for dir in $(rpm -ql filesystem) ; do [[-d $dir]] && echo -n ${dir}\; ; done) -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_DOC_DIR=share/doc/$(grep -o -E 'project\(\w+\)' ../CMakeLists.txt | sed -E 's/project\((\w+)\)/\1/')-$(grep -o -E 'VERSION_MAJOR [0-9]+' ../Source/CMakeVersion.cmake | cut -f2 -d' ').$(grep -o -E 'VERSION_MINOR [0-9]+' ../Source/CMakeVersion.cmake | cut -f2 -d' ') -DCMAKE_INFO_DIR=share/info -DCMAKE_MAN_DIR=share/man

```
