Cmake scripts refactored & README update.
authorTomas Mlcoch <tmlcoch@redhat.com>
Mon, 25 Feb 2013 07:53:08 +0000 (08:53 +0100)
committerTomas Mlcoch <tmlcoch@redhat.com>
Mon, 25 Feb 2013 09:54:54 +0000 (10:54 +0100)
.gitignore
CMakeLists.txt
README [deleted file]
README.md [new file with mode: 0644]
doc/CMakeLists.txt
src/CMakeLists.txt
utils/make_tarball.sh

index e8a6c2b..4c49164 100644 (file)
@@ -20,3 +20,6 @@ _CPack_Packages/
 *_
 src/version.h
 src/createrepo_c.pc
+build/
+doc/html
+doc/latex
index 80015f2..5d06109 100644 (file)
@@ -21,70 +21,21 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
 
 # Find necessare libraries
 
-find_package(GLIB2 REQUIRED)
 find_package(BZip2 REQUIRED)
-find_package(GTHREAD2 REQUIRED)
-find_package(ZLIB REQUIRED)
+find_package(CURL REQUIRED)
 find_package(EXPAT REQUIRED)
-find_package(LibXml2 REQUIRED)
+find_package(GLIB2 REQUIRED)
+find_package(GTHREAD2 REQUIRED)
 find_package(Libmagic REQUIRED)
-find_package(CURL REQUIRED)
+find_package(LibXml2 REQUIRED)
 find_package(LZMA REQUIRED)
 find_package(Sqlite3 REQUIRED)
-
-
-# Check libraries
-
-IF (NOT GLIB2_FOUND)
-    MESSAGE(FATAL_ERROR "No GLIB2 library installed")
-ENDIF (NOT GLIB2_FOUND)
-
-IF (NOT BZIP2_FOUND)
-    MESSAGE(FATAL_ERROR "No BZip2 library installed")
-ENDIF (NOT BZIP2_FOUND)
-
-IF (NOT GTHREAD2_FOUND)
-    MESSAGE(FATAL_ERROR "No GTHREAD2 library installed")
-ENDIF (NOT GTHREAD2_FOUND)
-
-IF (NOT ZLIB_FOUND)
-    MESSAGE(FATAL_ERROR "No Zlib library installed")
-ENDIF (NOT ZLIB_FOUND)
-
-IF (NOT EXPAT_FOUND)
-    MESSAGE(FATAL_ERROR "No Expat library installed")
-ENDIF (NOT EXPAT_FOUND)
-
-IF (NOT LIBXML2_FOUND)
-    MESSAGE(FATAL_ERROR "No LibXml2 library installed")
-ENDIF (NOT LIBXML2_FOUND)
-
-IF (NOT Libmagic_FOUND)
-    MESSAGE(FATAL_ERROR "No Libmagic library installed")
-ENDIF (NOT Libmagic_FOUND)
-
-IF (NOT CURL_FOUND)
-    MESSAGE(FATAL_ERROR "No CURL library installed")
-ENDIF (NOT CURL_FOUND)
-
-IF (NOT LZMA_FOUND)
-    MESSAGE(FATAL_ERROR "No LZMA (xz) library installed")
-ENDIF (NOT LZMA_FOUND)
-
-IF (NOT SQLITE3_FOUND)
-    MESSAGE(FATAL_ERROR "No Sqlite3 library installed")
-ENDIF (NOT SQLITE3_FOUND)
+find_package(ZLIB REQUIRED)
 
 # Add include dirs
 
 include_directories(${GLIB2_INCLUDE_DIRS})
-include_directories(${BZIP2_INCLUDE_DIRS})
-include_directories(${GTHREAD2_INCLUDE_DIRS})
-include_directories(${ZLIB_INCLUDE_DIRS})
-include_directories(${EXPAT_INCLUDE_DIRS})
 include_directories(${LIBXML2_INCLUDE_DIR})
-include_directories(${CURL_INCLUDE_DIR})
-include_directories(${LZMA_INCLUDE_DIR})
 
 
 # rpm:
@@ -120,9 +71,9 @@ INCLUDE(InstallRequiredSystemLibraries)
 
 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C implementation of createrepo")
 SET(CPACK_PACKAGE_VENDOR "Fedora Project")
-SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
+SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
 SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
