From 9ee5154685e24bd588ae792af1e285e06a1f9dfc Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 03:50:54 +0200 Subject: vendor/getinfo: Provide command to determine vendor to use Introduce the 'current' command to eventually replace the current symbolic link. The current command does roughly the same as the makefile, the code has just been cleaned up a bit to work better as a shell function. Gbp-Dch: ignore --- vendor/getinfo | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'vendor') diff --git a/vendor/getinfo b/vendor/getinfo index 79da83620..4f94d7c42 100755 --- a/vendor/getinfo +++ b/vendor/getinfo @@ -2,7 +2,41 @@ # small helper to extract information form *.ent files BASEDIR="$(readlink -f "$(dirname $0)")" -INFO="$(readlink -f "${BASEDIR}/current/apt-vendor.ent")" + +getcurrent() { + # search for an exact match to use the correct sources.list example + cd $BASEDIR + DISTROS="$(find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2)" + for DISTRO in $DISTROS; do + if dpkg-vendor --is $DISTRO; then + echo $DISTRO + return 0 + fi + done + + # if we haven't found a specific, look for a deriving + # we do ubuntu and debian last as those are the biggest families + # and would therefore potentially 'shadow' smaller families + # (especially debian as it sorts quiet early) + for DISTRO in $DISTROS; do + if [ "$DISTRO" = 'debian' -o "$DISTRO" = 'ubuntu' ]; then continue; fi + if dpkg-vendor --derives-from $DISTRO; then + echo $DISTRO + return 0 + fi + done + + # Do the ubuntu/debian dance we talked about + if dpkg-vendor --derives-from ubuntu; then + echo $DISTRO + return 0 + fi + + echo debian + return 0 +} + +INFO="$(readlink -f "${BASEDIR}/$(getcurrent)/apt-vendor.ent")" VERBATIM="${BASEDIR}/../doc/apt-verbatim.ent" if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then @@ -33,6 +67,10 @@ vendor) verbatim) getfield "$2" "$VERBATIM" ;; + +current) + getcurrent + ;; *) echo >&2 "Unknown data field $1 requested" exit 2 -- cgit v1.2.3 From f7a46d97368044e8a69f5a51067b5a0e12241d42 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 20:16:38 +0200 Subject: vendor/getinfo: Teach it about sourceslist-list-format This makes it easier to write a generic subsitution tool for handling substitutions in apt-key.in and sources.list.in Gbp-Dch: ignore --- vendor/getinfo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'vendor') diff --git a/vendor/getinfo b/vendor/getinfo index 4f94d7c42..504b086af 100755 --- a/vendor/getinfo +++ b/vendor/getinfo @@ -58,7 +58,7 @@ case "$1" in debian-stable-codename|debian-oldstable-codename|debian-testing-codename|ubuntu-codename) getrawfield "$1" "$VERBATIM" ;; -keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-codename) +sourceslist-list-format|keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-codename) exec $0 'vendor' "$@" ;; vendor) -- cgit v1.2.3 From f3de2dbaf657f9040a4da448c57267de0fef7d33 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 21:03:43 +0200 Subject: CMake: Add basic CMake build system Introduce an initial CMake buildsystem. This build system can build a fully working apt system without translation or documentation. The FindBerkelyDB module is from kdelibs, with some small adjustements to also look in db5 directories. Initial work on this CMake build system started in 2009, and was resumed in August 2016. --- vendor/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 vendor/CMakeLists.txt (limited to 'vendor') diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt new file mode 100644 index 000000000..72aad49e1 --- /dev/null +++ b/vendor/CMakeLists.txt @@ -0,0 +1,33 @@ +# Determine the current vendor, export to CURRENT_VENDOR +execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getinfo current + OUTPUT_VARIABLE CURRENT_VENDOR OUTPUT_STRIP_TRAILING_WHITESPACE) +set(CURRENT_VENDOR ${CURRENT_VENDOR} PARENT_SCOPE) + +message(STATUS "Detected vendor: ${CURRENT_VENDOR}") + +# Handle sources.list example +add_vendor_file(OUTPUT sources.list + INPUT "${CURRENT_VENDOR}/sources.list.in" + MODE 644 + VARIABLES sourceslist-list-format + debian-stable-codename + debian-oldstable-codename + debian-testing-codename + ubuntu-codename + current-codename) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sources.list + DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples) + +# Handle apt.conf snippets +file(GLOB conffiles ${CURRENT_VENDOR}/apt.conf-*) +foreach(file ${conffiles}) + file(RELATIVE_PATH confname ${CMAKE_CURRENT_SOURCE_DIR}/${CURRENT_VENDOR}/ ${file}) + string(REPLACE "apt.conf-" "" confname "${confname}") + install(FILES "${file}" + DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/apt/apt.conf.d/" + RENAME "${confname}") +endforeach() + +if (EXISTS "${CURRENT_VENDOR}/CMakeLists.txt") + add_subdirectory(${CURRENT_VENDOR}) +endif() -- cgit v1.2.3 From 79635b696b1ca113d0527d4afe96908eada5cc48 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 03:32:12 +0200 Subject: vendor/getinfo: Accept --vendor VENDOR option This can be used to query a field for a specific vendor. It also speeds up things a lot if we can cache the current vendor in cmake and pass it to further getinfo invocations. Gbp-Dch: ignore --- vendor/getinfo | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'vendor') diff --git a/vendor/getinfo b/vendor/getinfo index 504b086af..37e0c1480 100755 --- a/vendor/getinfo +++ b/vendor/getinfo @@ -36,7 +36,13 @@ getcurrent() { return 0 } -INFO="$(readlink -f "${BASEDIR}/$(getcurrent)/apt-vendor.ent")" +if [ "$1" = "--vendor" ]; then + CURRENT_VENDOR="$2" + shift 2 +else + CURRENT_VENDOR=$(getcurrent) +fi +INFO="$(readlink -f "${BASEDIR}/$CURRENT_VENDOR/apt-vendor.ent")" VERBATIM="${BASEDIR}/../doc/apt-verbatim.ent" if [ -z "$INFO" ] || [ ! -e "$INFO" ]; then @@ -59,7 +65,7 @@ debian-stable-codename|debian-oldstable-codename|debian-testing-codename|ubuntu- getrawfield "$1" "$VERBATIM" ;; sourceslist-list-format|keyring-package|keyring-filename|keyring-master-filename|keyring-removed-filename|keyring-uri|current-codename) - exec $0 'vendor' "$@" + exec $0 --vendor $CURRENT_VENDOR 'vendor' "$@" ;; vendor) getfield "$2" @@ -67,9 +73,8 @@ vendor) verbatim) getfield "$2" "$VERBATIM" ;; - current) - getcurrent + echo $CURRENT_VENDOR ;; *) echo >&2 "Unknown data field $1 requested" -- cgit v1.2.3 From 0fead28404498f42324dd86b4246d35af8905ed3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 7 Aug 2016 03:33:11 +0200 Subject: CMake: Cache CURRENT_VENDOR and make it configurable Cache the current vendor, so we do not have to rerun getinfo when reconfiguring stuff. This also has the nice effect of making the vendor configurable, so you can manually specify it on a platform that might not have dpkg (not that building without dpkg works yet). Gbp-Dch: ignore --- vendor/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'vendor') diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt index 72aad49e1..8246c725a 100644 --- a/vendor/CMakeLists.txt +++ b/vendor/CMakeLists.txt @@ -1,9 +1,13 @@ # Determine the current vendor, export to CURRENT_VENDOR -execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getinfo current - OUTPUT_VARIABLE CURRENT_VENDOR OUTPUT_STRIP_TRAILING_WHITESPACE) -set(CURRENT_VENDOR ${CURRENT_VENDOR} PARENT_SCOPE) +if (NOT DEFINED CURRENT_VENDOR) + execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/getinfo current + OUTPUT_VARIABLE CURRENT_VENDOR_OUT OUTPUT_STRIP_TRAILING_WHITESPACE) -message(STATUS "Detected vendor: ${CURRENT_VENDOR}") + set(CURRENT_VENDOR "${CURRENT_VENDOR_OUT}" CACHE STRING "Select the system vendor") + message(STATUS "Detected vendor: ${CURRENT_VENDOR_OUT}") +else() + message(STATUS "Detected vendor: ${CURRENT_VENDOR} (cached)") +endif() # Handle sources.list example add_vendor_file(OUTPUT sources.list -- cgit v1.2.3 From c85c4bed0a4b32ee2dcbd86ea819e39f3d8beb84 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 17:40:01 +0200 Subject: Get rid of the old buildsystem Bye, bye, old friend. --- vendor/makefile | 58 -------------------------------------------------- vendor/vendor.makefile | 28 ------------------------ 2 files changed, 86 deletions(-) delete mode 100644 vendor/makefile delete mode 100644 vendor/vendor.makefile (limited to 'vendor') diff --git a/vendor/makefile b/vendor/makefile deleted file mode 100644 index 966c3d080..000000000 --- a/vendor/makefile +++ /dev/null @@ -1,58 +0,0 @@ -# -*- make -*- -BASE=.. -SUBDIR=vendor - -# Bring in the default rules -include ../buildlib/defaults.mak - -all headers library binary program doc manpages docbook test update-po startup dirs: current -all: all/subdirs -binary: binary/subdirs -doc: doc/subdirs -clean: clean/subdirs -veryclean: veryclean/subdirs -dirs: dirs/subdirs -manpages: manpages/subdirs - -all/subdirs binary/subdirs doc/subdirs dirs/subdirs manpages/subdirs clean/subdirs veryclean/subdirs: - test ! -e current/makefile || $(MAKE) -C current $(patsubst %/subdirs,%,$@) - test ! -e current/makefile.auto || $(MAKE) -C current -f makefile.auto $(patsubst %/subdirs,%,$@) - -current: - rm -f $@ - # search for an exact match to use the correct sources.list example - find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do \ - if dpkg-vendor --is $$DISTRO; then \ - ln -s $$DISTRO $@; \ - break; \ - fi; \ - done - # if we haven't found a specific, look for a deriving - # we do ubuntu and debian last as those are the biggest families - # and would therefore potentially 'shadow' smaller families - # (especially debian as it sorts quiet early) - if ! test -e $@; then \ - find -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | while read DISTRO; do \ - if [ "$$DISTRO" = 'debian' -o "$$DISTRO" = 'ubuntu' ]; then continue; fi; \ - if dpkg-vendor --derives-from $$DISTRO; then \ - ln -s $$DISTRO $@; \ - break; \ - fi; \ - done; \ - test -e $@ || \ - (dpkg-vendor --derives-from ubuntu && cp ln -s ubuntu $@ ) || \ - ln -s debian $@; \ - fi - if test ! -e current/makefile; then \ - sed "s#@@VENDOR@@#$(notdir $(shell readlink -f current))#" vendor.makefile > current/makefile.auto; \ - fi - -.PHONY: clean veryclean all binary vendor - -clean: clean/current -clean/current: clean/subdirs - rm -f current/makefile.auto current - -veryclean: veryclean/current -veryclean/current: veryclean/subdirs - rm -f current/makefile.auto current diff --git a/vendor/vendor.makefile b/vendor/vendor.makefile deleted file mode 100644 index 32de3b0d5..000000000 --- a/vendor/vendor.makefile +++ /dev/null @@ -1,28 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=vendor/@@VENDOR@@ - -# Bring in the default rules -include ../../buildlib/defaults.mak - -doc binary manpages: sources.list - -sources.list: sources.list.in ../../doc/apt-verbatim.ent - while read line; do \ - if [ "$${line}" = '&sourceslist-list-format;' ]; then \ - $(BASE)/vendor/getinfo vendor sourceslist-list-format ; \ - else \ - echo "$${line}"; \ - fi \ - done < $< | sed -e 's#&debian-stable-codename;#$(shell ../getinfo debian-stable-codename)#g' \ - -e 's#&debian-oldstable-codename;#$(shell ../getinfo debian-oldstable-codename)#g' \ - -e 's#&debian-testing-codename;#$(shell ../getinfo debian-testing-codename)#g' \ - -e 's#&ubuntu-codename;#$(shell ../getinfo ubuntu-codename)#g' \ - -e 's#¤t-codename;#$(shell ../getinfo current-codename)#g' \ - > $@ - -clean: clean/sources.list -veryclean: clean/sources.list - -clean/sources.list: - rm -f sources.list -- cgit v1.2.3