[pacman-dev] [PATCH 1/2] makepkg: write makedepends into .PKGINFO
Currently there is no way to access the makedepends for a package apart from parsing its PKGBUILD. Put these into the .PKGINFO file with the idea of making them available in the repo dbs so that automated build tools can readily determine build order. Signed-off-by: Allan McRae <allan@archlinux.org> --- scripts/makepkg.sh.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 28d9073..8d018c0 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1276,6 +1276,8 @@ write_pkginfo() { fi done + [[ $makedepends ]] && printf "makedepend = %s\n" "${makedepends[@]}" + for it in "${packaging_options[@]}"; do check_option "$it" "y" case $? in -- 1.7.10.2
This is useful for tools that automatically rebuild packages and thus require to generate a build order. These entries are skipped by pacman. Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/be_sync.c | 3 +++ scripts/repo-add.sh.in | 27 +++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index f18ba51..92ce456 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -591,6 +591,9 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, READ_AND_SPLITDEP(pkg->depends); } else if(strcmp(line, "%OPTDEPENDS%") == 0) { READ_AND_SPLITDEP(pkg->optdepends); + } else if(strcmp(line, "%MAKEDEPENDS%") == 0) { + /* currently unused */ + READ_NEXT(); } else if(strcmp(line, "%CONFLICTS%") == 0) { READ_AND_SPLITDEP(pkg->conflicts); } else if(strcmp(line, "%PROVIDES%") == 0) { diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 006672a..ba9ba05 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -256,7 +256,8 @@ verify_repo_extension() { db_write_entry() { # blank out all variables local pkgfile=$1 - local -a _groups _licenses _replaces _depends _conflicts _provides _optdepends + local -a _groups _licenses _replaces _depends _conflicts _provides \ + _optdepends _makedepends local pkgname pkgver pkgdesc csize size url arch builddate packager \ md5sum sha256sum pgpsig pgpsigsize @@ -269,13 +270,14 @@ db_write_entry() { # normalize whitespace with an extglob declare "$var=${val//+([[:space:]])/ }" case $var in - group) _groups+=("$group") ;; - license) _licenses+=("$license") ;; - replaces) _replaces+=("$replaces") ;; - depend) _depends+=("$depend") ;; - conflict) _conflicts+=("$conflict") ;; - provides) _provides+=("$provides") ;; - optdepend) _optdepends+=("$optdepend") ;; + group) _groups+=("$group") ;; + license) _licenses+=("$license") ;; + replaces) _replaces+=("$replaces") ;; + depend) _depends+=("$depend") ;; + conflict) _conflicts+=("$conflict") ;; + provides) _provides+=("$provides") ;; + optdepend) _optdepends+=("$optdepend") ;; + makedepend) _makedepends+=("$makedepend") ;; esac done< <(bsdtar -xOqf "$pkgfile" .PKGINFO) @@ -358,10 +360,11 @@ db_write_entry() { # create depends entry msg2 "$(gettext "Creating '%s' db entry...")" 'depends' { - format_entry "DEPENDS" "${_depends[@]}" - format_entry "CONFLICTS" "${_conflicts[@]}" - format_entry "PROVIDES" "${_provides[@]}" - format_entry "OPTDEPENDS" "${_optdepends[@]}" + format_entry "DEPENDS" "${_depends[@]}" + format_entry "CONFLICTS" "${_conflicts[@]}" + format_entry "PROVIDES" "${_provides[@]}" + format_entry "OPTDEPENDS" "${_optdepends[@]}" + format_entry "MAKEDEPENDS" "${_makedepends[@]}" } >'depends' popd >/dev/null -- 1.7.10.2
On 19/05/12 21:01, Allan McRae wrote:
This is useful for tools that automatically rebuild packages and thus require to generate a build order. These entries are skipped by pacman.
Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/be_sync.c | 3 +++ scripts/repo-add.sh.in | 27 +++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index f18ba51..92ce456 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -591,6 +591,9 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, READ_AND_SPLITDEP(pkg->depends); } else if(strcmp(line, "%OPTDEPENDS%") == 0) { READ_AND_SPLITDEP(pkg->optdepends); + } else if(strcmp(line, "%MAKEDEPENDS%") == 0) { + /* currently unused */ + READ_NEXT();
Of course more than one makedepend can be specified.... + } else if(strcmp(line, "%MAKEDEPENDS%") == 0) { + /* currently unused */ + while(1) { + READ_NEXT(); + if(strlen(line) == 0) break; + } Fixed on my working branch.
} else if(strcmp(line, "%CONFLICTS%") == 0) { READ_AND_SPLITDEP(pkg->conflicts); } else if(strcmp(line, "%PROVIDES%") == 0) { diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 006672a..ba9ba05 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -256,7 +256,8 @@ verify_repo_extension() { db_write_entry() { # blank out all variables local pkgfile=$1 - local -a _groups _licenses _replaces _depends _conflicts _provides _optdepends + local -a _groups _licenses _replaces _depends _conflicts _provides \ + _optdepends _makedepends local pkgname pkgver pkgdesc csize size url arch builddate packager \ md5sum sha256sum pgpsig pgpsigsize
@@ -269,13 +270,14 @@ db_write_entry() { # normalize whitespace with an extglob declare "$var=${val//+([[:space:]])/ }" case $var in - group) _groups+=("$group") ;; - license) _licenses+=("$license") ;; - replaces) _replaces+=("$replaces") ;; - depend) _depends+=("$depend") ;; - conflict) _conflicts+=("$conflict") ;; - provides) _provides+=("$provides") ;; - optdepend) _optdepends+=("$optdepend") ;; + group) _groups+=("$group") ;; + license) _licenses+=("$license") ;; + replaces) _replaces+=("$replaces") ;; + depend) _depends+=("$depend") ;; + conflict) _conflicts+=("$conflict") ;; + provides) _provides+=("$provides") ;; + optdepend) _optdepends+=("$optdepend") ;; + makedepend) _makedepends+=("$makedepend") ;; esac done< <(bsdtar -xOqf "$pkgfile" .PKGINFO)
@@ -358,10 +360,11 @@ db_write_entry() { # create depends entry msg2 "$(gettext "Creating '%s' db entry...")" 'depends' { - format_entry "DEPENDS" "${_depends[@]}" - format_entry "CONFLICTS" "${_conflicts[@]}" - format_entry "PROVIDES" "${_provides[@]}" - format_entry "OPTDEPENDS" "${_optdepends[@]}" + format_entry "DEPENDS" "${_depends[@]}" + format_entry "CONFLICTS" "${_conflicts[@]}" + format_entry "PROVIDES" "${_provides[@]}" + format_entry "OPTDEPENDS" "${_optdepends[@]}" + format_entry "MAKEDEPENDS" "${_makedepends[@]}" } >'depends'
popd >/dev/null
On Sat, May 19, 2012 at 6:08 AM, Allan McRae <allan@archlinux.org> wrote:
On 19/05/12 21:01, Allan McRae wrote:
This is useful for tools that automatically rebuild packages and thus require to generate a build order. These entries are skipped by pacman.
Signed-off-by: Allan McRae <allan@archlinux.org> --- lib/libalpm/be_sync.c | 3 +++ scripts/repo-add.sh.in | 27 +++++++++++++++------------ 2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index f18ba51..92ce456 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -591,6 +591,9 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive, READ_AND_SPLITDEP(pkg->depends); } else if(strcmp(line, "%OPTDEPENDS%") == 0) { READ_AND_SPLITDEP(pkg->optdepends); + } else if(strcmp(line, "%MAKEDEPENDS%") == 0) { + /* currently unused */ + READ_NEXT();
Of course more than one makedepend can be specified....
+ } else if(strcmp(line, "%MAKEDEPENDS%") == 0) { + /* currently unused */ + while(1) { + READ_NEXT(); + if(strlen(line) == 0) break; + }
Fixed on my working branch.
Did you fix the spelling error in $SUBJECT too? Seeing this also presents the "should we include checkdepends" question- I don't see an immediate use but do we just want to complete the inclusion of fields by doing this at the same time?
} else if(strcmp(line, "%CONFLICTS%") == 0) { READ_AND_SPLITDEP(pkg->conflicts); } else if(strcmp(line, "%PROVIDES%") == 0) { diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 006672a..ba9ba05 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -256,7 +256,8 @@ verify_repo_extension() { db_write_entry() { # blank out all variables local pkgfile=$1 - local -a _groups _licenses _replaces _depends _conflicts _provides _optdepends + local -a _groups _licenses _replaces _depends _conflicts _provides \ + _optdepends _makedepends local pkgname pkgver pkgdesc csize size url arch builddate packager \ md5sum sha256sum pgpsig pgpsigsize
@@ -269,13 +270,14 @@ db_write_entry() { # normalize whitespace with an extglob declare "$var=${val//+([[:space:]])/ }" case $var in - group) _groups+=("$group") ;; - license) _licenses+=("$license") ;; - replaces) _replaces+=("$replaces") ;; - depend) _depends+=("$depend") ;; - conflict) _conflicts+=("$conflict") ;; - provides) _provides+=("$provides") ;; - optdepend) _optdepends+=("$optdepend") ;; + group) _groups+=("$group") ;; + license) _licenses+=("$license") ;; + replaces) _replaces+=("$replaces") ;; + depend) _depends+=("$depend") ;; + conflict) _conflicts+=("$conflict") ;; + provides) _provides+=("$provides") ;; + optdepend) _optdepends+=("$optdepend") ;; + makedepend) _makedepends+=("$makedepend") ;; esac done< <(bsdtar -xOqf "$pkgfile" .PKGINFO)
@@ -358,10 +360,11 @@ db_write_entry() { # create depends entry msg2 "$(gettext "Creating '%s' db entry...")" 'depends' { - format_entry "DEPENDS" "${_depends[@]}" - format_entry "CONFLICTS" "${_conflicts[@]}" - format_entry "PROVIDES" "${_provides[@]}" - format_entry "OPTDEPENDS" "${_optdepends[@]}" + format_entry "DEPENDS" "${_depends[@]}" + format_entry "CONFLICTS" "${_conflicts[@]}" + format_entry "PROVIDES" "${_provides[@]}" + format_entry "OPTDEPENDS" "${_optdepends[@]}" + format_entry "MAKEDEPENDS" "${_makedepends[@]}" } >'depends'
popd >/dev/null
participants (2)
-
Allan McRae
-
Dan McGee