-SET(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README")
+SET(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
 SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
 SET(CPACK_STRIP_FILES "usr/bin/createrepo_c")
 SET(CPACK_SOURCE_STRIP_FILES "")
@@ -142,9 +93,9 @@ INCLUDE(CPack)
 
 # Other files
 
-SET(CMAKE_INSTALL_PREFIX "/")
-INSTALL(FILES README COPYING
-        DESTINATION "/usr/share/doc/createrepo_c-${VERSION}")
+#SET(CMAKE_INSTALL_PREFIX "/")
+INSTALL(FILES README.md COPYING
+        DESTINATION "share/doc/createrepo_c-${VERSION}")
 INSTALL(FILES createrepo_c.bash
         DESTINATION "/etc/bash_completion.d")
 
@@ -154,7 +105,7 @@ INSTALL(FILES createrepo_c.bash
 find_package(Doxygen)
 if(DOXYGEN_FOUND)
     add_custom_target(doc
-        ${DOXYGEN_EXECUTABLE} Doxyfile.in
+        ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
         COMMENT "Generating API documentation with Doxygen" VERBATIM)
 endif(DOXYGEN_FOUND)
 
@@ -165,15 +116,6 @@ endif(DOXYGEN_FOUND)
 #execute_process(COMMAND bash gen_manpage.sh src/cmd_parser.c ../doc/ WORKING_DIRECTORY utils/)
 
 
-IF (NOT LIB_INSTALL_DIR)
-  SET (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/usr/lib")
-ENDIF (NOT LIB_INSTALL_DIR)
-
-IF (NOT INCLUDE_INSTALL_DIR)
-  SET (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/usr/include")
-ENDIF (NOT INCLUDE_INSTALL_DIR)
-
-
 # Add custom target for tests
 
 ADD_CUSTOM_TARGET(tests)
diff --git a/README b/README
deleted file mode 100644 (file)
index 50f1afa..0000000
--- a/README
+++ /dev/null
@@ -1,89 +0,0 @@
-C implementation of createrepo
-run createrepo -h for usage syntax
-
-
-Differences in behavior between createrepo_c and createrepo:
--------------------------------------------------------------
-
->> Checksums after update
-
-Use case:
-- Repodata in repo/ are has checksum xxx
-- Params: --update --checksum=yyy repo/
-
-createrepo_c result:
-- All package checksums are recalculated into yyy
-
-original createrepo result:
-- Only new and changed packages has yyy checksums
-  other packages has still xxx checksums
-
------------------------------------------------
-
->> Skip symlinks param
-
-Use case:
-- Some packages in repo/ are symlinks
-- Params: --skip-symlinks repo/
-
-createrepo_c result:
-- Symlinked packages are ignored
-
-original createrepo result:
-- Symlinked packages are processed
-  (https://bugzilla.redhat.com/show_bug.cgi?id=828848)
-
------------------------------------------------
-
->> Base path from update-md-path repo
-
-Use case:
-- A somebody else's repo is somewhere
-- The repo items have set a base path to http://foo.com/
-- We want to create metadata for our repo
-- Some packages in our repo are same as packages in somebody else's repo
-- We want to speed up creation of our repodata with
-  combo --update and --update-md-path=somebody_else's_repo
-- Params: --update --update-md-path=ftp://somebody.else/repo our_repo/
-
-createrepo_c results:
-- All our packages have no base path set (if we don't set --baseurl explicitly)
-
-original createrepo result:
-- Some packages in metadata (which was same in our repo and in somebody
-  else's repo) have base path set to http://foo.com/
-- (https://bugzilla.redhat.com/show_bug.cgi?id=875029)
-
------------------------------------------------
-
->> Crippled paths in filelists.xml after update
-
-Use case:
-- A repo with old metadata exists
-- We want to update metadata
-- Params: --update repo/
-
-createrepo_c results:
-- All is fine
-
-original createrepo result:
-- Some paths in filelists.xml are crippled
-  (https://bugzilla.redhat.com/show_bug.cgi?id=835565)
-
------------------------------------------------
-
->> --update leaves behind some old repodata files
-
-Use case:
-- A repo with repodata created with --simple-md-filenames exists
-- We want to update repodata to have checksums in filenames
-- Params: --update repo/
-
-createrepo_c results:
-- All repodata contains checksum in the name
-
-original createrepo result:
-- All repodata contains checksum in the name
-- There are old metadata without checksum in the name too
-- (https://bugzilla.redhat.com/show_bug.cgi?id=836917)
-
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..80e400e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,135 @@
+# createrepo_c
+
+C implementation of createrepo
+
+Run `createrepo -h` for usage syntax.
+
+# Devel tips
+
+## Building for Fedora
+
+Package build requires:
+
+* bzip2 (http://bzip.org/) - in Fedora: bzip2-devel
+* cmake (http://www.cmake.org/) - in Fedora: cmake
+* expat (http://expat.sourceforge.net/) - in Fedora: expat-devel
+* file (http://www.darwinsys.com/file/) - in Fedora: file-devel
+* glib2 (http://developer.gnome.org/glib/) - in Fedora: glib2-devel
+* libcurl (http://curl.haxx.se/libcurl/) - in Fedora: libcurl-devel
+* libxml2 (http://xmlsoft.org/) - in Fedora: libxml2-devel
+* rpm (http://www.rpm.org/) - in Fedora: rpm-devel
+* sqlite3 (https://sqlite.org/) - in Fedora: sqlite-devel
+* xz (http://tukaani.org/xz/) - in Fedora: xz-devel
+* zlib (http://www.zlib.net/) - in Fedora: zlib-devel
+* *Optional:* doxygen (http://doxygen.org/) - in Fedora: doxygen
+
+From your checkout dir:
+
+    mkdir build
+    cd build/
+    cmake ..
+    make
+
+To build the documentation, from the build/ directory:
+    make doc
+
+**Note:** For build with debugging symbols you could use (from the build/ directory):
+
+    cmake -DCMAKE_BUILD_TYPE:STRING=DEBUG .. && make
+
+## Build tarball from current work tree
+
+    utils/make_tarball.sh
+
+## Build tarball from version in remote git
+
+    utils/make_tarball_from_git.sh
+
+## Build RPM package
+
+Modify createrepo_c.spec and run:
+
+    utils/make_rpm.sh .
+
+---------------------------------------------------
+
+# Differences in behavior between createrepo_c and createrepo
+
+## Checksums after update
+
+### Use case:
+- Repodata in repo/ are has checksum xxx
+- Params: --update --checksum=yyy repo/
+
+### createrepo_c result:
+- All package checksums are recalculated into yyy
+
+### original createrepo result:
+- Only new and changed packages has yyy checksums
+  other packages has still xxx checksums
+
+
+## Skip symlinks param
+
+### Use case:
+- Some packages in repo/ are symlinks
+- Params: --skip-symlinks repo/
+
+### createrepo_c result:
+- Symlinked packages are ignored
+
+### original createrepo result:
+- Symlinked packages are processed
+  (https://bugzilla.redhat.com/show_bug.cgi?id=828848)
+
+
+## Base path from update-md-path repo
+
+### Use case:
+- A somebody else's repo is somewhere
+- The repo items have set a base path to http://foo.com/
+- We want to create metadata for our repo
+- Some packages in our repo are same as packages in somebody else's repo
+- We want to speed up creation of our repodata with
+  combo --update and --update-md-path=somebody_else's_repo
+- Params: --update --update-md-path=ftp://somebody.else/repo our_repo/
+
+### createrepo_c results:
+- All our packages have no base path set (if we don't set --baseurl explicitly)
+
+### original createrepo result:
+- Some packages in metadata (which was same in our repo and in somebody
+  else's repo) have base path set to http://foo.com/
+- (https://bugzilla.redhat.com/show_bug.cgi?id=875029)
+
+
+## Crippled paths in filelists.xml after update
+
+### Use case:
+- A repo with old metadata exists
+- We want to update metadata
+- Params: --update repo/
+
+### createrepo_c results:
+- All is fine
+
+### original createrepo result:
+- Some paths in filelists.xml are crippled
+  (https://bugzilla.redhat.com/show_bug.cgi?id=835565)
+
+
+## --update leaves behind some old repodata files
+
+### Use case:
+- A repo with repodata created with --simple-md-filenames exists
+- We want to update repodata to have checksums in filenames
+- Params: --update repo/
+
+### createrepo_c results:
+- All repodata contains checksum in the name
+
+### original createrepo result:
+- All repodata contains checksum in the name
+- There are old metadata without checksum in the name too
+- (https://bugzilla.redhat.com/show_bug.cgi?id=836917)
+
index 3bcee7b..a7177bc 100644 (file)
@@ -1,3 +1,3 @@
 INSTALL(FILES createrepo_c.8.gz mergerepo_c.8.gz
-        DESTINATION /usr/share/man/man8
+        DESTINATION share/man/man8
         COMPONENT bin)
index d211fc5..c68e6d8 100644 (file)
@@ -17,7 +17,6 @@ SET(headers
     compression_wrapper.h
     constants.h
     createrepo_c.h
-#    groupfile.h
     load_metadata.h
     locate_metadata.h
     misc.h
@@ -30,16 +29,17 @@ SET(headers
     xml_dump.h)
 
 ADD_LIBRARY(libcreaterepo_c SHARED ${createrepo_c_SRCS})
-TARGET_LINK_LIBRARIES(libcreaterepo_c ${ZLIB_LIBRARY})
-TARGET_LINK_LIBRARIES(libcreaterepo_c ${RPMDB_LIBRARY})
 TARGET_LINK_LIBRARIES(libcreaterepo_c ${BZIP2_LIBRARIES})
+TARGET_LINK_LIBRARIES(libcreaterepo_c ${CURL_LIBRARY})
+TARGET_LINK_LIBRARIES(libcreaterepo_c ${EXPAT_LIBRARIES})
 TARGET_LINK_LIBRARIES(libcreaterepo_c ${GLIB2_LIBRARIES})
 TARGET_LINK_LIBRARIES(libcreaterepo_c ${Libmagic_LIBRARY})
 TARGET_LINK_LIBRARIES(libcreaterepo_c ${LIBXML2_LIBRARIES})
-TARGET_LINK_LIBRARIES(libcreaterepo_c ${EXPAT_LIBRARIES})
-TARGET_LINK_LIBRARIES(libcreaterepo_c ${CURL_LIBRARY})
 TARGET_LINK_LIBRARIES(libcreaterepo_c ${LZMA_LIBRARIES})
+TARGET_LINK_LIBRARIES(libcreaterepo_c ${RPMDB_LIBRARY})
 TARGET_LINK_LIBRARIES(libcreaterepo_c ${SQLITE3_LIBRARIES})
+TARGET_LINK_LIBRARIES(libcreaterepo_c ${ZLIB_LIBRARY})
+
 
 SET_TARGET_PROPERTIES(libcreaterepo_c PROPERTIES
                       OUTPUT_NAME "createrepo_c"
@@ -48,25 +48,26 @@ SET_TARGET_PROPERTIES(libcreaterepo_c PROPERTIES
 
 ADD_EXECUTABLE(createrepo_c createrepo_c.c cmd_parser.c)
 TARGET_LINK_LIBRARIES(createrepo_c
-                      libcreaterepo_c
-                      ${GLIB2_LIBRARIES}
-                      ${GTHREAD2_LIBRARIES})
+                        libcreaterepo_c
+                        ${GLIB2_LIBRARIES}
+                        ${GTHREAD2_LIBRARIES})
 
 ADD_EXECUTABLE(mergerepo_c mergerepo_c.c)
 TARGET_LINK_LIBRARIES(mergerepo_c
-                      libcreaterepo_c
-                      ${GLIB2_LIBRARIES}
-                      ${GTHREAD2_LIBRARIES})
+                        libcreaterepo_c
+                        ${GLIB2_LIBRARIES}
+                        ${GTHREAD2_LIBRARIES})
 
 CONFIGURE_FILE("createrepo_c.pc.cmake" "${CMAKE_SOURCE_DIR}/src/createrepo_c.pc" @ONLY)
 CONFIGURE_FILE("version.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/version.h" @ONLY)
 
-INSTALL(FILES "createrepo_c.pc"
-    DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
-INSTALL(TARGETS libcreaterepo_c
-        LIBRARY DESTINATION ${LIB_INSTALL_DIR})
-INSTALL(TARGETS createrepo_c
-        DESTINATION usr/bin/)
-INSTALL(TARGETS mergerepo_c
-        DESTINATION usr/bin/)
-INSTALL(FILES ${headers} DESTINATION "${INCLUDE_INSTALL_DIR}/createrepo_c")
+IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+    SET (LIB_SUFFIX "64")
+ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+SET (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
+
+INSTALL(FILES ${headers} DESTINATION "include/createrepo_c")
+INSTALL(FILES "createrepo_c.pc" DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
+INSTALL(TARGETS libcreaterepo_c LIBRARY DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(TARGETS createrepo_c DESTINATION bin/)
+INSTALL(TARGETS mergerepo_c DESTINATION bin/)
index fcab62a..1c7871f 100755 (executable)
@@ -37,10 +37,11 @@ echo "Using root projekt dir: $PREFIX"
 
     cp --verbose CMakeLists.txt $DIRECTORY
     cp --verbose AUTHORS $DIRECTORY
-    cp --verbose README $DIRECTORY
+    cp --verbose README.md $DIRECTORY
     cp --verbose COPYING $DIRECTORY
     cp --verbose createrepo_c.bash $DIRECTORY
     cp --verbose Doxyfile.in $DIRECTORY
+    cp --verbose VERSION.cmake $DIRECTORY
 
     cp --verbose --parents cmake/Modules/* $DIRECTORY
 
@@ -52,6 +53,7 @@ echo "Using root projekt dir: $PREFIX"
     cp --verbose --parents src/createrepo_c.pc.cmake $DIRECTORY
     cp --verbose --parents src/*.c $DIRECTORY
     cp --verbose --parents src/*.h $DIRECTORY
+    cp --verbose --parents src/*.in $DIRECTORY
 
     cp --verbose --parents tests/CMakeLists.txt $DIRECTORY
     cp --verbose --parents tests/*.c $DIRECTORY