[arch-dev-public] [PATCH] [makechrootpkg] Fixed changelog support to work with makepkg 3.4
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com> --- makechrootpkg | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/makechrootpkg b/makechrootpkg index 830a8af..01cb3a9 100755 --- a/makechrootpkg +++ b/makechrootpkg @@ -175,9 +175,19 @@ for f in $install_files;do fi done -if [ -f 'ChangeLog' ]; then - cp ChangeLog "$copydir/build/" -fi +changelog_files=$(grep 'changelog=' PKGBUILD) +for pkg in ${pkgname[@]}; do + changelog_files+=' ' + changelog_files+=$(echo $changelog_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/") + changelog_files=$(eval echo $changelog_files |tr '[:blank:]' '\n'|sort |uniq) +done + +for f in $changelog_files;do + changelog="${f#"changelog="}" + if [ "$changelog" != "" -a -f "$changelog" ]; then + cp "$changelog" "$copydir/build/" + fi +done chown -R nobody "$copydir/build" chown -R nobody "$copydir/srcdest" -- 1.7.1
On Sun, Jun 27, 2010 at 9:08 PM, Eric Bélanger <snowmaniscool@gmail.com> wrote:
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com> --- makechrootpkg | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/makechrootpkg b/makechrootpkg index 830a8af..01cb3a9 100755 --- a/makechrootpkg +++ b/makechrootpkg @@ -175,9 +175,19 @@ for f in $install_files;do fi done
-if [ -f 'ChangeLog' ]; then - cp ChangeLog "$copydir/build/" -fi +changelog_files=$(grep 'changelog=' PKGBUILD) +for pkg in ${pkgname[@]}; do + changelog_files+=' ' + changelog_files+=$(echo $changelog_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/") + changelog_files=$(eval echo $changelog_files |tr '[:blank:]' '\n'|sort |uniq) +done + +for f in $changelog_files;do + changelog="${f#"changelog="}" + if [ "$changelog" != "" -a -f "$changelog" ]; then + cp "$changelog" "$copydir/build/" + fi +done
chown -R nobody "$copydir/build" chown -R nobody "$copydir/srcdest" -- 1.7.1
BTW, it might be a good idea to make a new release of devtools with this patch so that changelog can be used in packages built in chroot.
On Sun, 27 Jun 2010 21:08:19 -0400, Eric Bélanger <snowmaniscool@gmail.com> wrote:
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com> --- makechrootpkg | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/makechrootpkg b/makechrootpkg index 830a8af..01cb3a9 100755 --- a/makechrootpkg +++ b/makechrootpkg @@ -175,9 +175,19 @@ for f in $install_files;do fi done
-if [ -f 'ChangeLog' ]; then - cp ChangeLog "$copydir/build/" -fi +changelog_files=$(grep 'changelog=' PKGBUILD) +for pkg in ${pkgname[@]}; do + changelog_files+=' ' + changelog_files+=$(echo $changelog_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/") + changelog_files=$(eval echo $changelog_files |tr '[:blank:]' '\n'|sort |uniq) +done + +for f in $changelog_files;do + changelog="${f#"changelog="}" + if [ "$changelog" != "" -a -f "$changelog" ]; then + cp "$changelog" "$copydir/build/" + fi +done
chown -R nobody "$copydir/build" chown -R nobody "$copydir/srcdest"
I will apply this for now as we handle the install files the same way. In future we should come up with a better solution though. It's quite easy to write a PKGBUILD where this method will fail. The propper way is to source the PKGBUILD and use the evaluated $changelog variable. A problem are the package functions; I don't see a way to call them without executing the make install or whatever commands. (I'll better open a new thread about this problem) -- Pierre Schmitz, https://users.archlinux.de/~pierre
On 28/06/10 16:07, Pierre Schmitz wrote:
On Sun, 27 Jun 2010 21:08:19 -0400, Eric Bélanger <snowmaniscool@gmail.com> wrote:
Signed-off-by: Eric Bélanger<snowmaniscool@gmail.com> --- makechrootpkg | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/makechrootpkg b/makechrootpkg index 830a8af..01cb3a9 100755 --- a/makechrootpkg +++ b/makechrootpkg @@ -175,9 +175,19 @@ for f in $install_files;do fi done
-if [ -f 'ChangeLog' ]; then - cp ChangeLog "$copydir/build/" -fi +changelog_files=$(grep 'changelog=' PKGBUILD) +for pkg in ${pkgname[@]}; do + changelog_files+=' ' + changelog_files+=$(echo $changelog_files |sed "s/\$pkgname/$pkg/"|sed "s/\${pkgname}/$pkg/") + changelog_files=$(eval echo $changelog_files |tr '[:blank:]' '\n'|sort |uniq) +done + +for f in $changelog_files;do + changelog="${f#"changelog="}" + if [ "$changelog" != "" -a -f "$changelog" ]; then + cp "$changelog" "$copydir/build/" + fi +done
chown -R nobody "$copydir/build" chown -R nobody "$copydir/srcdest"
I will apply this for now as we handle the install files the same way. In future we should come up with a better solution though. It's quite easy to write a PKGBUILD where this method will fail. The propper way is to source the PKGBUILD and use the evaluated $changelog variable.
A problem are the package functions; I don't see a way to call them without executing the make install or whatever commands. (I'll better open a new thread about this problem)
You can probably follow makepkg's handling in the source package creation. See makepkg lines 1110-1122. Allan
On Mon, 28 Jun 2010 16:18:14 +1000, "Allan McRae" <allan@archlinux.org> wrote:
On 28/06/10 16:07, Pierre Schmitz wrote:
I will apply this for now as we handle the install files the same way. In future we should come up with a better solution though. It's quite easy to write a PKGBUILD where this method will fail. The propper way is to source the PKGBUILD and use the evaluated $changelog variable.
A problem are the package functions; I don't see a way to call them without executing the make install or whatever commands. (I'll better open a new thread about this problem)
You can probably follow makepkg's handling in the source package creation. See makepkg lines 1110-1122.
That is more clean indeed. But this will also fail if you enclose the changelog,install definition in an if-statement for example. :-) But I guess there wont be a super solid solution by design. -- Pierre Schmitz, https://users.archlinux.de/~pierre
participants (3)
-
Allan McRae
-
Eric Bélanger
-
Pierre Schmitz