Check-in [2f8d07b10c]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Quote more filenames
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:2f8d07b10c9ff92e3ff8840d3604fcbeaf834048
User & Date: bdrewery 2013-06-13 21:34:51
Context
2013-06-15
07:48
Add Octave packages database to files that can be modified. check-in: ae593a4534 user: antoine tags: trunk
2013-06-13
21:34
Quote more filenames check-in: 2f8d07b10c user: bdrewery tags: trunk
13:15
Remove pkg_to_pkgname, it never was used check-in: 786148ddec user: bdrewery tags: trunk
Changes

Changes to src/share/poudriere/common.sh.

1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
....
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
....
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
....
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
....
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
....
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
....
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
....
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
		tr '\n' ' ' | sed -e "s,[[:graph:]]*/usr/ports/,,g" \
		-e "s,:[[:graph:]]*,,g" | \
		sort -u || err 1 "Makefile broken: $1"
}

deps_file() {
	[ $# -ne 1 ] && eargs pkg
	local pkg=$1
	local depfile="$(pkg_cache_dir "${pkg}")/deps"

	if [ ! -f "${depfile}" ]; then
		if [ "${PKG_EXT}" = "tbz" ]; then
			injail tar -qxf "/packages/All/${pkg##*/}" -O +CONTENTS | awk '$1 == "@pkgdep" { print $2 }' > "${depfile}"
		else
			injail /poudriere/pkg-static info -qdF "/packages/All/${pkg##*/}" > "${depfile}"
................................................................................
	fi

	echo ${depfile}
}

pkg_get_origin() {
	[ $# -lt 1 ] && eargs pkg
	local pkg=$1
	local originfile="$(pkg_cache_dir "${pkg}")/origin"
	local origin=$2

	if [ ! -f "${originfile}" ]; then
		if [ -z "${origin}" ]; then
			if [ "${PKG_EXT}" = "tbz" ]; then
				origin=$(injail tar -qxf "/packages/All/${pkg##*/}" -O +CONTENTS | \
................................................................................
		read origin < "${originfile}"
	fi
	echo ${origin}
}

pkg_get_dep_origin() {
	[ $# -ne 1 ] && eargs pkg
	local pkg=$1
	local dep_origin_file="$(pkg_cache_dir "${pkg}")/dep_origin"
	local compiled_dep_origins

	if [ ! -f "${dep_origin_file}" ]; then
		if [ "${PKG_EXT}" = "tbz" ]; then
			compiled_dep_origins=$(injail tar -qxf "/packages/All/${pkg##*/}" -O +CONTENTS | \
				awk -F: '$1 == "@comment DEPORIGIN" {print $2}' | tr '\n' ' ')
................................................................................
	fi

	cat "${dep_origin_file}"
}

pkg_get_options() {
	[ $# -ne 1 ] && eargs pkg
	local pkg=$1
	local optionsfile="$(pkg_cache_dir "${pkg}")/options"
	local compiled_options

	if [ ! -f "${optionsfile}" ]; then
		if [ "${PKG_EXT}" = "tbz" ]; then
			compiled_options=$(injail tar -qxf "/packages/All/${pkg##*/}" -O +CONTENTS | \
				awk -F: '$1 == "@comment OPTIONS" {print $2}' | tr ' ' '\n' | \
................................................................................
	cat "${optionsfile}"
}

pkg_cache_data() {
	[ $# -ne 2 ] && eargs pkg origin
	# Ignore errors in here
	set +e
	local pkg=$1
	local origin=$2
	local cachedir="$(pkg_cache_dir "${pkg}")"
	local originfile="${cachedir}/origin"
	local mnt=$(my_path)

	if [ ${PKGNG} -eq 1 -a ! -x ${mnt}/poudriere/pkg-static ]; then
		injail tar xf /packages/Latest/pkg.txz -C / \
................................................................................
	echo ${POUDRIERE_DATA}/cache/${MASTERNAME}
}

# Return the cache dir for the given pkg
# @param string pkg $PKGDIR/All/PKGNAME.PKG_EXT
pkg_cache_dir() {
	[ $# -ne 1 ] && eargs pkg
	local pkg=$1
	local pkg_file=${pkg##*/}

	echo $(cache_dir)/${pkg_file}
}

clear_pkg_cache() {
	[ $# -ne 1 ] && eargs pkg
	local pkg=$1

	rm -fr "$(pkg_cache_dir "${pkg}")"
}

delete_pkg() {
	[ $# -ne 1 ] && eargs pkg
	local pkg=$1

	# Delete the package and the depsfile since this package is being deleted,
	# which will force it to be recreated
	rm -f "${pkg}"
	clear_pkg_cache "${pkg}"
}

................................................................................
# Deleted cached information for stale packages (manually removed)
delete_stale_pkg_cache() {
	local pkgname
	local cachedir=$(cache_dir)
	[ ! -d ${cachedir} ] && return 0
	dirempty ${cachedir} && return 0
	for pkg in ${cachedir}/*.${PKG_EXT}; do
		pkg_file=${pkg##*/}
		# If this package no longer exists in the PKGDIR, delete the cache.
		[ ! -e "${POUDRIERE_DATA}/packages/${MASTERNAME}/All/${pkg_file}" ] &&
			clear_pkg_cache "${pkg}"
	done

	return 0
}
................................................................................
		rm -f "${pkg}"
		return 0
	fi

	mkdir -p "$(pkg_cache_dir "${pkg}")"

	o=$(pkg_get_origin "${pkg}")
	v=${pkg##*-}
	v=${v%.*}
	if [ ! -d "${mnt}/usr/ports/${o}" ]; then
		msg "${o} does not exist anymore. Deleting stale ${pkg##*/}"
		delete_pkg "${pkg}"
		return 0
	fi
	v2=$(cache_get_pkgname ${o})







|







 







|







 







|







 







|







 







|







 







|
|






|






|







 







|







 







|







1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
....
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
....
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
....
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
....
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
....
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
....
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
....
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
		tr '\n' ' ' | sed -e "s,[[:graph:]]*/usr/ports/,,g" \
		-e "s,:[[:graph:]]*,,g" | \
		sort -u || err 1 "Makefile broken: $1"
}

deps_file() {
	[ $# -ne 1 ] && eargs pkg
	local pkg="$1"
	local depfile="$(pkg_cache_dir "${pkg}")/deps"

	if [ ! -f "${depfile}" ]; then
		if [ "${PKG_EXT}" = "tbz" ]; then
			injail tar -qxf "/packages/All/${pkg##*/}" -O +CONTENTS | awk '$1 == "@pkgdep" { print $2 }' > "${depfile}"
		else
			injail /poudriere/pkg-static info -qdF "/packages/All/${pkg##*/}" > "${depfile}"
................................................................................
	fi

	echo ${depfile}
}

pkg_get_origin() {
	[ $# -lt 1 ] && eargs pkg
	local pkg="$1"
	local originfile="$(pkg_cache_dir "${pkg}")/origin"
	local origin=$2

	if [ ! -f "${originfile}" ]; then
		if [ -z "${origin}" ]; then
			if [ "${PKG_EXT}" = "tbz" ]; then
				origin=$(injail tar -qxf "/packages/All/${pkg##*/}" -O +CONTENTS | \
................................................................................
		read origin < "${originfile}"
	fi
	echo ${origin}
}

pkg_get_dep_origin() {
	[ $# -ne 1 ] && eargs pkg
	local pkg="$1"
	local dep_origin_file="$(pkg_cache_dir "${pkg}")/dep_origin"
	local compiled_dep_origins

	if [ ! -f "${dep_origin_file}" ]; then
		if [ "${PKG_EXT}" = "tbz" ]; then
			compiled_dep_origins=$(injail tar -qxf "/packages/All/${pkg##*/}" -O +CONTENTS | \
				awk -F: '$1 == "@comment DEPORIGIN" {print $2}' | tr '\n' ' ')
................................................................................
	fi

	cat "${dep_origin_file}"
}

pkg_get_options() {
	[ $# -ne 1 ] && eargs pkg
	local pkg="$1"
	local optionsfile="$(pkg_cache_dir "${pkg}")/options"
	local compiled_options

	if [ ! -f "${optionsfile}" ]; then
		if [ "${PKG_EXT}" = "tbz" ]; then
			compiled_options=$(injail tar -qxf "/packages/All/${pkg##*/}" -O +CONTENTS | \
				awk -F: '$1 == "@comment OPTIONS" {print $2}' | tr ' ' '\n' | \
................................................................................
	cat "${optionsfile}"
}

pkg_cache_data() {
	[ $# -ne 2 ] && eargs pkg origin
	# Ignore errors in here
	set +e
	local pkg="$1"
	local origin=$2
	local cachedir="$(pkg_cache_dir "${pkg}")"
	local originfile="${cachedir}/origin"
	local mnt=$(my_path)

	if [ ${PKGNG} -eq 1 -a ! -x ${mnt}/poudriere/pkg-static ]; then
		injail tar xf /packages/Latest/pkg.txz -C / \
................................................................................
	echo ${POUDRIERE_DATA}/cache/${MASTERNAME}
}

# Return the cache dir for the given pkg
# @param string pkg $PKGDIR/All/PKGNAME.PKG_EXT
pkg_cache_dir() {
	[ $# -ne 1 ] && eargs pkg
	local pkg="$1"
	local pkg_file="${pkg##*/}"

	echo $(cache_dir)/${pkg_file}
}

clear_pkg_cache() {
	[ $# -ne 1 ] && eargs pkg
	local pkg="$1"

	rm -fr "$(pkg_cache_dir "${pkg}")"
}

delete_pkg() {
	[ $# -ne 1 ] && eargs pkg
	local pkg="$1"

	# Delete the package and the depsfile since this package is being deleted,
	# which will force it to be recreated
	rm -f "${pkg}"
	clear_pkg_cache "${pkg}"
}

................................................................................
# Deleted cached information for stale packages (manually removed)
delete_stale_pkg_cache() {
	local pkgname
	local cachedir=$(cache_dir)
	[ ! -d ${cachedir} ] && return 0
	dirempty ${cachedir} && return 0
	for pkg in ${cachedir}/*.${PKG_EXT}; do
		pkg_file="${pkg##*/}"
		# If this package no longer exists in the PKGDIR, delete the cache.
		[ ! -e "${POUDRIERE_DATA}/packages/${MASTERNAME}/All/${pkg_file}" ] &&
			clear_pkg_cache "${pkg}"
	done

	return 0
}
................................................................................
		rm -f "${pkg}"
		return 0
	fi

	mkdir -p "$(pkg_cache_dir "${pkg}")"

	o=$(pkg_get_origin "${pkg}")
	v="${pkg##*-}"
	v=${v%.*}
	if [ ! -d "${mnt}/usr/ports/${o}" ]; then
		msg "${o} does not exist anymore. Deleting stale ${pkg##*/}"
		delete_pkg "${pkg}"
		return 0
	fi
	v2=$(cache_get_pkgname ${o})