FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 11-01-2010, 12:38 PM
Florian Pritz
 
Default add upgpkg

Signed-off-by: Florian Pritz <bluewind@xssn.at>
---
upgpkg | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
create mode 100755 upgpkg

diff --git a/upgpkg b/upgpkg
new file mode 100755
index 0000000..7966ac3
--- /dev/null
+++ b/upgpkg
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# upgpkg: Upgrades package versions in PKGBUILD and starts build.
+# Author: Abhishek Dasgupta <abhidg@gmail.com>
+# Thanks to cactus, profjim and daenyth for all the sed help!
+# Edited: Florian Pritz <flo@xinu.at>
+
+# I place this script in the public domain.
+
+VERSION=0.2
+
+die() {
+ local message="$1"
+ shift
+ printf "$(gettext "Error: $message")
" "$@"
+ exit 1
+}
+
+if [ -z "$1" ]; then
+ echo "upgpkg $VERSION"
+ printf "$(gettext "usage: upgpkg newver")
"
+ exit 2
+fi
+
+# Main code follows
+
+[ ! -f PKGBUILD ] && die "No "%s" in %s" "PKGBUILD" "$PWD"
+
+sed -ri '/(md5sums|sha[0-9]+sums)[ ]?=/{:a; /)/d; N; ba;}' PKGBUILD || die "Could not bump pkgver"
+source PKGBUILD
+
+if [ $(vercmp $1 $pkgver) -gt 0 ]; then
+ sed -i "s/pkgver=.*$/pkgver=$1/g" PKGBUILD
+ sed -i "s/pkgrel=.*$/pkgrel=1/g" PKGBUILD
+ makepkg -g >> PKGBUILD
+else
+ die "New version (%s) older or equal to current %s" "$1" "$pkgver"
+fi
+
+if [ -x "rebuild" ]; then
+ ./rebuild
+else
+ makepkg
+fi
--
1.7.3.2
 
Old 11-01-2010, 02:25 PM
Andrea Scarpino
 
Default add upgpkg

On Monday 01 November 2010 14:38:23 Florian Pritz wrote:
> +if [ -x "rebuild" ]; then
> + ./rebuild
> +else
> + makepkg
> +fi
Which official script is named 'rebuild'?
And, this script does not use a chroot to build the package!

--
Andrea Scarpino
Arch Linux Developer
 
Old 11-01-2010, 02:34 PM
Jan de Groot
 
Default add upgpkg

On Mon, 2010-11-01 at 16:25 +0100, Andrea Scarpino wrote:
> On Monday 01 November 2010 14:38:23 Florian Pritz wrote:
> > +if [ -x "rebuild" ]; then
> > + ./rebuild
> > +else
> > + makepkg
> > +fi
> Which official script is named 'rebuild'?
> And, this script does not use a chroot to build the package!

And official packages should never ever just "makepkg -g" without
actually checking the checksums generated by that. I always copy&paste
the sha1sums or sha256sums into the PKGBUILD from announcement mails, so
I know that a downloaded tarball is the same one that is announced in my
mailbox.
 
Old 11-01-2010, 02:35 PM
Florian Pritz
 
Default add upgpkg

On 01.11.2010 16:25, Andrea Scarpino wrote:
> On Monday 01 November 2010 14:38:23 Florian Pritz wrote:
>> +if [ -x "rebuild" ]; then
>> + ./rebuild
>> +else
>> + makepkg
>> +fi
> Which official script is named 'rebuild'?
> And, this script does not use a chroot to build the package!

Because everyone handles chroots differently I just call a script called
"rebuild" from the same directory the PKGBUILD is in.
There you can run some build function and then automatically release the
package. (extra-i686-build; communitypkg)

--
Florian Pritz -- {flo,bluewind}@server-speed.net
 
Old 11-02-2010, 03:56 PM
Florian Pritz
 
Default add upgpkg

Signed-off-by: Florian Pritz <bluewind@xssn.at>
---
upgpkg | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++
1 files changed, 82 insertions(+), 0 deletions(-)
create mode 100755 upgpkg

diff --git a/upgpkg b/upgpkg
new file mode 100755
index 0000000..80b12ad
--- /dev/null
+++ b/upgpkg
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+# upgpkg: Upgrades package versions in PKGBUILD and starts build.
+# Author: Abhishek Dasgupta <abhidg@gmail.com>
+# Thanks to cactus, profjim and daenyth for all the sed help!
+# Edited: Florian Pritz <flo@xinu.at>
+
+# I place this script in the public domain.
+
+VERSION=0.3
+
+die() {
+ local message="$1"
+ shift
+ printf "$(gettext "Error: $message")
" "$@"
+ exit 1
+}
+
+warn() {
+ local message="$1"
+ shift
+ printf "$(gettext "Warning: $message")
" "$@"
+}
+
+scriptlet() {
+ if [ -f "upgpkg" ]; then
+ upgpkg_$1 || die ""$1" scriptlet failed"
+ fi
+}
+
+help() {
+ echo "upgpkg $VERSION"
+ printf "$(gettext "usage: upgpkg [options] newver")
"
+ printf "$(gettext " -h this help")
"
+ printf "$(gettext " -g generate a template ./upgpkg file")
"
+ exit 2
+}
+
+if [ -z "$1" ]; then
+ help
+fi
+
+while getopts "gh" OPTION; do
+ case $OPTION in
+ g)
+ cat > upgpkg <<EOF
+upgpkg_pre_upgrade() {
+ # You might want to remove old sources here
+ true
+}
+
+upgpkg_build() {
+ makepkg
+}
+EOF
+ exit;
+ ;;
+ h) help;
+ esac
+done
+
+# Main code follows
+
+[ ! -f PKGBUILD ] && die "No "%s" in %s" "PKGBUILD" "$PWD"
+
+if [ -f "upgpkg" ]; then
+ source ./upgpkg
+fi
+
+source PKGBUILD
+
+scriptlet pre_upgrade
+
+if [ $(vercmp $1 $pkgver) -ge 0 ]; then
+ warn "New version (%s) older or equal to current %s" "$1" "$pkgver"
+fi
+
+sed -i "s/pkgver=.*$/pkgver=$1/g" PKGBUILD
+sed -i "s/pkgrel=.*$/pkgrel=1/g" PKGBUILD
+awk <PKGBUILD '$0 ~ /^(md5|sha[0-9]+)sums/ {i = 1; if(!run==1) {system("makepkg -g 2>/dev/null")}; run=1; }; !i {print}; $0 ~ /)/ {i = 0}' | sponge PKGBUILD
+
+scriptlet build
--
1.7.3.2
 
