Extend the pkgindex plist file with some new objects.
--HG-- extra : convert_revision : ee311e4c0821a43de3dcc464a91550f7b1917024
This commit is contained in:
parent
f07233018b
commit
a4c1f17a56
|
@ -3,7 +3,16 @@ an index file describing the information about available packages.
|
|||
|
||||
The structure for this file is just the same than the plist file used
|
||||
to register installed packages, aka "an array of dictionaries" and
|
||||
a "dictionary per package".
|
||||
a "dictionary per package". Additional objects are added into the
|
||||
main dictionary to specify more info, like:
|
||||
|
||||
- pkgindex-version: version used to build the index.
|
||||
- location-local: local path to the repository.
|
||||
- location-remote: remote URI repository.
|
||||
- total-pkgs: total of number of available packages.
|
||||
|
||||
"location-local" will always be created, and it might be exported via
|
||||
a remote location specified with "location-remote".
|
||||
|
||||
The package dictionary will be the same than the one available in
|
||||
package's metadata directory "/var/cache/xbps/$pkgname/props.plist",
|
||||
|
@ -13,7 +22,15 @@ the repository itself.
|
|||
Here's how the package index plist file shall look like in a repository:
|
||||
|
||||
<dict>
|
||||
<key>xbps_available_packages</key>
|
||||
<key>pkgindex-version</key>
|
||||
<string>1.0</string>
|
||||
<key>location-local</key>
|
||||
<string>/xbps/repo/local</string>
|
||||
<key>location-remote</key>
|
||||
<string>http://www.xbps-remote.org/repo/public</string>
|
||||
<key>total-pkgs</key>
|
||||
<integer>666</integer>
|
||||
<key>available-packages</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>pkgname</key>
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#-
|
||||
|
||||
XBPS_PKGINDEX_VERSION="1.0" # Current version for pkgindex plist
|
||||
|
||||
#
|
||||
# These functions write a package index for a repository, with details about
|
||||
# all available binary packages.
|
||||
|
@ -72,7 +74,7 @@ write_repo_pkgindex()
|
|||
pkgsum=$(($pkgsum + 1))
|
||||
done
|
||||
|
||||
write_repo_pkgindex_footer $pkgindexf
|
||||
write_repo_pkgindex_footer $pkgindexf $pkgsum
|
||||
if [ $? -eq 0 ]; then
|
||||
$XBPS_REGPKGDB_CMD sanitize-plist $pkgindexf
|
||||
[ $? -ne 0 ] && rm -f $pkgindexf && rm -rf $tmppkgdir && exit 1
|
||||
|
@ -97,7 +99,11 @@ write_repo_pkgindex_header()
|
|||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>xbps_available_packages</key>
|
||||
<key>pkgindex-version</key>
|
||||
<string>$XBPS_PKGINDEX_VERSION</string>
|
||||
<key>location-local</key>
|
||||
<string>$XBPS_PACKAGESDIR</string>
|
||||
<key>available-packages</key>
|
||||
<array>
|
||||
_EOF
|
||||
}
|
||||
|
@ -105,11 +111,14 @@ _EOF
|
|||
write_repo_pkgindex_footer()
|
||||
{
|
||||
local file="$1"
|
||||
local totalpkgs="$2"
|
||||
|
||||
[ -z "$file" ] && return 1
|
||||
[ -z "$file" -o -z "$totalpkgs" ] && return 1
|
||||
|
||||
cat >> $file <<_EOF
|
||||
</array>
|
||||
<key>total-pkgs</key>
|
||||
<integer>$totalpkgs</integer>
|
||||
</dict>
|
||||
</plist>
|
||||
_EOF
|
||||
|
|
Loading…
Reference in New Issue