These three fields should be grouped together.

Signed-off-by: Allan McRae <[email protected]>
---
 doc/PKGBUILD.5.txt     | 10 +++++-----
 scripts/repo-add.sh.in | 41 +++++++++++++++++++++++++++++++++++++----
 2 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index a1d42fd..bc278f2 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -64,11 +64,6 @@ below).
        software release and incremented for intermediate PKGBUILD updates. The
        variable is not allowed to contain hyphens.
 
-*pkgdesc*::
-       This should be a brief description of the package and its functionality.
-       Try to keep the description to one line of text and to not use the 
package's
-       name.
-
 *epoch*::
        Used to force the package to be seen as newer than any previous versions
        with a lower epoch, even if the version number would normally not 
trigger
@@ -78,6 +73,11 @@ below).
        version comparison logic. See linkman:pacman[8] for more information on
        version comparisons.
 
+*pkgdesc*::
+       This should be a brief description of the package and its functionality.
+       Try to keep the description to one line of text and to not use the 
package's
+       name.
+
 *url*::
        This field contains a URL that is associated with the software being
        packaged. This is typically the project's web site.
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index c7923ec..013fce5 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -465,6 +465,27 @@ db_write_entry() {
        return 0
 } # end db_write_entry
 
+db_write_source() {
+       # blank out all variables
+       local sourcefile=$1
+       local -a _licenses _source _noextract _md5sums _sha1sums _sha256sums \
+       _sha384sums, _sha512sums, _groups _arch _backup _depends _makedepends \
+       _checkdepends _optdepends _conflicts _provides _replaces _options
+       local pkgbase pkgver pkgrel pkgdesc epoch url install changelog \
+               md5sum sha256sum pgpsig pgpsigsize
+
+       # read info from the zipped package
+       local line var val
+       while read -r line; do
+               [[ ${line:0:1} = '#' ]] && continue
+               IFS=' =' read -r var val < <(printf '%s\n' "$line")
+
+
+       done< <(bsdtar -xOqf "$pkgfile" .PKGINFO)
+
+       return 0
+}
+
 # remove existing entries from the DB
 #   arg1 - package name
 db_remove_entry() {
@@ -484,6 +505,10 @@ db_remove_entry() {
                local filesentry=$(echo "$pkgentry" | sed 
's/\(.*\)\/db\//\1\/files\//')
                rm -rf "$filesentry"
 
+               # remove entries in "files" database
+               local sourceentry=$(echo "$pkgentry" | sed 
's/\(.*\)\/db\//\1\/sourceq\//')
+               rm -rf "$sourceentry"
+
                pkgentry=$(find_pkgentry "$pkgname")
        done
        return $notfound
@@ -524,7 +549,7 @@ prepare_repo_db() {
                exit 1
        fi
 
-       for repo in "db" "files"; do
+       for repo in "db" "files" "source"; do
                dbfile=${repodir}/$REPO_DB_PREFIX.$repo.$REPO_DB_SUFFIX
 
                if [[ -f $dbfile ]]; then
@@ -579,6 +604,14 @@ add() {
                fi
        fi
 
+       if [[ $1 == *.db.tar* ]]; then
+               srcfile=$1
+               msg "$(gettext "Adding source package '%s'")" "$srcfile"
+               if db_write_source "$srcfile"; then
+                       return 0
+               else
+                       return 1
+
        pkgfile=$1
        if ! bsdtar -tqf "$pkgfile" .PKGINFO >/dev/null 2>&1; then
                error "$(gettext "'%s' is not a package file, skipping")" 
"$pkgfile"
@@ -619,7 +652,7 @@ rotate_db() {
 
        pushd $dirname >/dev/null
 
-       for repo in "db" "files"; do
+       for repo in "db" "files" "source"; do
                filename=${REPO_DB_PREFIX}.${repo}.${REPO_DB_SUFFIX}
                tempname=$dirname/.tmp.$filename
 
@@ -663,7 +696,7 @@ create_db() {
        # $LOCKFILE is already guaranteed to be absolute so this is safe
        dirname=${LOCKFILE%/*}
 
-       for repo in "db" "files"; do
+       for repo in "db" "files" "source"; do
                filename=${REPO_DB_PREFIX}.${repo}.${REPO_DB_SUFFIX}
                # this ensures we create it on the same filesystem, making 
moves atomic
                tempname=$dirname/.tmp.$filename
@@ -734,7 +767,7 @@ tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/repo-tools.XXXXXXXXXX") 
|| (\
        error "$(gettext "Cannot create temp directory for database 
building.")"; \
        exit 1)
 
-for repo in "db" "files"; do
+for repo in "db" "files" "source"; do
        mkdir "$tmpdir/$repo"
 done
 
-- 
2.3.3

Reply via email to