Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F103090508
D42503.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D42503.id.diff
View Options
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -221,3 +221,7 @@
.endif
.endif
.endif
+
+PORTSDB?= ports.db
+db:
+ @${SH} ${.CURDIR}/Tools/make-ports-db.sh ${PORTSDB}
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -618,6 +618,7 @@
# - Create a package for a port and _all_ of its dependencies.
# describe - Try to generate a one-line description for each port for
# use in INDEX files and the like.
+# describe-csv - Generate a CSV representation of the tree
# describe-json - Generate a JSON-compliant representation of each port.
# check-plist - Checks for files missing from the plist, and files in the
# plist that are not installed by the port.
@@ -4399,6 +4400,65 @@
. endif # empty(FLAVORS)
. endif
+. if empty(FLAVORS) || defined(_DESCRIBE_WITH_FLAVOR)
+. if defined(_DESCRIBE_WITH_FLAVOR)
+_PORT_NAME="\"${FLAVOR}-${.CURDIR:T}\""
+. else
+_PORT_NAME="\"${.CURDIR:T}\""
+. endif
+describe-csv:
+ @(${ECHO_CMD} -n ${_PORT_NAME}, ;\
+ ${ECHO_CMD} -n \"${USES:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${FLAVORS:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${OPTIONS_DEFAULT:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${FETCH_DEPENDS:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${EXTRACT_DEPENDS:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${PATCH_DEPENDS:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${BUILD_DEPENDS:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${LIB_DEPENDS:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${RUN_DEPENDS:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${TEST_DEPENDS:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${PKG_DEPENDS:ts,:Q}\", ;\
+ ${ECHO_CMD} -n \"${COMPLETE_OPTIONS_LIST:ts,}\", ;\
+ ${ECHO_CMD} -n \"${CATEGORIES:ts,}\", ;\
+ ${ECHO_CMD} -n \"${LICENSE:ts,}\", ;\
+ ${ECHO_CMD} -n \"${DEPRECATED:Q:S/"/\"\"/g}\", ;\
+ ${ECHO_CMD} -n \"${BROKEN:Q:S/\"/\"\"/g}\", ;\
+ ${ECHO_CMD} -n \"${DISTVERSION}\", ;\
+ ${ECHO_CMD} -n \"${DISTVERSIONPREFIX}\", ;\
+ ${ECHO_CMD} -n \"${DISTVERSIONSUFFIX}\", ;\
+ ${ECHO_CMD} -n \"${EXPIRATION_DATE}\", ;\
+ ${ECHO_CMD} -n \"${FLAVOR}\", ;\
+ ${ECHO_CMD} -n \"${GH_ACCOUNT}\", ;\
+ ${ECHO_CMD} -n \"${GH_PROJECT}\", ;\
+ ${ECHO_CMD} -n \"${GH_TAGNAME}\", ;\
+ ${ECHO_CMD} -n \"${GL_ACCOUNT}\", ;\
+ ${ECHO_CMD} -n \"${GL_COMMIT}\", ;\
+ ${ECHO_CMD} -n \"${GL_PROJECT}\", ;\
+ ${ECHO_CMD} -n \"${GL_SITE}\", ;\
+ ${ECHO_CMD} -n \"${MAINTAINER}\", ;\
+ ${ECHO_CMD} -n \"${MAKEFILES}\", ;\
+ ${ECHO_CMD} -n \"${PKGBASE}\", ;\
+ ${ECHO_CMD} -n \"${PKGNAME}\", ;\
+ ${ECHO_CMD} -n \"${PKGNAMESUFFIX}\", ;\
+ ${ECHO_CMD} -n \"${PKGORIGIN}\", ;\
+ ${ECHO_CMD} -n \"${COMMENT:Q:S/\"/\"\"/g}\", ;\
+ ${ECHO_CMD} -n \"${PORTEPOCH}\", ;\
+ ${ECHO_CMD} -n \"${PORTNAME}\", ;\
+ ${ECHO_CMD} -n \"${PORTREVISION}\", ;\
+ ${ECHO_CMD} -n \"${PORTVERSION}\", ;\
+ ${ECHO_CMD} -n \"${USE_GITHUB}\", ;\
+ ${ECHO_CMD} -n \"${USE_GITLAB}\", ;\
+ ${ECHO_CMD} \"${WWW:Q}\" >> ${INDEX_OUT})
+ #${ECHO_CMD} \"${WWW:Q}\") | ${SED} -e "s|a||g" >> ${INDEX_OUT}
+. else # empty(FLAVORS)
+describe-csv: ${FLAVORS:S/^/describe-csv-/}
+. for f in ${FLAVORS}
+describe-csv-${f}:
+ @cd ${.CURDIR} && ${SETENV} FLAVOR=${f} ${MAKE} -B -D_DESCRIBE_WITH_FLAVOR describe-csv
+. endfor
+. endif # empty(FLAVORS)
+
. if empty(FLAVORS) || defined(_DESCRIBE_WITH_FLAVOR)
. if defined(_DESCRIBE_WITH_FLAVOR)
diff --git a/Mk/bsd.port.subdir.mk b/Mk/bsd.port.subdir.mk
--- a/Mk/bsd.port.subdir.mk
+++ b/Mk/bsd.port.subdir.mk
@@ -300,6 +300,22 @@
. endif
.endif
+_CSV_HEADER="NAME","USES","FLAVORS","OPTIONS_DEFAULT","FETCH_DEPENDS","EXTRACT_DEPENDS","PATCH_DEPENDS","BUILD_DEPENDS","LIB_DEPENDS","RUN_DEPENDS","TEST_DEPENDS","PKG_DEPENDS","COMPLETE_OPTIONS_LIST","CATEGORIES","LICENSE","DEPRECATED","BROKEN","DISTVERSION","DISTVERSIONPREFIX","DISTVERSIONSUFFIX","EXPIRATION_DATE","FLAVOR","GH_ACCOUNT","GH_PROJECT","GH_TAGNAME","GL_ACCOUNT","GL_COMMIT","GL_PROJECT","GL_SITE","MAINTAINER","MAKEFILES","PKGBASE","PKGNAME","PKGNAMESUFFIX","PKGORIGIN","COMMENT","PORTEPOCH","PORTNAME","PORTREVISION","PORTVERSION","USE_GITHUB","USE_GITLAB","WWW"
+describe-csv:
+.if defined(WITH_CSV_HEADER)
+ @(${ECHO_CMD} ${_CSV_HEADER:Q})
+.endif
+ @for sub in ${SUBDIR}; do \
+ if ${TEST} -d ${.CURDIR}/$${sub}; then \
+ cd ${.CURDIR}/$${sub}; \
+ ${MAKE} -B describe-csv || \
+ (${ECHO_CMD} "===> ${DIRPRFX}$${sub} failed" >&2; \
+ exit 1) ;\
+ else \
+ ${ECHO_MSG} "===> ${DIRPRFX}$${sub} non-existent"; \
+ fi; \
+ done
+
# Store last subdir name
_LAST_DIR = ${SUBDIR:[-1]}
describe-json:
diff --git a/Tools/make-ports-db.sh b/Tools/make-ports-db.sh
new file mode 100644
--- /dev/null
+++ b/Tools/make-ports-db.sh
@@ -0,0 +1,9 @@
+#! /bin/sh
+#
+# $1 is the name of the ports database to be created
+
+PORTSDB=${1:-ports.db}
+
+rm "${PORTSDB}" 2>/dev/null
+
+make -DWITH_CSV_HEADER describe-csv | sqlite3 "${PORTSDB}" ".mode csv" ".import /dev/stdin ports"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 21, 8:18 PM (8 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14750903
Default Alt Text
D42503.id.diff (4 KB)
Attached To
Mode
D42503: Create describe-csv and db targets
Attached
Detach File
Event Timeline
Log In to Comment