Old 11-08-2010, 02:04 PM
Florian Pritz
 
Default add upgpkg

Signed-off-by: Florian Pritz <bluewind@xssn.at>
---
upgpkg | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++
1 files changed, 117 insertions(+), 0 deletions(-)
create mode 100755 upgpkg

diff --git a/upgpkg b/upgpkg
new file mode 100755
index 0000000..5a35057
--- /dev/null
+++ b/upgpkg
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+# upgpkg: Upgrades package versions in PKGBUILD and starts build.
+# Author: Abhishek Dasgupta <abhidg@gmail.com>
+# Thanks to cactus, profjim and daenyth for all the sed help!
+# Edited: Florian Pritz <flo@xinu.at>
+
+# I place this script in the public domain.
+
+VERSION=0.4
+
+# from makepkg
+unset ALL_OFF BOLD BLUE GREEN RED YELLOW
+if [[ -t 2 ]]; then
+ # prefer terminal safe colored and bold text when tput is supported
+ if tput setaf 0 &>/dev/null; then
+ ALL_OFF="$(tput sgr0)"
+ BOLD="$(tput bold)"
+ BLUE="${BOLD}$(tput setaf 4)"
+ GREEN="${BOLD}$(tput setaf 2)"
+ RED="${BOLD}$(tput setaf 1)"
+ YELLOW="${BOLD}$(tput setaf 3)"
+ else
+ ALL_OFF="33[1;0m"
+ BOLD="33[1;1m"
+ BLUE="${BOLD}33[1;34m"
+ GREEN="${BOLD}33[1;32m"
+ RED="${BOLD}33[1;31m"
+ YELLOW="${BOLD}33[1;33m"
+ fi
+fi
+readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
+
+die() {
+ local message="$1"
+ shift
+ printf "$RED==> $(gettext "Error"):$ALL_OFF $(gettext "$message")
" "$@"
+ exit 1
+}
+
+warn() {
+ local message="$1"
+ shift
+ printf "$YELLOW==> $(gettext "Warning"):$ALL_OFF $(gettext "$message")
" "$@"
+}
+
+scriptlet() {
+ if [ -f "upgpkg" ]; then
+ if [[ $(type -t upgpkg_$1) = "function" ]]; then
+ upgpkg_$1 || die ""%s" scriptlet failed" $1
+ fi
+ fi
+}
+
+help() {
+ echo "upgpkg $VERSION"
+ printf "$(gettext "usage: upgpkg [options] newver")
"
+ printf "$(gettext " -h this help")
"
+ printf "$(gettext " -g generate a template ./upgpkg file")
"
+ exit 2
+}
+
+if [ -z "$1" ]; then
+ help
+fi
+
+while getopts "gh" OPTION; do
+ case $OPTION in
+ g)
+ cat > upgpkg <<EOF
+upgpkg_pre_upgrade() {
+ # You might want to remove old sources here
+ true
+}
+
+upgpkg_build() {
+ makepkg
+}
+EOF
+ exit;
+ ;;
+ h) help;
+ esac
+done
+
+[ ! -f PKGBUILD ] && die "No "%s" in %s" "PKGBUILD" "$PWD"
+
+if [ -f "upgpkg" ]; then
+ source ./upgpkg
+fi
+
+source PKGBUILD
+
+scriptlet pre_upgrade
+
+if [[ $(vercmp $1 $pkgver) -le 0 ]]; then
+ warn "New version (%s) older or equal to current %s" "$1" "$pkgver"
+fi
+
+sed -i "s/pkgver=.*$/pkgver=$1/g" PKGBUILD
+sed -i "s/pkgrel=.*$/pkgrel=1/g" PKGBUILD
+awk <PKGBUILD '$0 ~ /^(md5|sha[0-9]+)sums/ {i = 1; if(!run==1) {system("makepkg -g 2>/dev/null")}; run=1; }; !i {print}; $0 ~ /)/ {i = 0}' | sponge PKGBUILD
+
+source PKGBUILD
+if [ -f "upgpkg" ]; then
+ source ./upgpkg
+fi
+
+for i in $gpgsource; do
+ sigfile="$(basename "$i")"
+ if [[ $sigfile != $i ]]; then
+ wget -nv -O "$sigfile" "$i"
+ fi
+ gpg2 --verify "$sigfile" || die "Signature verification failed!"
+done
+
+scriptlet build
--
1.7.3.2
 
Old 11-08-2010, 02:07 PM
Sven-Hendrik Haase
 
Default add upgpkg

This helper is neat, I like it. Any chance to get it into devtools?
 

Thread Tools




All times are GMT. The time now is 04:44 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org