32
2
[alpine-devel] [PATCH 00/31] patch series for abuild repo
Sorry for so many patches. I tried hard to rebase them into natural-sized
chunks for reviewing. I'll rebase them further if you like. But I thought it
was time to hand them over to other eyes.
These hardly touch abuild itself, nor newapkbuild, buildrepo, or buildlab. I've
got some notes for the first two of these, that I'll come back to another day.
Most of the changes here are internal.
The main externally-visible changes are: long options, some tweaked error messages,
permitting environment variable overrides to settings from abuild.conf files, and
hopefully some more robust behavior in places.
Dubiousjim (31):
remove unused files
abuild-sudo, abuild-tar: cosmetic changes
various: add descriptions, attribution, license
various: tweak opening comments, whitespace
abuild-keygen: refactor
abuild-sign: refactor
various: move conf-loading and i/o to functions
Makefile: add missing files to dist
Makefile: remove dist
various: use long options, rework usages
abuild_keygen: several tweaks
abuild-sign: reformat error output
abuild-sign: make vars local
abuild-sign: wrap cd in a subshell, use set -e
abuild-sign: fix a race condition
abump: move loop inside do_bump, refine locals
abump: introduce subshell, rc
abump: make abuild also clean
abump: tweak upgrade/cvelist
abump, functions: refactor (and verify) calculation of APKBUILD path
abump: refactor verification of APKBUILD
abump: verify APKBUILD's version
abump: verify that we're in git tree
apkgrel: --clean-git enhancements
apkgrel: show_plain, show_pretty
apkgrel: tweaks to loops, add quotes
apkgrel: handle missing pkgrel in do_add
various: s/echo/msg/, s/echo/error/, tweak error messages
apkgrel, functions: refactor calculation of APKBUILD's path
various: fancier readconfig, permit env overrides
functions: also honor .abuild file at gitbase
APKBUILD-svn.proto | 46 --------
Makefile | 14 +--
abuild-keygen.in | 190 +++++++++++++++++----------------
abuild-sign.in | 132 ++++++++++++-----------
abuild-sudo.c | 13 ++-
abuild-tar.c | 2 +-
abuild.in | 4 +-
abump.in | 155 +++++++++++++++++----------
alpine.mk | 302 -----------------------------------------------------
alpine.packages | 124 ----------------------
apkgrel.in | 126 +++++++++++++++-------
checkapk.in | 52 +++++----
functions.sh | 34 ------
functions.sh.in | 150 ++++++++++++++++++++++++++
mkinitram | 88 ----------------
mkmodloop | 37 -------
newapkbuild.in | 60 +++++------
17 files changed, 585 insertions(+), 944 deletions(-)
delete mode 100644 APKBUILD-svn.proto
delete mode 100755 alpine.mk
delete mode 100644 alpine.packages
delete mode 100644 functions.sh
create mode 100644 functions.sh.in
delete mode 100644 mkinitram
delete mode 100644 mkmodloop
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 01/31] remove unused files
as discussed in http://lists.alpinelinux.org/alpine-devel/3122.html
---
APKBUILD-svn.proto | 46 --------
alpine.mk | 302 -----------------------------------------------------
alpine.packages | 124 ----------------------
mkinitram | 88 ----------------
mkmodloop | 37 -------
5 files changed, 597 deletions(-)
delete mode 100644 APKBUILD-svn.proto
delete mode 100755 alpine.mk
delete mode 100644 alpine.packages
delete mode 100644 mkinitram
delete mode 100644 mkmodloop
diff --git a/APKBUILD-svn.proto b/APKBUILD-svn.proto
deleted file mode 100644
index 63fbbb1..0000000
--- a/APKBUILD-svn.proto
@@ -1,46 +0,0 @@
- # This is an example PKGBUILD file. Use this as a start to creating your own,
- # and remove these comments.
- # NOTE: Please fill out the license field for your package! If it is unknown,
- # then please put 'unknown'.
-
- # Contributor: Your Name <youremail@domain.com>
- pkgname=NAME-svn
- pkgver=VERSION
- pkgrel=0
- pkgdesc=""
- url=""
- license="GPL"
- depends=""
- makedepends=""
- install=
- source="$pkgname-$pkgver.tar.gz"
-
- _svntrunk=SVNURL
- _svnmod=MODENAME
-
- build() {
- cd "$srcdir"
-
- if [ -d $_svnmod/.svn ]; then
- (cd $_svnmod && svn up -r $pkgver) || return 1
- else
- svn co $_svntrunk --config-dir ./ -r $pkgver $_svnmod \
- || return 1
- fi
-
- msg "Starting make..."
-
- rm -r "$srcdir/$_svnmod-build"
- cp -r "$srcdir/$_svnmod" "$srcdir/$_svnmod-build"
- cd "$srcdir/$_svnmod-build"
-
- #
- # BUILD
- #
- ./autogen.sh
- ./configure --prefix=/usr
- make || return 1
- make DESTDIR="$pkgdir/" install
- }
-
- md5sums="" # generate with 'abuild checksum'
diff --git a/alpine.mk b/alpine.mk
deleted file mode 100755
index 16c78a2..0000000
--- a/alpine.mk
@@ -1,302 +0,0 @@
- #!/usr/bin/make -f
-
- PROFILE ?= alpine
-
- -include $(PROFILE).conf.mk
-
- BUILD_DATE := $(shell date +%y%m%d)
- ALPINE_RELEASE ?= $(BUILD_DATE)
- ALPINE_NAME ?= alpine-test
- ALPINE_ARCH := x86
- DESTDIR ?= $(shell pwd)/isotmp.$(PROFILE)
-
- MKCRAMFS = mkcramfs
- SUDO = sudo
-
- ISO ?= $(ALPINE_NAME)-$(ALPINE_RELEASE)-$(ALPINE_ARCH).iso
- ISO_LINK ?= $(ALPINE_NAME).iso
- ISO_DIR := $(DESTDIR)/isofs
- ISO_PKGDIR := $(ISO_DIR)/apks
-
- APKS ?= $(shell sed 's/\#.*//; s/\*/\\*/g' $(PROFILE).packages)
-
- APK_OPTS := $(addprefix --repository ,$(APK_REPOS)) --keys-dir /etc/apk/keys
-
- find_apk_ver = $(shell apk search $(APK_OPTS) $(1) | sort | uniq)
- find_apk_file = $(addsuffix .apk,$(call find_apk_ver,$(1)))
- find_apk = $(addprefix $(ISO_PKGDIR)/,$(call find_apk_file,$(1)))
-
- # get apk does not support wildcards
- get_apk = $(addsuffix .apk,$(shell apk fetch --simulate $(APK_OPTS) $(1) 2>&1 | sed 's:^Downloading :$(ISO_PKGDIR)/:'))
-
- KERNEL_FLAVOR ?= grsec
- KERNEL_PKGNAME ?= linux-$(KERNEL_FLAVOR)
- KERNEL_NAME := $(KERNEL_FLAVOR)
- KERNEL_APK := $(call get_apk,$(KERNEL_PKGNAME))
-
- KERNEL := $(word 3,$(subst -, ,$(notdir $(KERNEL_APK))))-$(word 2,$(subst -, ,$(notdir $(KERNEL_APK))))
-
- ALPINEBASELAYOUT_APK := $(call find_apk,alpine-baselayout)
- UCLIBC_APK := $(call get_apk,uclibc)
- BUSYBOX_APK := $(call get_apk,busybox)
- APK_TOOLS_APK := $(call get_apk,apk-tools)
- STRACE_APK := $(call get_apk,strace)
-
- APKS_FILTER ?= | grep -v -- '-dev$$' | grep -v 'sources'
-
- APKS ?= '*'
- APK_FILES := $(call find_apk,$(APKS))
-
- all: isofs
-
- help:
- @echo "Alpine ISO builder"
- @echo
- @echo "Type 'make iso' to build $(ISO)"
- @echo
- @echo "I will use the following sources files:"
- @echo " 1. $(notdir $(KERNEL_APK)) (looks like $(KERNEL))"
- @echo " 2. $(notdir $(MOD_APKS))"
- @echo " 3. $(notdir $(ALPINEBASELAYOUT_APK))"
- @echo " 4. $(notdir $(UCLIBC_APK))"
- @echo " 5. $(notdir $(BUSYBOX_APK))"
- ifeq ($(APK_BIN),)
- @echo " 6. $(notdir $(APK_TOOLS_APK))"
- else
- @echo " 6. $(APK_BIN)"
- endif
- @echo
- @echo "ALPINE_NAME: $(ALPINE_NAME)"
- @echo "ALPINE_RELEASE: $(ALPINE_RELEASE)"
- @echo "KERNEL_FLAVOR: $(KERNEL_FLAVOR)"
- @echo "KERNEL: $(KERNEL)"
- @echo
-
- clean:
- rm -rf $(MODLOOP) $(MODLOOP_DIR) $(MODLOOP_DIRSTAMP) \
- $(INITFS) $(INITFS_DIRSTAMP) $(INITFS_DIR) \
- $(ISO_DIR) $(ISO_REPOS_DIRSTAMP)
-
-
- $(APK_FILES):
- @mkdir -p "$(dir $@)";\
- p="$(notdir $(basename $@))";\
- apk fetch $(APK_REPO) -R -v -o "$(dir $@)" $${p%-[0-9]*}
- # apk fetch $(APK_OPTS) -R -v -o "$(dir $@)" \
- # `apk search -q $(APK_OPTS) $(APKS) | sort | uniq`
-
- #
- # Modloop
- #
- MODLOOP := $(ISO_DIR)/boot/$(KERNEL_NAME).cmg
- MODLOOP_DIR := $(DESTDIR)/modloop
- MODLOOP_KERNELSTAMP := $(DESTDIR)/stamp.modloop.kernel
- MODLOOP_DIRSTAMP := $(DESTDIR)/stamp.modloop
- MODLOOP_EXTRA ?= $(addsuffix -$(KERNEL_FLAVOR), dahdi-linux iscsitarget xtables-addons)
- MODLOOP_PKGS = $(KERNEL_PKGNAME) $(MODLOOP_EXTRA)
-
- modloop: $(MODLOOP)
-
- $(MODLOOP_KERNELSTAMP):
- @echo "==> modloop: Unpacking kernel modules";
- @rm -rf $(MODLOOP_DIR)
- @mkdir -p $(MODLOOP_DIR)/lib/modules/
- @for i in $(MODLOOP_PKGS); do \
- apk fetch $(APK_OPTS) --stdout $$i \
- | tar -C $(MODLOOP_DIR) -xz; \
- done
- @cp $(MODLOOP_DIR)/usr/share/kernel/$(KERNEL_FLAVOR)/kernel.release $@
-
- MODLOOP_KERNEL_RELEASE = $(shell cat $(MODLOOP_KERNELSTAMP))
-
- $(MODLOOP_DIRSTAMP): $(MODLOOP_KERNELSTAMP)
- @rm -rf $(addprefix $(MODLOOP_DIR)/lib/modules/*/, source build)
- @depmod $(MODLOOP_KERNEL_RELEASE) -b $(MODLOOP_DIR)
- @touch $(MODLOOP_DIRSTAMP)
-
- $(MODLOOP): $(MODLOOP_DIRSTAMP)
- @echo "==> modloop: building image $(notdir $(MODLOOP))"
- @mkdir -p $(dir $(MODLOOP))
- @$(MKCRAMFS) $(MODLOOP_DIR)/lib $(MODLOOP)
-
- clean-modloop:
- @rm -rf $(MODLOOP_DIR) $(MODLOOP_DIRSTAMP) $(MODLOOP_PKGSTAMP) $(MODLOOP)
-
- #
- # Initramfs rules
- #
-
- # isolinux cannot handle - in filenames
- #INITFS_NAME := initramfs-$(MODLOOP_KERNEL_RELEASE)
- INITFS_NAME := $(KERNEL_FLAVOR).gz
- INITFS := $(ISO_DIR)/boot/$(INITFS_NAME)
-
- INITFS_DIR := $(DESTDIR)/initfs
- INITFS_TMP := $(DESTDIR)/tmp.initfs
- INITFS_DIRSTAMP := $(DESTDIR)/stamp.initfs
- INITFS_FEATURES := ata base bootchart cdrom cramfs ext3 floppy raid scsi usb
- INITFS_PKGS := $(MODLOOP_PKGS) alpine-base acct
-
- initfs: $(INITFS)
-
- $(INITFS_DIRSTAMP):
- @rm -rf $(INITFS_DIR) $(INITFS_TMP)
- @mkdir -p $(INITFS_DIR) $(INITFS_TMP)
- @for i in `apk fetch $(APK_OPTS) --simulate -R $(INITFS_PKGS) 2>&1\
- | sed 's:^Downloading ::; s:-[0-9].*::' | sort | uniq`; do \
- apk fetch $(APK_OPTS) --stdout $$i \
- | tar -C $(INITFS_DIR) -zx || exit 1; \
- done
- @cp -r /etc/apk/keys $(INITFS_DIR)/etc/apk/ || true
- @touch $@
-
- #$(INITFS): $(shell mkinitfs -F "$(INITFS_FEATURES)" -l $(KERNEL))
- $(INITFS): $(INITFS_DIRSTAMP) $(MODLOOP_DIRSTAMP)
- @mkinitfs -F "$(INITFS_FEATURES)" -t $(INITFS_TMP) \
- -b $(INITFS_DIR) -o $@ $(MODLOOP_KERNEL_RELEASE)
-
- clean-initfs:
- @rm -rf $(INITFS) $(INITFS_DIRSTAMP) $(INITFS_DIR)
-
- #
- # Vserver template rules
- #
- VSTEMPLATE := $(ISO_DIR)/vs-template.tar.bz2
- VSTEMPLATE_DIR := $(DESTDIR)/vs-template
-
- vstemplate: $(VSTEMPLATE)
- @echo "==> vstemplate: built $(VSTEMPLATE)"
-
- #must be run as root or in fakeroot
- $(VSTEMPLATE):
- @rm -rf "$(VSTEMPLATE_DIR)"
- @mkdir -p "$(VSTEMPLATE_DIR)"
- @apk add $(APK_OPTS) --initdb --root $(VSTEMPLATE_DIR) \
- alpine-base
- @cd $(VSTEMPLATE_DIR) && tar -jcf $@ *
-
- #
- # ISO rules
- #
-
- ISOLINUX_DIR := boot/isolinux
- ISOLINUX := $(ISO_DIR)/$(ISOLINUX_DIR)
- ISOLINUX_BIN := $(ISOLINUX)/isolinux.bin
- ISOLINUX_CFG := $(ISOLINUX)/isolinux.cfg
- SYSLINUX_CFG := $(ISO_DIR)/syslinux.cfg
-
- $(ISOLINUX_BIN):
- @echo "==> iso: install isolinux"
- @mkdir -p $(dir $(ISOLINUX_BIN))
- @if ! apk fetch $(APK_REPO) --stdout syslinux | tar -O -zx usr/share/syslinux/isolinux.bin > $@; then \
- rm -f $@ && exit 1;\
- fi
-
- $(ISOLINUX_CFG):
- @echo "==> iso: configure isolinux"
- @mkdir -p $(dir $(ISOLINUX_BIN))
- @echo "timeout 20" >$(ISOLINUX_CFG)
- @echo "prompt 1" >>$(ISOLINUX_CFG)
- @echo "default $(KERNEL_NAME)" >>$(ISOLINUX_CFG)
- @echo "label $(KERNEL_NAME)" >>$(ISOLINUX_CFG)
- @echo " kernel /boot/$(KERNEL_NAME)" >>$(ISOLINUX_CFG)
- @echo " append initrd=/boot/$(INITFS_NAME) alpine_dev=cdrom:iso9660 modules=loop,cramfs,sd-mod,usb-storage,floppy quiet" >>$(ISOLINUX_CFG)
-
- $(SYSLINUX_CFG): $(MODLOOP_DIRSTAMP)
- @echo "==> iso: configure syslinux"
- @echo "timeout 20" >$@
- @echo "prompt 1" >>$@
- @echo "default $(KERNEL_NAME)" >>$@
- @echo "label $(KERNEL_NAME)" >>$@
- @echo " kernel /boot/$(KERNEL_NAME)" >>$@
- @echo " append initrd=/boot/$(INITFS_NAME) alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet" >>$@
-
- clean-syslinux:
- @rm -f $(SYSLINUX_CFG) $(ISOLINUX_CFG) $(ISOLINUX_BIN)
-
- ISO_KERNEL := $(ISO_DIR)/boot/$(KERNEL_NAME)
- ISO_REPOS_DIRSTAMP := $(DESTDIR)/stamp.isorepos
- ISOFS_DIRSTAMP := $(DESTDIR)/stamp.isofs
-
- $(ISO_REPOS_DIRSTAMP): $(ISO_PKGDIR)/APKINDEX.tar.gz
- @touch $(ISO_PKGDIR)/.boot_repository
- @rm -f $(ISO_PKGDIR)/.SIGN.*
- @touch $@
-
- $(ISO_PKGDIR)/APKINDEX.tar.gz: $(APK_FILES)
- @echo "==> iso: generating repository index"
- @apk index --description "$(ALPINE_NAME) $(ALPINE_RELEASE)" \
- -o $@ $(ISO_PKGDIR)/*.apk
- @abuild-sign $@
-
- $(ISO_KERNEL): $(MODLOOP_DIRSTAMP)
- @echo "==> iso: install kernel $(KERNEL)"
- @mkdir -p $(dir $(ISO_KERNEL))
- @apk fetch $(APK_OPTS) --stdout $(KERNEL_PKGNAME) \
- | tar -C $(ISO_DIR) -xz boot
- @rm -f $(ISO_DIR)/boot/$(KERNEL_NAME)
- @ln -s vmlinuz-$(MODLOOP_KERNEL_RELEASE) $@
- @rm -rf $(ISO_DIR)/.[A-Z]* $(ISO_DIR)/.[a-z]* $(ISO_DIR)/lib
-
- $(ISOFS_DIRSTAMP): $(MODLOOP) $(INITFS) $(ISOLINUX_CFG) $(ISOLINUX_BIN) $(ISO_KERNEL) $(ISO_REPOS_DIRSTAMP) $(SYSLINUX_CFG)
- @echo "$(ALPINE_NAME)-$(ALPINE_RELEASE) $(BUILD_DATE)" \
- > $(ISO_DIR)/.alpine-release
- @touch $@
-
- $(ISO): $(ISOFS_DIRSTAMP)
- @echo "==> iso: building $(notdir $(ISO))"
- @genisoimage -o $(ISO) -l -J -R \
- -b $(ISOLINUX_DIR)/isolinux.bin \
- -c $(ISOLINUX_DIR)/boot.cat \
- -no-emul-boot \
- -boot-load-size 4 \
- -boot-info-table \
- -quiet \
- -follow-links \
- $(ISO_OPTS) \
- $(ISO_DIR)
- @ln -fs $@ $(ISO_LINK)
-
- isofs: $(ISOFS_DIRSTAMP)
- iso: $(ISO)
-
- #
- # SHA1 sum of ISO
- #
- ISO_SHA1 := $(ISO).sha1
-
- $(ISO_SHA1): $(ISO)
- @echo "==> Generating sha1 sum"
- @sha1sum $(ISO) > $@ || rm -f $@
-
- #
- # USB image
- #
- USBIMG := $(ALPINE_NAME)-$(ALPINE_RELEASE)-$(ALPINE_ARCH).img
- USBIMG_FREE ?= 8192
- USBIMG_SIZE = $(shell echo $$(( `du -s $(ISO_DIR) | awk '{print $$1}'` + $(USBIMG_FREE) )) )
- MBRPATH := /usr/share/syslinux/mbr.bin
-
- $(USBIMG): $(ISOFS_DIRSTAMP)
- @echo "==> Generating $@"
- @mformat -C -v 'ALPINE' -c 16 -h 64 -n 32 -i $(USBIMG) \
- -t $$(($(USBIMG_SIZE) / 1000)) ::
- @syslinux $(USBIMG)
- @mcopy -i $(USBIMG) $(ISO_DIR)/* $(ISO_DIR)/.[a-z]* ::
- @mcopy -i $(USBIMG) /dev/zero ::/zero 2>/dev/null || true
- @mdel -i $(USBIMG) ::/zero
-
- USBIMG_SHA1 := $(USBIMG).sha1
- $(USBIMG_SHA1): $(USBIMG)
- @echo "==> Generating sha1 sum"
- @sha1sum $(USBIMG) > $@ || rm -f $@
-
- $(ALPINE_NAME).img: $(USBIMG)
- @ln -sf $(USBIMG) $@
-
- img: $(ALPINE_NAME).img
-
- sha1: $(ISO_SHA1) $(USBIMG_SHA1)
-
- release: $(ISO_SHA1)
-
diff --git a/alpine.packages b/alpine.packages
deleted file mode 100644
index e04b582..0000000
--- a/alpine.packages
@@ -1,124 +0,0 @@
-
- dahdi-linux-grsec
- iscsitarget-grsec
- linux-grsec
- xtables-addons-grsec
-
- acct
- acf-*
- amavis
- alpine-base
- alpine-baselayout
- alpine-conf
- apk-tools
- arpon
- arpwatch
- asterisk
- asterisk-odbc
- asterisk-pgsql
- asterisk-tds
- bbsuid
- bind
- bind-libs
- bind-tools
- bkeymaps
- bridge-utils
- busybox
- bwm-ng
- cksfv
- clamav
- clamsmtp
- conntrack-tools
- cutter
- cyrus-sasl
- dahdi-linux
- dahdi-tools
- dansguardian
- dhcp
- dhcpcd
- dnscache
- dnsmasq
- dosfstools
- dovecot
- e2fsprogs
- email
- espeak
- ethtool
- fetchmail
- fping
- haserl
- htop
- igmpproxy
- ip6tables
- iproute2
- iproute2-qos
- ipsec-tools
- iptables
- iptraf
- iputils
- irssi
- iscsitarget
- lftp
- links
- lm_sensors
- lm_sensors-detect
- logrotate
- lua
- lua-*
- lsof
- lvm2
- man
- mdadm
- mini_httpd
- miniperl
- mkinitfs
- mpg123
- mtools
- nano
- ncurses-terminfo
- net-snmp
- net-snmp-tools
- nmap
- opennhrp
- openntpd
- openrc
- openssh
- openssl
- openvpn
- p7zip
- parted
- pax-utils
- paxctl
- pciutils
- pingu
- ppp
- quagga
- rsync
- screen
- sfdisk
- shorewall*
- snort
- sntpc
- squid
- squid-errors-*
- ssmtp
- strace
- sudo
- sysklogd
- syslinux
- tcpdump
- tcpproxy
- tinydns
- tinyproxy
- transmission-cli
- unfs3
- unrar
- usbutils
- util-linux-ng
- v86d
- vim
- vsftpd
- xfsprogs
- xtables-addons
- zonenotify
-
diff --git a/mkinitram b/mkinitram
deleted file mode 100644
index 2ae21f8..0000000
--- a/mkinitram
@@ -1,88 +0,0 @@
- #!/bin/sh
-
- msg() {
- echo "==>" $@
- }
-
- die() {
- echo $@
- exit 1
- }
-
- unapk() {
- local dest="$1"
- shift
- while [ $# -gt 0 ]; do
- tar -C "$dest" -zxf "$1"
- shift
- done
- rm -f "$dest/.PKGINFO"
- }
-
-
- APKS=../aports/core/*/
-
- image=$PWD/image
- dest=$PWD/test.gz
- init=init
-
-
- kernel=$1
- # if no kernel specified, then guess...
- if [ -z "$kernel" ]; then
- kernel=$(ls /lib/modules 2>/dev/null | tail -n 1)
- fi
-
- if [ ! -d /lib/modules/$kernel ]; then
- die "modules dir /lib/modules/$kernel was not found"
- fi
- msg "mkinitram Using kernel $kernel"
-
- # create empty image dir
-
- rm -rf "$image"
- mkdir -p "$image/dev" "$image/etc/rcS.d"
-
- # unpack busybox and deps
- unapk $image $APKS/uclibc-[0-9]*.apk \
- $APKS/busybox-[0-9]*.apk \
- $APKS/alpine-baselayout-[0-9]*.apk \
- $APKS/apk-tools-[0-9]*.apk
-
- ln -sf /bin/busybox $image/init
-
- # create misc devs and enable boot scripts
- mknod $image/dev/null c 2 2
- ln -s ../init.d/mdev $image/etc/rcS.d/S10mdev
- ln -s ../init.d/hwdrivers $image/etc/rcS.d/S30hwdrivers
- ln -s ../init.d/modutils $image/etc/rcS.d/S40modutils
- ln -s ../init.d/modloop $image/etc/rcS.d/S50modloop
- ln -s ../init.d/hwdrivers $image/etc/rcS.d/S60hwdrivers
-
- mkdir $image/.modloop
-
- # load those extra drivers
- for i in ide-cd usb-storage ide-disk loop; do
- echo $i >> $image/etc/modules
- done
-
-
- # copy kernel modules
- kmods=$image/lib/modules/$kernel
- mkdir -p $kmods/kernel/drivers $kmods/kernel/fs
-
- for i in acpi ata block ide scsi cdrom usb message hid; do
- cp -LpR /lib/modules/$kernel/kernel/drivers/$i $kmods/kernel/drivers/
- done
-
- for i in isofs vfat nls ext2 cramfs '*.ko'; do
- cp -LpR /lib/modules/$kernel/kernel/fs/$i $kmods/kernel/fs/
- done
- cp -LpR /lib/modules/$kernel/kernel/lib $kmods/kernel/
-
- depmod $kernel -b $image
-
-
- # generate the image
- cd $image
- find . | cpio -o -H newc | gzip -9 > $dest
diff --git a/mkmodloop b/mkmodloop
deleted file mode 100644
index f85b628..0000000
--- a/mkmodloop
@@ -1,37 +0,0 @@
- #!/bin/sh
-
- msg() {
- echo "==>" $@
- }
-
- die() {
- echo $@
- exit 1
- }
-
- image=$PWD/modloop
- dest=$PWD/modloop.cmg
- init=init
-
-
- kernel=$1
- # if no kernel specified, then guess...
- if [ -z "$kernel" ]; then
- kernel=$(ls /lib/modules 2>/dev/null | tail -n 1)
- fi
-
- if [ ! -d /lib/modules/$kernel ]; then
- die "modules dir /lib/modules/$kernel was not found"
- fi
- msg "Using kernel $kernel"
-
-
- rm -rf "$image"
- mkdir -p "$image/lib/modules"
- cp -alf /lib/modules/$kernel $image/lib/modules/
-
- depmod -b "$image" $kernel
-
- rm -f $image/lib/modules/$kernel/source $image/lib/modules/$kernel/build
-
- mkcramfs $image/lib $dest
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 03/31] various: add descriptions, attribution, license
---
abuild-sudo.c | 9 +++++++++
abump.in | 6 ++++++
apkgrel.in | 6 ++++++
checkapk.in | 6 ++++++
4 files changed, 27 insertions(+)
diff --git a/abuild-sudo.c b/abuild-sudo.c
index 66f212a..2f34f3d 100644
--- a/abuild-sudo.c
+++ b/abuild-sudo.c
@@ -1,3 +1,12 @@
+ /* abuild-sudo.c - limited root privileges for users in "abuild" group
+ *
+ * Copyright (C) 2012 Natanael Copa <ncopa@alpinelinux.org>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation. See http://www.gnu.org/ for details.
+ */
#include <sys/types.h>
diff --git a/abump.in b/abump.in
index 10ebb8b..897b50e 100755
--- a/abump.in
+++ b/abump.in
@@ -1,5 +1,11 @@
#!/bin/sh
+ # abump - bump pkgver in APKBUILDs
+ # Copyright (c) 2012 Natanael Copa <ncopa@alpinelinux.org>
+ #
+ # Distributed under GPL-2
+ #
+
program=${0##*/}
die() {
diff --git a/apkgrel.in b/apkgrel.in
index f319a83..3feb4f3 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -1,5 +1,11 @@
#!/bin/sh
+ # apkgrel - display or bump pkgrel in APKBUILDs
+ # Copyright (c) 2012 Natanael Copa <ncopa@alpinelinux.org>
+ #
+ # Distributed under GPL-2
+ #
+
program=${0##*/}
do_show() {
diff --git a/checkapk.in b/checkapk.in
index 76d63eb..9c1d9fd 100644
--- a/checkapk.in
+++ b/checkapk.in
@@ -1,5 +1,11 @@
#!/bin/sh
+ # checkapk - find ABI breakages in package upgrades
+ # Copyright (c) 2012 Natanael Copa <natanael.copa@gmail.com>
+ #
+ # Distributed under GPL-2
+ #
+
die() {
echo "$@" >&2
exit 1
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 04/31] various: tweak opening comments, whitespace
Also remove incomplete efforts at listing "Depends on: ..."
---
abuild-keygen.in | 4 + ---
abuild-sign.in | 4 + ---
abuild.in | 4 + ---
apkgrel.in | 2 + -
newapkbuild.in | 6 ++ ----
5 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/abuild-keygen.in b/abuild-keygen.in
index 93d1ea2..a095068 100644
--- a/abuild-keygen.in
+++ b/abuild-keygen.in
@@ -1,12 +1,10 @@
#!/bin/sh
- # generate signing keys
+ # abuild-keygen - generate signing keys
# Copyright (c) 2009 Natanael Copa <ncopa@alpinelinux.org>
#
# Distributed under GPL-2
#
- # Depends on: busybox utilities, fakeroot,
- #
abuild_ver=@VERSION@
sysconfdir=@sysconfdir@
diff --git a/abuild-sign.in b/abuild-sign.in
index aea651f..3ff32e0 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -1,12 +1,10 @@
#!/bin/sh
- # sign indexes
+ # abuild-sign - sign indexes
# Copyright (c) 2009 Natanael Copa <ncopa@alpinelinux.org>
#
# Distributed under GPL-2
#
- # Depends on: busybox utilities, fakeroot,
- #
abuild_ver=@VERSION@
sysconfdir=@sysconfdir@
diff --git a/abuild.in b/abuild.in
index e51282d..ba51c79 100755
--- a/abuild.in
+++ b/abuild.in
@@ -1,12 +1,10 @@
#!/bin/sh
- # script to build apk packages (light version of makepkg)
+ # abuild - build apk packages (light version of makepkg)
# Copyright (c) 2008 Natanael Copa <natanael.copa@gmail.com>
#
# Distributed under GPL-2
#
- # Depends on: busybox utilities, fakeroot
- #
abuild_ver=@VERSION@
sysconfdir=@sysconfdir@
diff --git a/apkgrel.in b/apkgrel.in
index 3feb4f3..0934847 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -27,7 +27,7 @@ do_add () {
old=$(do_show "$f")
setto=$(($old + 1))
do_set "$f" || return 1
- done
+ done
}
do_verify() {
diff --git a/newapkbuild.in b/newapkbuild.in
index 0a0d433..1a41ae9 100755
--- a/newapkbuild.in
+++ b/newapkbuild.in
@@ -1,12 +1,10 @@
#!/bin/sh
#
- # Script to generate a new APKBUILD
+ # newapkbuild - generate a new APKBUILD
# Copyright (c) 2009 Natanael Copa <natanael.copa@gmail.com>
#
# Distributed under GPL-2
#
- # Depends on: busybox utilities, fakeroot,
- #
version=@VERSION@
sysconfdir=@sysconfdir@
@@ -297,7 +295,7 @@ while getopts "acd:fhl:n:pyu:s" opt; do
done
shift $(( $OPTIND - 1 ))
- while [ $# -gt 0 ]; do
+ while [ $# -gt 0 ]; do
newaport $1 || exit 1
shift
done
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 05/31] abuild-keygen: refactor
---
abuild-keygen.in | 119 ++++++++++++++++++++++++++++ ---------------------------
1 file changed, 61 insertions(+), 58 deletions(-)
diff --git a/abuild-keygen.in b/abuild-keygen.in
index a095068..3cf5531 100644
--- a/abuild-keygen.in
+++ b/abuild-keygen.in
@@ -22,6 +22,20 @@ msg() {
# ask for privkey unless non-interactive mode
# returns value in global $privkey
get_privkey_file() {
+ emailaddr=${PACKAGER##*<}
+ emailaddr=${emailaddr%%>*}
+
+ # if PACKAGER does not contain a valid email address, then ask git
+ if [ -z "$emailaddr" ] || [ "${emailaddr##*@}" = "$emailaddr" ]; then
+ emailaddr=$(git config --get user.email 2>/dev/null)
+ fi
+
+ if [ -n "$emailaddr" ]; then
+ default_name="$emailaddr-$(printf "%x" $(date +%s))"
+ else
+ default_name="$USER-$(printf "%x" $(date +%s))"
+ fi
+
privkey="$abuild_home/$default_name.rsa"
[ "$non_interactive" = "yes" ] && return 0
echo "Generating public/private rsa key pair for abuild"
@@ -33,6 +47,52 @@ get_privkey_file() {
fi
}
+ do_keygen() {
+ mkdir -p "$abuild_home"
+
+ get_privkey_file
+ pubkey="$privkey.pub"
+
+ # generate the private key in a subshell with stricter umask
+ (
+ umask 0007
+ openssl genrsa -out "$privkey" 2048
+ )
+ openssl rsa -in "$privkey" -pubout -out "$pubkey"
+
+
+ if [ -n "$install_pubkey" ]; then
+ msg "Installing $pubkey to /etc/apk/keys..."
+ sudo mkdir -p /etc/apk/keys
+ sudo cp -i "$pubkey" /etc/apk/keys/
+ else
+
+ msg ""
+ msg "You'll need to install $pubkey into "
+ msg "/etc/apk/keys to be able to install packages and repositories signed with"
+ msg "$privkey"
+ fi
+
+ if [ -n "$append_config" ]; then
+ if [ -f "$abuild_userconf" ]; then
+ # comment out the existing values
+ sed -i -e 's/^\(PACKAGER_PRIVKEY=.*\)/\#\1/' "$abuild_userconf"
+ fi
+ echo "PACKAGER_PRIVKEY=\"$privkey\"" >> "$abuild_userconf"
+ else
+ msg ""
+ msg "You might want add following line to $abuild_userconf:"
+ msg ""
+ msg "PACKAGER_PRIVKEY=\"$privkey\""
+ msg ""
+ fi
+
+ msg ""
+ msg "Please remember to make a safe backup of your private key:"
+ msg "$privkey"
+ msg ""
+ }
+
# print usage and exit
usage() {
echo "abuild-keygen $abuild_ver"
@@ -53,20 +113,6 @@ usage() {
# read user config if exists
[ -f "$abuild_userconf" ] && . "$abuild_userconf"
- emailaddr=${PACKAGER##*<}
- emailaddr=${emailaddr%%>*}
-
- # if PACKAGER does not contain a valid email address, then ask git
- if [ -z "$emailaddr" ] || [ "${emailaddr##*@}" = "$emailaddr" ]; then
- emailaddr=$(git config --get user.email 2>/dev/null)
- fi
-
- if [ -n "$emailaddr" ]; then
- default_name="$emailaddr-$(printf "%x" $(date +%s))"
- else
- default_name="$USER-$(printf "%x" $(date +%s))"
- fi
-
while getopts "ahinq" opt; do
case $opt in
a) append_config=yes;;
@@ -78,47 +124,4 @@ while getopts "ahinq" opt; do
done
shift $(( $OPTIND - 1))
- mkdir -p "$abuild_home"
-
- get_privkey_file
- pubkey="$privkey.pub"
-
- # generate the private key in a subshell with stricter umask
- (
- umask 0007
- openssl genrsa -out "$privkey" 2048
- )
- openssl rsa -in "$privkey" -pubout -out "$pubkey"
-
-
- if [ -n "$install_pubkey" ]; then
- msg "Installing $pubkey to /etc/apk/keys..."
- sudo mkdir -p /etc/apk/keys
- sudo cp -i "$pubkey" /etc/apk/keys/
- else
-
- msg ""
- msg "You'll need to install $pubkey into "
- msg "/etc/apk/keys to be able to install packages and repositories signed with"
- msg "$privkey"
- fi
-
- if [ -n "$append_config" ]; then
- if [ -f "$abuild_userconf" ]; then
- # comment out the existing values
- sed -i -e 's/^\(PACKAGER_PRIVKEY=.*\)/\#\1/' "$abuild_userconf"
- fi
- echo "PACKAGER_PRIVKEY=\"$privkey\"" >> "$abuild_userconf"
- else
- msg ""
- msg "You might want add following line to $abuild_userconf:"
- msg ""
- msg "PACKAGER_PRIVKEY=\"$privkey\""
- msg ""
- fi
-
- msg ""
- msg "Please remember to make a safe backup of your private key:"
- msg "$privkey"
- msg ""
-
+ do_keygen
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 06/31] abuild-sign: refactor
---
abuild-sign.in | 47 +++++++++++++++++++++++++ ----------------------
1 file changed, 25 insertions(+), 22 deletions(-)
diff --git a/abuild-sign.in b/abuild-sign.in
index 3ff32e0..73aabc7 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -18,6 +18,30 @@ die() {
exit 1
}
+ do_sign() {
+ # we are actually only interested in the name, not the file itself
+ keyname=${pubkey##*/}
+
+ for f; do
+ i=$(readlink -f $f)
+ [ -d "$i" ] && i="$i/APKINDEX.tar.gz"
+ repo="${i%/*}"
+ cd "$repo" || die "Failed to sign $i"
+ sig=".SIGN.RSA.$keyname"
+ openssl dgst -sha1 -sign "$privkey" -out "$sig" "$i" || die "Failed to sign $i"
+ tmptargz=$(mktemp)
+ tar -c "$sig" | abuild-tar --cut | gzip -9 > "$tmptargz"
+ tmpsigned=$(mktemp)
+ cat "$tmptargz" "$i" > "$tmpsigned"
+ rm -f "$tmptargz" "$sig"
+ mv "$tmpsigned" "$i"
+ chmod 644 "$i"
+ if [ -z "$quiet" ]; then
+ echo "Signed $i"
+ fi
+ done
+ }
+
usage() {
echo "abuild-sign $abuild_ver"
echo "usage: abuild-sign [-hq] [-k PRIVKEY] [-p PUBKEY] INDEXFILE..."
@@ -61,26 +85,5 @@ if [ -z "$pubkey" ]; then
pubkey=${PACKAGER_PUBKEY:-"${privkey}.pub"}
fi
- # we are actually only interested in the name, not the file itself
- keyname=${pubkey##*/}
-
- for f in "$@"; do
- i=$(readlink -f $f)
- [ -d "$i" ] && i="$i/APKINDEX.tar.gz"
- repo="${i%/*}"
- cd "$repo" || die "Failed to sign $i"
- sig=".SIGN.RSA.$keyname"
- openssl dgst -sha1 -sign "$privkey" -out "$sig" "$i" || die "Failed to sign $i"
- tmptargz=$(mktemp)
- tar -c "$sig" | abuild-tar --cut | gzip -9 > "$tmptargz"
- tmpsigned=$(mktemp)
- cat "$tmptargz" "$i" > "$tmpsigned"
- rm -f "$tmptargz" "$sig"
- mv "$tmpsigned" "$i"
- chmod 644 "$i"
- if [ -z "$quiet" ]; then
- echo "Signed $i"
- fi
- done
-
+ do_sign "$@"
exit 0
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 07/31] various: move conf-loading and i/o to functions
---
abuild-keygen.in | 20 +++++ ----------
abuild-sign.in | 19 ++++ ----------
abump.in | 23 +++++++++ --------
apkgrel.in | 12 +++++++ --
checkapk.in | 24 ++++++++ ----------
functions.sh | 34 -------------------------
functions.sh.in | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
newapkbuild.in | 21 ++++++ ----------
8 files changed, 128 insertions(+), 101 deletions(-)
delete mode 100644 functions.sh
create mode 100644 functions.sh.in
diff --git a/abuild-keygen.in b/abuild-keygen.in
index 3cf5531..9b748d3 100644
--- a/abuild-keygen.in
+++ b/abuild-keygen.in
@@ -7,17 +7,14 @@
#
abuild_ver=@VERSION@
- sysconfdir=@sysconfdir@
+ datadir=@datadir@
- abuild_conf=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
- abuild_home=${ABUILD_USERDIR:-"$HOME/.abuild"}
- abuild_userconf=${ABUILD_USERCONF:-"$abuild_home/abuild.conf"}
+ if ! [ -f "$datadir/functions.sh" ]; then
+ echo "$datadir/functions.sh: not found" >&2
+ exit 1
+ fi
+ . "$datadir/functions.sh"
- # echo message unless quite mode
- msg() {
- [ -n "$quiet" ] && return 0
- echo "$@"
- }
# ask for privkey unless non-interactive mode
# returns value in global $privkey
@@ -107,11 +104,6 @@ usage() {
exit 1
}
- # read config
- [ -f "$abuild_conf" ] && . "$abuild_conf"
-
- # read user config if exists
- [ -f "$abuild_userconf" ] && . "$abuild_userconf"
while getopts "ahinq" opt; do
case $opt in
diff --git a/abuild-sign.in b/abuild-sign.in
index 73aabc7..3260e53 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -7,16 +7,13 @@
#
abuild_ver=@VERSION@
- sysconfdir=@sysconfdir@
+ datadir=@datadir@
- abuild_conf=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
- abuild_home=${ABUILD_USERDIR:-"$HOME/.abuild"}
- abuild_userconf=${ABUILD_USERCONF:-"$abuild_home/abuild.conf"}
-
- die() {
- echo "$@" >&2
+ if ! [ -f "$datadir/functions.sh" ]; then
+ echo "$datadir/functions.sh: not found" >&2
exit 1
- }
+ fi
+ . "$datadir/functions.sh"
do_sign() {
# we are actually only interested in the name, not the file itself
@@ -52,12 +49,6 @@ usage() {
exit 1
}
- # read config
- [ -f "$abuild_conf" ] && . "$abuild_conf"
-
- # read user config if exists
- [ -f "$abuild_userconf" ] && . "$abuild_userconf"
-
privkey="$PACKAGER_PRIVKEY"
while getopts "hk:p:q" opt; do
diff --git a/abump.in b/abump.in
index 897b50e..32ff4af 100755
--- a/abump.in
+++ b/abump.in
@@ -6,12 +6,15 @@
# Distributed under GPL-2
#
- program=${0##*/}
+ abuild_ver=@VERSION@
+ datadir=@datadir@
- die() {
- echo "$@" >&2
+ if ! [ -f "$datadir/functions.sh" ]; then
+ echo "$datadir/functions.sh: not found" >&2
exit 1
- }
+ fi
+ . "$datadir/functions.sh"
+
# version bump a pkg
@@ -31,14 +34,14 @@ do_bump() {
cve=" ($cvelist)"
fi
- msg="$section/$pkgname: $upgrade to ${pkgver}${cve}"
+ message="$section/$pkgname: $upgrade to ${pkgver}${cve}"
if [ -n "$fixes" ]; then
- msg="$msg
+ message="$message
fixes #${fixes#\#}
"
fi
- echo "$msg"
+ echo "$message"
( . ./APKBUILD; type package | grep -q function ) || die "package() missing"
@@ -49,12 +52,12 @@ fixes #${fixes#\#}
abuild $abuild_opts checksum all || exit 1
git add APKBUILD
- git commit -m"$msg"
+ git commit -m"$message"
}
usage() {
- echo "$program - utility to bump pkgver in APKBUILDs"
- echo "usage: $program [-hR] [-s CVE-1,CVE-2,...] [-f ISSUE]"
+ echo "$prog - utility to bump pkgver in APKBUILDs"
+ echo "usage: $prog [-hR] [-s CVE-1,CVE-2,...] [-f ISSUE]"
echo ""
echo " -h show this help"
echo " -R run abuild with -R for recursive building"
diff --git a/apkgrel.in b/apkgrel.in
index 0934847..46e189f 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -6,7 +6,15 @@
# Distributed under GPL-2
#
- program=${0##*/}
+ abuild_ver=@VERSION@
+ datadir=@datadir@
+
+ if ! [ -f "$datadir/functions.sh" ]; then
+ echo "$datadir/functions.sh: not found" >&2
+ exit 1
+ fi
+ . "$datadir/functions.sh"
+
do_show() {
awk -F= '$1 == "pkgrel" { print $2 }' "$@"
@@ -49,7 +57,7 @@ do_nothing() {
do_usage() {
cat <<__EOF__
- Usage: $program -a|-h|-s NUM|-t|-z [-f] FILE...
+ Usage: $prog -a|-h|-s NUM|-t|-z [-f] FILE...
Commands:
-a Add 1 to current pkgrel
-g Only do the change on files that have clean git status
diff --git a/checkapk.in b/checkapk.in
index 9c1d9fd..e95249e 100644
--- a/checkapk.in
+++ b/checkapk.in
@@ -6,24 +6,22 @@
# Distributed under GPL-2
#
- die() {
- echo "$@" >&2
+ abuild_ver=@VERSION@
+ datadir=@datadir@
+
+ if ! [ -f "$datadir/functions.sh" ]; then
+ echo "$datadir/functions.sh: not found" >&2
exit 1
- }
+ fi
+ . "$datadir/functions.sh"
+
- msg() {
- echo "$@"
- }
- have_abuild_conf=
- for conf in /etc/abuild.conf ~/.abuild/abuild.conf; do
- if [ -f "$conf" ]; then
- . $conf && have_abuild_conf=yes
- fi
- done
- [ -z "$have_abuild_conf" ] && die "no abuild.conf found"
+ if ! [ -f "$abuild_conf" ] && ! [ -f "$abuild_userconf" ]; then
+ die "no abuild.conf found"
+ fi
if ! [ -f APKBUILD ]; then
die 'This must be run in the directory of a built package.'
diff --git a/functions.sh b/functions.sh
deleted file mode 100644
index 032a7e6..0000000
--- a/functions.sh
@@ -1,34 +0,0 @@
-
- #colors
- if [ -n "$USE_COLORS" ]; then
- NORMAL="\033[1;0m"
- STRONG="\033[1;1m"
- RED="\033[1;31m"
- GREEN="\033[1;32m"
- YELLOW="\033[1;33m"
- BLUE="\033[1;34m"
- fi
-
-
- # functions
- msg() {
- local prompt="$GREEN>>>${NORMAL}"
- local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}"
- local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
- [ -z "$quiet" ] && printf "${prompt} ${name}${fake}: $@\n" >&2
- }
-
- warning() {
- local prompt="${YELLOW}>>> WARNING:${NORMAL}"
- local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}"
- local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
- printf "${prompt} ${name}${fake}: $@\n" >&2
- }
-
- error() {
- local prompt="${RED}>>> ERROR:${NORMAL}"
- local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}"
- local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
- printf "${prompt} ${name}${fake}: $@\n" >&2
- }
-
diff --git a/functions.sh.in b/functions.sh.in
new file mode 100644
index 0000000..d71ef38
--- /dev/null
+++ b/functions.sh.in
@@ -0,0 +1,76 @@
+ # /usr/share/abuild/functions.sh
+
+ sysconfdir=@sysconfdir@
+ prog=${0##*/}
+
+
+ abuild_conf=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
+ abuild_home=${ABUILD_USERDIR:-"$HOME/.abuild"}
+ abuild_userconf=${ABUILD_USERCONF:-"$abuild_home/abuild.conf"}
+
+ # read config
+ if [ -f "$abuild_conf" ]; then
+ . "$abuild_conf" || abuild_conf=
+ fi
+
+ # read user config if exists
+ if [ -f "$abuild_userconf" ]; then
+ . "$abuild_userconf" || abuild_userconf=
+ fi
+
+
+ # output functions
+ case $prog in
+ abuild)
+ if [ -n "$USE_COLORS" ]; then
+ NORMAL="\033[1;0m"
+ STRONG="\033[1;1m"
+ RED="\033[1;31m"
+ GREEN="\033[1;32m"
+ YELLOW="\033[1;33m"
+ BLUE="\033[1;34m"
+ fi
+
+ msg() {
+ local prompt="$GREEN>>>${NORMAL}"
+ local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}"
+ local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
+ [ -z "$quiet" ] && printf "${prompt} ${name}${fake}: $@\n" >&2
+ }
+
+ warning() {
+ local prompt="${YELLOW}>>> WARNING:${NORMAL}"
+ local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}"
+ local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
+ printf "${prompt} ${name}${fake}: $@\n" >&2
+ }
+
+ error() {
+ local prompt="${RED}>>> ERROR:${NORMAL}"
+ local fake="${FAKEROOTKEY:+${BLUE}*${NORMAL}}"
+ local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
+ printf "${prompt} ${name}${fake}: $@\n" >&2
+ }
+ ;;
+ *)
+ msg() {
+ # Here we write to stdout, but abuild's fancier messages write to stderr
+ [ -z "$quiet" ] && echo "$@"
+ }
+
+ error() {
+ echo "$@" >&2
+ }
+ ;;
+ esac
+
+ # caller may override
+ cleanup() {
+ return 0
+ }
+
+ die() {
+ error "$@"
+ cleanup
+ exit 1
+ }
diff --git a/newapkbuild.in b/newapkbuild.in
index 1a41ae9..0f95f19 100755
--- a/newapkbuild.in
+++ b/newapkbuild.in
@@ -6,22 +6,15 @@
# Distributed under GPL-2
#
- version=@VERSION@
- sysconfdir=@sysconfdir@
+ abuild_ver=@VERSION@
datadir=@datadir@
- prog=${0##*/}
+ if ! [ -f "$datadir/functions.sh" ]; then
+ echo "$datadir/functions.sh: not found" >&2
+ exit 1
+ fi
+ . "$datadir/functions.sh"
- # Source $PACKAGER
- for i in $sysconfdir/abuild.conf $HOME/.abuild/abuild.conf; do
- if [ -f "$i" ]; then
- . $i
- fi
- done
-
- error() {
- echo "$@" >&2
- }
is_url() {
case "$1" in
@@ -260,7 +253,7 @@ __EOF__
}
usage() {
- echo "$prog $version"
+ echo "$prog $abuild_ver"
echo "usage: $prog [-cfh] [-d DESC] [-l LICENSE] [-n NAME] [-u URL] PKGNAME[-PKGVER]|SRCURL"
echo "Options:"
echo " -a Create autotools (use ./configure ...)"
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 08/31] Makefile: add missing files to dist
---
Makefile | 3 ++ -
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 5587c9a..3afe995 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,8 @@ SAMPLES := sample.APKBUILD sample.initd sample.confd \
SCRIPT_SOURCES := $(addsuffix .in,$(SCRIPTS))
- DISTFILES=$(SCRIPT_SOURCES) $(SAMPLES) Makefile abuild.conf
+ DISTFILES=$(SCRIPT_SOURCES) $(SAMPLES) Makefile abuild.conf \
+ functions.sh.in abuild-tar.c abuild-sudo.c aports.lua
GIT_REV := $(shell test -d .git && git describe || echo exported)
ifneq ($(GIT_REV), exported)
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 09/31] Makefile: remove dist
as discussed in http://lists.alpinelinux.org/alpine-devel/3122.html
---
Makefile | 15 + --------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/Makefile b/Makefile
index 3afe995..2ceef85 100644
--- a/Makefile
+++ b/Makefile
@@ -19,9 +19,6 @@ SAMPLES := sample.APKBUILD sample.initd sample.confd \
SCRIPT_SOURCES := $(addsuffix .in,$(SCRIPTS))
- DISTFILES=$(SCRIPT_SOURCES) $(SAMPLES) Makefile abuild.conf \
- functions.sh.in abuild-tar.c abuild-sudo.c aports.lua
-
GIT_REV := $(shell test -d .git && git describe || echo exported)
ifneq ($(GIT_REV), exported)
FULL_VERSION := $(patsubst $(PACKAGE)-%,%,$(GIT_REV))
@@ -83,7 +80,6 @@ abuild-tar.static: abuild-tar.o
help:
@echo "$(P) makefile"
@echo "usage: make install [ DESTDIR=<path> ]"
- @echo " make dist"
install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh aports.lua
install -d $(DESTDIR)/$(bindir) $(DESTDIR)/$(sysconfdir) \
@@ -103,15 +99,6 @@ install: $(USR_BIN_FILES) $(SAMPLES) abuild.conf functions.sh aports.lua
mkdir -p $(DESTDIR)$(LUA_SHAREDIR)
cp aports.lua $(DESTDIR)$(LUA_SHAREDIR)/
- dist: $(P).tar.bz2
-
- $(P).tar.bz2: $(DISTFILES)
- rm -rf $(P)
- mkdir -p $(P)
- cp $(DISTFILES) $(P)/
- tar -cjf $@ $(P)
- rm -rf $(P)
-
.gitignore: Makefile
echo "*.tar.bz2" > $@
for i in $(USR_BIN_FILES); do\
@@ -119,4 +106,4 @@ $(P).tar.bz2: $(DISTFILES)
done
- .PHONY: install dist
+ .PHONY: install
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 10/31] various: use long options, rework usages
---
abuild-keygen.in | 54 +++++++++++++++++++++++++++++++ ------------------
abuild-sign.in | 45 ++++++++++++++++++++++++++++ -------------
abump.in | 53 ++++++++++++++++++++++++++++++++ ----------------
apkgrel.in | 61 ++++++++++++++++++++++++++++++++ ------------------------
checkapk.in | 12 +++++++++++
newapkbuild.in | 35 ++++++++++++++++ ----------------
6 files changed, 167 insertions(+), 93 deletions(-)
diff --git a/abuild-keygen.in b/abuild-keygen.in
index 9b748d3..34af0ee 100644
--- a/abuild-keygen.in
+++ b/abuild-keygen.in
@@ -90,30 +90,46 @@ do_keygen() {
msg ""
}
- # print usage and exit
usage() {
- echo "abuild-keygen $abuild_ver"
- echo "usage: abuild-keygen [-ih]"
- echo "options:"
- echo " -a Set PACKAGER_PRIVKEY=<generated key> in $abuild_userconf"
- echo " -i Install public key into /etc/apk/keys using sudo"
- echo " -h Show this help"
- echo " -n Non-interactive. Use defaults"
- echo " -q Quiet mode"
- echo ""
- exit 1
+ cat >&2 <<__EOF__
+ $prog $abuild_ver - generate signing keys
+ Usage: $prog [-a|--append] [-i|--install] [-n]
+ Options:
+ -a, --append Set PACKAGER_PRIVKEY=<generated key> in $abuild_userconf
+ -i, --install Install public key into /etc/apk/keys using sudo
+ -n Non-interactive. Use defaults
+ -q, --quiet
+ -h, --help Show this help
+
+ __EOF__
}
+ append_config=
+ install_pubkey=
+ non_interactive=
+ quiet=
- while getopts "ahinq" opt; do
- case $opt in
- a) append_config=yes;;
- h) usage;;
- i) install_pubkey=yes;;
- n) non_interactive=yes;;
- q) quiet=-quiet;;
+ args=`getopt -o ainqh --long append,install,quiet,help -n "$prog" -- "$@"`
+ if [ $? -ne 0 ]; then
+ usage
+ exit 2
+ fi
+ eval set -- "$args"
+ while true; do
+ case $1 in
+ -a|--append) append_config=1;;
+ -i|--install) install_pubkey=1;;
+ -n) non_interactive=yes;;
+ -q|--quiet) quiet=1;; # suppresses msg
+ -h|--help) usage; exit;;
+ --) shift; break;;
+ *) exit 1;; # getopt error
esac
+ shift
done
- shift $(( $OPTIND - 1))
+ if [ $# -ne 0 ]; then
+ usage
+ exit 2
+ fi
do_keygen
diff --git a/abuild-sign.in b/abuild-sign.in
index 3260e53..b5250af 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -40,26 +40,43 @@ do_sign() {
}
usage() {
- echo "abuild-sign $abuild_ver"
- echo "usage: abuild-sign [-hq] [-k PRIVKEY] [-p PUBKEY] INDEXFILE..."
- echo "options:"
- echo " -h Show this help"
- echo " -k The private key to use for signing"
- echo " -p The name of public key. apk add will look for /etc/apk/keys/PUBKEY"
- exit 1
+ cat >&2 <<__EOF__
+ $prog $abuild_ver - sign indexes
+ Usage: $prog [-k PRIVKEY] [-p PUBKEY] INDEXFILE...
+ Options:
+ -k, --private KEY The private key to use for signing
+ -p, --public KEY The name of public key. apk add will look for /etc/apk/keys/KEY
+ -q, --quiet
+ -h, --help Show this help
+
+ __EOF__
}
privkey="$PACKAGER_PRIVKEY"
+ pubkey=
+ quiet=
- while getopts "hk:p:q" opt; do
- case $opt in
- h) usage;;
- k) privkey=$OPTARG;;
- p) pubkey=$OPTARG;;
- q) quiet=yes;;
+ args=`getopt -o k:p:qh --long private:,public:,quiet,help -n "$prog" -- "$@"`
+ if [ $? -ne 0 ]; then
+ usage
+ exit 2
+ fi
+ eval set -- "$args"
+ while true; do
+ case $1 in
+ -k|--private) privkey=$2; shift;;
+ -p|--public) pubkey=$2; shift;;
+ -q|--quiet) quiet=1;; # suppresses msg
+ -h|--help) usage; exit;;
+ --) shift; break;;
+ *) exit 1;; # getopt error
esac
+ shift
done
- shift $(( $OPTIND - 1))
+ if [ $# -eq 0 ]; then
+ usage
+ exit 2
+ fi
if [ -z "$privkey" ]; then
echo "No private key found. Use 'abuild-keygen' to generate the keys"
diff --git a/abump.in b/abump.in
index 32ff4af..3b501e3 100755
--- a/abump.in
+++ b/abump.in
@@ -56,29 +56,48 @@ fixes #${fixes#\#}
}
usage() {
- echo "$prog - utility to bump pkgver in APKBUILDs"
- echo "usage: $prog [-hR] [-s CVE-1,CVE-2,...] [-f ISSUE]"
- echo ""
- echo " -h show this help"
- echo " -R run abuild with -R for recursive building"
- echo " -k keep existing packages"
- echo " -s security update"
- echo " -f fixes ISSUE"
- exit 0
+ cat >&2 <<__EOF__
+ $prog $abuild_ver - bump pkgver in APKBUILDs
+ Usage: $prog [-s CVE-1,CVE-2,...] [-f ISSUE] [-R|--recursive] [-k|--keep] PKGNAME-1.2.3 ...
+ Options:
+ -s, --security CVE1,CVE-2,... Security update
+ -f, --fixes ISSUE Fixes ISSUE
+ -R, --recursive Run abuild with -R for recursive building
+ -k, --keep Run abuild with -k to keep existing packages
+ -q, --quiet
+ -h, --help Show this help
+
+ __EOF__
}
keep=
recursive="-r"
- while getopts "f:hkRs:" opt; do
- case $opt in
- f) fixes="${OPTARG}";;
- h) usage;;
- k) keep="-k";;
- R) recursive="-R";;
- s) cvelist="$OPTARG";;
+ cvelist=
+ fixes=
+
+ args=`getopt -o s:Rkqh --long security:,recursive,keep,quiet,help -n "$prog" -- "$@"`
+ if [ $? -ne 0 ]; then
+ usage
+ exit 2
+ fi
+ eval set -- "$args"
+ while true; do
+ case $1 in
+ -s|--security) cvelist="$2"; shift;;
+ -f|--fixes) fixes="$2"; shift;;
+ -R|--recursive) recursive="-R";;
+ -k|--keep) keep="-k";;
+ -q|--quiet) quiet=1;; # suppresses msg
+ -h|--help) usage; exit;;
+ --) shift; break;;
+ *) exit 1;; # getopt error
esac
+ shift
done
- shift $(( $OPTIND - 1))
+ if [ $# -eq 0 ]; then
+ usage
+ exit 2
+ fi
abuild_opts="$recursive $keep"
diff --git a/apkgrel.in b/apkgrel.in
index 46e189f..57b3b93 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -55,42 +55,51 @@ do_nothing() {
return 0
}
- do_usage() {
- cat <<__EOF__
- Usage: $prog -a|-h|-s NUM|-t|-z [-f] FILE...
- Commands:
- -a Add 1 to current pkgrel
- -g Only do the change on files that have clean git status
- -h Show this help
- -s Set pkgrel to NUM
- -t Only verify that files are in proper format
- -z Set pkgrel to 0
-
+ usage() {
+ cat >&2 <<__EOF__
+ $prog $abuild_ver - display or bump pkgrel in APKBUILDs
+ Usage: $prog [-z|--zero] [-a|--add] [-g|--clean-git] [-s|--set NUM] [-t|--test] [-f|--force] DIR or APKBUILD...
Options:
- -f Force, even if given files are not in proper format
+ -z, --zero Set pkgrel to 0
+ -a, --add Add 1 to current pkgrel
+ -g, --clean-git Only operate on APKBUILDs with clean git status
+ -s, --set NUM Set pkgrel to NUM
+ -t, --test Only verify that files have a valid pkgrel
+ -f, --force Operate on files without a valid pkgrel
+ -h, --help Show this help
__EOF__
}
cmd=do_show
force=
- while getopts "afghs:tz" opt; do
- case $opt in
- a) cmd=do_add;;
- g) only_clean_git=1;;
- f) force=1;;
- h) cmd=do_usage;;
- s) setto=$OPTARG; cmd=do_set;;
- t) cmd=do_nothing;;
- z) setto=0; cmd=do_set;;
+ setto=
+ only_clean_git=
+
+ args=`getopt -o zags:tfqh --long zero,add,clean-git,set:,test,force,quiet,help -n "$prog" -- "$@"`
+ if [ $? -ne 0 ]; then
+ usage
+ exit 2
+ fi
+ eval set -- "$args"
+ while true; do
+ case $1 in
+ -z|--zero) setto=0; cmd=do_set;;
+ -a|--add) cmd=do_add;;
+ -g|--clean-git) only_clean_git=1;;
+ -s|--set) setto=$2; shift; cmd=do_set;;
+ -t|--test) cmd=do_nothing;;
+ -f|--force) force=1;;
+ -q|--quiet) quiet=1;; # noop
+ -h|--help) usage; exit;;
+ --) shift; break;;
+ *) exit 1;; # getopt error
esac
+ shift
done
-
- shift $(( $OPTIND - 1))
-
if [ $# -eq 0 ]; then
- do_usage
- exit 1
+ usage
+ exit 2
fi
do_verify "$@" || exit 1
diff --git a/checkapk.in b/checkapk.in
index e95249e..2953b8b 100644
--- a/checkapk.in
+++ b/checkapk.in
@@ -16,8 +16,20 @@ fi
. "$datadir/functions.sh"
+ usage() {
+ cat >&2 <<__EOF__
+ $prog $abuild_ver - find ABI breakages in package upgrades
+ Usage: $prog
+ Run in the directory of a built package.
+ __EOF__
+ }
+
+ if [ $# -gt 0 ]; then
+ usage
+ exit 2
+ fi
if ! [ -f "$abuild_conf" ] && ! [ -f "$abuild_userconf" ]; then
die "no abuild.conf found"
diff --git a/newapkbuild.in b/newapkbuild.in
index 0f95f19..1b65815 100755
--- a/newapkbuild.in
+++ b/newapkbuild.in
@@ -253,22 +253,23 @@ __EOF__
}
usage() {
- echo "$prog $abuild_ver"
- echo "usage: $prog [-cfh] [-d DESC] [-l LICENSE] [-n NAME] [-u URL] PKGNAME[-PKGVER]|SRCURL"
- echo "Options:"
- echo " -a Create autotools (use ./configure ...)"
- echo " -c Copy a sample init.d, conf.d, and install script to new directory"
- echo " -d Set package description (pkgdesc) to DESC"
- echo " -f Force even if directory already exist"
- echo " -h Show this help"
- echo " -l Set package license to LICENSE"
- echo " -n Set package name to NAME"
- echo " -p Create perl package (Assume Makefile.PL is there)"
- echo " -y Create python package (Assume setup.py is there)"
- echo " -u Set package URL"
- echo " -s Use sourceforge source URL"
- echo ""
- exit 0
+ cat >&2 <<__EOF__
+ $prog $abuild_ver - generate a new APKBUILD
+ Usage: $prog [-cfh] [-d DESC] [-l LICENSE] [-n NAME] [-u URL] PKGNAME[-PKGVER]|SRCURL
+ Options:
+ -n Set package name to NAME
+ -d Set package description (pkgdesc) to DESC
+ -l Set package license to LICENSE
+ -u Set package URL
+ -a Create autotools (use ./configure ...)
+ -p Create perl package (Assume Makefile.PL is there)
+ -y Create python package (Assume setup.py is there)
+ -s Use sourceforge source URL
+ -c Copy a sample init.d, conf.d, and install script to new directory
+ -f Force even if directory already exist
+ -h Show this help
+
+ __EOF__
}
while getopts "acd:fhl:n:pyu:s" opt; do
@@ -277,7 +278,7 @@ while getopts "acd:fhl:n:pyu:s" opt; do
'c') cpinitd=1;;
'd') pkgdesc="$OPTARG";;
'f') force=1;;
- 'h') usage;;
+ 'h') usage; exit;;
'l') license="$OPTARG";;
'n') pkgname="$OPTARG";;
'p') buildtype="perl";;
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 11/31] abuild_keygen: several tweaks
* make vars local
* refactor calculation of default_name
* make non_interactive=1
* tweak error message
* tweak sed command
---
abuild-keygen.in | 15 ++++++ ---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/abuild-keygen.in b/abuild-keygen.in
index 34af0ee..bf9d105 100644
--- a/abuild-keygen.in
+++ b/abuild-keygen.in
@@ -19,6 +19,7 @@ fi
# ask for privkey unless non-interactive mode
# returns value in global $privkey
get_privkey_file() {
+ local emailaddr default_name
emailaddr=${PACKAGER##*<}
emailaddr=${emailaddr%%>*}
@@ -27,16 +28,12 @@ get_privkey_file() {
emailaddr=$(git config --get user.email 2>/dev/null)
fi
- if [ -n "$emailaddr" ]; then
- default_name="$emailaddr-$(printf "%x" $(date +%s))"
- else
- default_name="$USER-$(printf "%x" $(date +%s))"
- fi
+ default_name="${emailaddr:-$USER}-$(printf "%x" $(date +%s))"
privkey="$abuild_home/$default_name.rsa"
- [ "$non_interactive" = "yes" ] && return 0
+ [ -n "$non_interactive" ] && return 0
echo "Generating public/private rsa key pair for abuild"
- echo -n "Enter file in which to save the key ($abuild_home/$default_name.rsa): "
+ echo -n "Enter file in which to save the key [$privkey]: "
read line
if [ -n "$line" ]; then
@@ -73,7 +70,7 @@ do_keygen() {
if [ -n "$append_config" ]; then
if [ -f "$abuild_userconf" ]; then
# comment out the existing values
- sed -i -e 's/^\(PACKAGER_PRIVKEY=.*\)/\#\1/' "$abuild_userconf"
+ sed -i -e 's/^PACKAGER_PRIVKEY=/\#&/' "$abuild_userconf"
fi
echo "PACKAGER_PRIVKEY=\"$privkey\"" >> "$abuild_userconf"
else
@@ -119,7 +116,7 @@ while true; do
case $1 in
-a|--append) append_config=1;;
-i|--install) install_pubkey=1;;
- -n) non_interactive=yes;;
+ -n) non_interactive=1;;
-q|--quiet) quiet=1;; # suppresses msg
-h|--help) usage; exit;;
--) shift; break;;
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 12/31] abuild-sign: reformat error output
---
abuild-sign.in | 16 +++++++++ -------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/abuild-sign.in b/abuild-sign.in
index b5250af..3303750 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -79,13 +79,15 @@ if [ $# -eq 0 ]; then
fi
if [ -z "$privkey" ]; then
- echo "No private key found. Use 'abuild-keygen' to generate the keys"
- echo "Then you can either:"
- echo " 1. set the PACKAGER_PRIVKEY in $abuild_userconf"
- echo " (Note that 'abuild-keygen -a' does this for you)"
- echo " 2. set the PACKAGER_PRIVKEY in $abuild_conf"
- echo " 3. specify the key with the -k option"
- echo ""
+ cat >&2 << __EOF__
+ No private key found. Use 'abuild-keygen' to generate the keys.
+ Then you can either:
+ * set the PACKAGER_PRIVKEY in $abuild_userconf
+ ('abuild-keygen -a' does this for you)
+ * set the PACKAGER_PRIVKEY in $abuild_conf
+ * specify the key with the -k option to $prog
+
+ __EOF__
exit 1
fi
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 13/31] abuild-sign: make vars local
---
abuild-sign.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/abuild-sign.in b/abuild-sign.in
index 3303750..777114a 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -16,6 +16,8 @@ fi
. "$datadir/functions.sh"
do_sign() {
+ local f i keyname repo
+
# we are actually only interested in the name, not the file itself
keyname=${pubkey##*/}
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 14/31] abuild-sign: wrap cd in a subshell, use set -e
---
abuild-sign.in | 7 +++++ --
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/abuild-sign.in b/abuild-sign.in
index 777114a..6207aab 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -25,9 +25,11 @@ do_sign() {
i=$(readlink -f $f)
[ -d "$i" ] && i="$i/APKINDEX.tar.gz"
repo="${i%/*}"
- cd "$repo" || die "Failed to sign $i"
+ (
+ set -e
+ cd "$repo"
sig=".SIGN.RSA.$keyname"
- openssl dgst -sha1 -sign "$privkey" -out "$sig" "$i" || die "Failed to sign $i"
+ openssl dgst -sha1 -sign "$privkey" -out "$sig" "$i"
tmptargz=$(mktemp)
tar -c "$sig" | abuild-tar --cut | gzip -9 > "$tmptargz"
tmpsigned=$(mktemp)
@@ -38,6 +40,7 @@ do_sign() {
if [ -z "$quiet" ]; then
echo "Signed $i"
fi
+ ) || die "Failed to sign $i"
done
}
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 15/31] abuild-sign: fix a race condition
---
abuild-sign.in | 2 + -
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/abuild-sign.in b/abuild-sign.in
index 6207aab..96a1826 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -35,8 +35,8 @@ do_sign() {
tmpsigned=$(mktemp)
cat "$tmptargz" "$i" > "$tmpsigned"
rm -f "$tmptargz" "$sig"
+ chmod 644 "$tmpsigned"
mv "$tmpsigned" "$i"
- chmod 644 "$i"
if [ -z "$quiet" ]; then
echo "Signed $i"
fi
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 16/31] abump: move loop inside do_bump, refine locals
---
abump.in | 57 +++++++++++++++++++++++++++ ------------------------------
1 file changed, 27 insertions(+), 30 deletions(-)
diff --git a/abump.in b/abump.in
index 3b501e3..72afdbc 100755
--- a/abump.in
+++ b/abump.in
@@ -16,43 +16,43 @@ fi
. "$datadir/functions.sh"
- # version bump a pkg
-
+ # version bump packages
do_bump() {
- local pkgname=${1%-[0-9]*}
- local pkgver=${1#${pkgname}-}
-
- APORTS=$HOME/aports
+ local p pkgname pkgver section upgrade cve message
+ for p; do
+ pkgname=${p%-[0-9]*}
+ pkgver=${p#${pkgname}-}
- set -e
+ set -e
- cd $APORTS/*/$pkgname || return 1
- local section=${PWD%/*} upgrade="upgrade" cve=
- section=${section##*/}
- if [ -n "$cvelist" ]; then
- upgrade="security upgrade"
- cve=" ($cvelist)"
- fi
+ cd $HOME/aports/*/$pkgname || exit 1
+ section=${PWD%/*} upgrade="upgrade" cve=
+ section=${section##*/}
+ if [ -n "$cvelist" ]; then
+ upgrade="security upgrade"
+ cve=" ($cvelist)"
+ fi
- message="$section/$pkgname: $upgrade to ${pkgver}${cve}"
- if [ -n "$fixes" ]; then
- message="$message
+ message="$section/$pkgname: $upgrade to ${pkgver}${cve}"
+ if [ -n "$fixes" ]; then
+ message="$message
fixes #${fixes#\#}
"
- fi
- echo "$message"
+ fi
+ echo "$message"
- ( . ./APKBUILD; type package | grep -q function ) || die "package() missing"
+ ( . ./APKBUILD; type package | grep -q function ) || die "package() missing"
- sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \
- -e "s/^pkgrel=.*/pkgrel=0/" \
- APKBUILD
+ sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \
+ -e "s/^pkgrel=.*/pkgrel=0/" \
+ APKBUILD
- abuild $abuild_opts checksum all || exit 1
+ abuild $abuild_opts checksum all || exit 1
- git add APKBUILD
- git commit -m"$message"
+ git add APKBUILD
+ git commit -m"$message"
+ done
}
usage() {
@@ -101,8 +101,5 @@ fi
abuild_opts="$recursive $keep"
- while [ $# -gt 0 ]; do
- ( do_bump "$1" ) || exit 1
- shift
- done
+ do_bump "$@"
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 17/31] abump: introduce subshell, rc
---
abump.in | 9 ++++++ ---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/abump.in b/abump.in
index 72afdbc..1d4e1e4 100755
--- a/abump.in
+++ b/abump.in
@@ -18,14 +18,15 @@ fi
# version bump packages
do_bump() {
- local p pkgname pkgver section upgrade cve message
+ local p rc=0 pkgname pkgver section upgrade cve message
for p; do
pkgname=${p%-[0-9]*}
pkgver=${p#${pkgname}-}
+ (
set -e
- cd $HOME/aports/*/$pkgname || exit 1
+ cd $HOME/aports/*/$pkgname
section=${PWD%/*} upgrade="upgrade" cve=
section=${section##*/}
if [ -n "$cvelist" ]; then
@@ -48,11 +49,13 @@ fixes #${fixes#\#}
-e "s/^pkgrel=.*/pkgrel=0/" \
APKBUILD
- abuild $abuild_opts checksum all || exit 1
+ abuild $abuild_opts checksum all
git add APKBUILD
git commit -m"$message"
+ ) || rc=1
done
+ return $rc
}
usage() {
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 18/31] abump: make abuild also clean
---
abump.in | 2 + -
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/abump.in b/abump.in
index 1d4e1e4..33d962d 100755
--- a/abump.in
+++ b/abump.in
@@ -49,7 +49,7 @@ fixes #${fixes#\#}
-e "s/^pkgrel=.*/pkgrel=0/" \
APKBUILD
- abuild $abuild_opts checksum all
+ abuild $abuild_opts checksum all clean
git add APKBUILD
git commit -m"$message"
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 19/31] abump: tweak upgrade/cvelist
---
abump.in | 13 +++++ --------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/abump.in b/abump.in
index 33d962d..ddd9715 100755
--- a/abump.in
+++ b/abump.in
@@ -18,7 +18,8 @@ fi
# version bump packages
do_bump() {
- local p rc=0 pkgname pkgver section upgrade cve message
+ local p rc=0 pkgname pkgver section message
+ local upgrade="${cvelist:+security }upgrade"
for p; do
pkgname=${p%-[0-9]*}
pkgver=${p#${pkgname}-}
@@ -27,14 +28,10 @@ do_bump() {
set -e
cd $HOME/aports/*/$pkgname
- section=${PWD%/*} upgrade="upgrade" cve=
+ section=${PWD%/*}
section=${section##*/}
- if [ -n "$cvelist" ]; then
- upgrade="security upgrade"
- cve=" ($cvelist)"
- fi
- message="$section/$pkgname: $upgrade to ${pkgver}${cve}"
+ message="$section/$pkgname: $upgrade to ${pkgver}${cvelist}"
if [ -n "$fixes" ]; then
message="$message
@@ -86,7 +83,7 @@ fi
eval set -- "$args"
while true; do
case $1 in
- -s|--security) cvelist="$2"; shift;;
+ -s|--security) cvelist=" ($2)"; shift;;
-f|--fixes) fixes="$2"; shift;;
-R|--recursive) recursive="-R";;
-k|--keep) keep="-k";;
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 20/31] abump, functions: refactor (and verify) calculation of APKBUILD path
---
abump.in | 12 +++++++++++ -
functions.sh.in | 12 ++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/abump.in b/abump.in
index ddd9715..7a0bd57 100755
--- a/abump.in
+++ b/abump.in
@@ -20,14 +20,22 @@ fi
do_bump() {
local p rc=0 pkgname pkgver section message
local upgrade="${cvelist:+security }upgrade"
+ local a
for p; do
pkgname=${p%-[0-9]*}
pkgver=${p#${pkgname}-}
+ # calculate APKBUILD's path
+ if [ "${pkgname#*/}" != "$pkgname" ] && ! [ -d "$APORTSDIR/${pkgname%/*} ]; then
+ error "'$p' should be of form 'foo-1.2.3' or 'main/foo-1.2.3'"
+ rc=1; continue
+ fi
+ a=$(aports_buildscript "$pkgname" || die "can't find APKBUILD for $pkgname") || { rc=1; continue; }
+
(
set -e
- cd $HOME/aports/*/$pkgname
+ cd "${a%/*}"
section=${PWD%/*}
section=${section##*/}
@@ -75,6 +83,8 @@ recursive="-r"
cvelist=
fixes=
+ [ -n "$APORTSDIR" ] || error "can't locate \$APORTSDIR"
+
args=`getopt -o s:Rkqh --long security:,recursive,keep,quiet,help -n "$prog" -- "$@"`
if [ $? -ne 0 ]; then
usage
diff --git a/functions.sh.in b/functions.sh.in
index d71ef38..96b0586 100644
--- a/functions.sh.in
+++ b/functions.sh.in
@@ -19,6 +19,18 @@ if [ -f "$abuild_userconf" ]; then
fi
+ # expects $1 to be a package directory in the aports tree ('foo' or 'main/foo')
+ # outputs APKBUILD's path if successful
+ aports_buildscript() {
+ [ -n "$APORTSDIR" ] || return 1
+ if [ "${1#*/}" != "$1" ]; then
+ ( cd "$APORTSDIR/$1" && [ -f APKBUILD ] && echo "$PWD/APKBUILD" )
+ else
+ ( cd "$APORTSDIR"/*/"$1" && [ -f APKBUILD ] && echo "$PWD/APKBUILD" )
+ fi
+ }
+
+
# output functions
case $prog in
abuild)
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 21/31] abump: refactor verification of APKBUILD
* includes renaming pkgname, pkgver
---
abump.in | 23 ++++++++++++++ ---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/abump.in b/abump.in
index 7a0bd57..f25a4ea 100755
--- a/abump.in
+++ b/abump.in
@@ -18,19 +18,26 @@ fi
# version bump packages
do_bump() {
- local p rc=0 pkgname pkgver section message
+ local p rc=0 name ver section message
local upgrade="${cvelist:+security }upgrade"
local a
for p; do
- pkgname=${p%-[0-9]*}
- pkgver=${p#${pkgname}-}
+ name=${p%-[0-9]*}
+ ver=${p#${name}-}
# calculate APKBUILD's path
- if [ "${pkgname#*/}" != "$pkgname" ] && ! [ -d "$APORTSDIR/${pkgname%/*} ]; then
+ if [ "${name#*/}" != "$name" ] && ! [ -d "$APORTSDIR/${name%/*} ]; then
error "'$p' should be of form 'foo-1.2.3' or 'main/foo-1.2.3'"
rc=1; continue
fi
- a=$(aports_buildscript "$pkgname" || die "can't find APKBUILD for $pkgname") || { rc=1; continue; }
+ a=$(aports_buildscript "$name" || die "can't find APKBUILD for $name") || { rc=1; continue; }
+
+ # verify APKBUILD
+ (
+ . "$a" || exit 1
+ [ "$pkgname" = "$name" ] || die "$name: APKBUILD has different \$pkgname"
+ type package | grep -q function || die "$name: missing package()"
+ ) || { rc=1; continue; }
(
set -e
@@ -39,7 +46,7 @@ do_bump() {
section=${PWD%/*}
section=${section##*/}
- message="$section/$pkgname: $upgrade to ${pkgver}${cvelist}"
+ message="$section/$name: $upgrade to ${ver}${cvelist}"
if [ -n "$fixes" ]; then
message="$message
@@ -48,9 +55,7 @@ fixes #${fixes#\#}
fi
echo "$message"
- ( . ./APKBUILD; type package | grep -q function ) || die "package() missing"
-
- sed -i -e "s/^pkgver=.*/pkgver=$pkgver/" \
+ sed -i -e "s/^pkgver=.*/pkgver=$ver/" \
-e "s/^pkgrel=.*/pkgrel=0/" \
APKBUILD
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 22/31] abump: verify APKBUILD's version
---
abump.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/abump.in b/abump.in
index f25a4ea..81b2705 100755
--- a/abump.in
+++ b/abump.in
@@ -37,6 +37,12 @@ do_bump() {
. "$a" || exit 1
[ "$pkgname" = "$name" ] || die "$name: APKBUILD has different \$pkgname"
type package | grep -q function || die "$name: missing package()"
+ case $(apk version --test "$pkgver" "$ver") in
+ '=') die "$pkgname: already at version $pkgver";;
+ '>') die "$pkgname: already at newer version $pkgver";;
+ '<') exit 0;;
+ *) exit 1;;
+ esac
) || { rc=1; continue; }
(
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 23/31] abump: verify that we're in git tree
---
abump.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/abump.in b/abump.in
index 81b2705..d846e9a 100755
--- a/abump.in
+++ b/abump.in
@@ -95,6 +95,7 @@ cvelist=
fixes=
[ -n "$APORTSDIR" ] || error "can't locate \$APORTSDIR"
+ git rev-parse 2>/dev/null || die "not in a git tree"
args=`getopt -o s:Rkqh --long security:,recursive,keep,quiet,help -n "$prog" -- "$@"`
if [ $? -ne 0 ]; then
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 24/31] apkgrel: --clean-git enhancements
---
apkgrel.in | 7 +++++ --
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/apkgrel.in b/apkgrel.in
index 57b3b93..28978e3 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -62,7 +62,7 @@ Usage: $prog [-z|--zero] [-a|--add] [-g|--clean-git] [-s|--set NUM] [-t|--test]
Options:
-z, --zero Set pkgrel to 0
-a, --add Add 1 to current pkgrel
- -g, --clean-git Only operate on APKBUILDs with clean git status
+ -g, --clean-git Only operate on APKBUILDs with clean git status (implies --add)
-s, --set NUM Set pkgrel to NUM
-t, --test Only verify that files have a valid pkgrel
-f, --force Operate on files without a valid pkgrel
@@ -86,7 +86,10 @@ while true; do
case $1 in
-z|--zero) setto=0; cmd=do_set;;
-a|--add) cmd=do_add;;
- -g|--clean-git) only_clean_git=1;;
+ -g|--clean-git) # verify that we're in a git tree
+ git rev-parse 2>/dev/null || die "not in a git tree"
+ cmd=do_add
+ only_clean_git=1;;
-s|--set) setto=$2; shift; cmd=do_set;;
-t|--test) cmd=do_nothing;;
-f|--force) force=1;;
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 25/31] apkgrel: show_plain, show_pretty
---
apkgrel.in | 20 ++++++++++++++++++ --
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/apkgrel.in b/apkgrel.in
index 28978e3..645637d 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -16,8 +16,24 @@ fi
. "$datadir/functions.sh"
+ show_plain() {
+ # we source the APKBUILD and show last pkgrel that's read
+ # if this script is invoked with --force, this needn't pass "do_verify"
+ ( . "$1" && echo "$pkgrel" )
+ }
+
+ show_pretty() {
+ (
+ . "$1" || exit 1
+ [ -n "$pkgname" ] || die "$1: no pkgname"
+ printf '%s: r%s\n' "$pkgname" "${pkgrel:-?}"
+ )
+ }
+
do_show() {
- awk -F= '$1 == "pkgrel" { print $2 }' "$@"
+ local f=
+ # show_pretty is more informative, but would change the output format of this script
+ for f; do show_plain "$f"; done
}
do_set() {
@@ -32,7 +48,7 @@ do_add () {
&& [ -n "$(git diff --name-only $f)" ] \
&& continue
[ -d "$f" ] && f="$f/APKBUILD"
- old=$(do_show "$f")
+ old=$(show_plain "$f")
setto=$(($old + 1))
do_set "$f" || return 1
done
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 26/31] apkgrel: tweaks to loops, add quotes
---
apkgrel.in | 6 +++ ---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/apkgrel.in b/apkgrel.in
index 645637d..83c89fd 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -43,9 +43,9 @@ do_set() {
do_add () {
local f= old=
- for f in "$@"; do
+ for f; do
[ -n "$only_clean_git" ] \
- && [ -n "$(git diff --name-only $f)" ] \
+ && [ -n "$(git diff --name-only "$f")" ] \
&& continue
[ -d "$f" ] && f="$f/APKBUILD"
old=$(show_plain "$f")
@@ -57,7 +57,7 @@ do_add () {
do_verify() {
[ -n "$force" ] && return 0
local f= rc=0
- for f in "$@"; do
+ for f; do
[ -d "$f" ] && f="$f/APKBUILD"
if ! grep -q '^pkgrel=[0-9]' "$f"; then
echo "$f: Has no proper pkgrel" >&2
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 27/31] apkgrel: handle missing pkgrel in do_add
---
apkgrel.in | 5 ++++ -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/apkgrel.in b/apkgrel.in
index 83c89fd..7e33e34 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -49,7 +49,10 @@ do_add () {
&& continue
[ -d "$f" ] && f="$f/APKBUILD"
old=$(show_plain "$f")
- setto=$(($old + 1))
+ case $old in
+ [0-9]*) setto=$((old + 1));;
+ *) setto=0;;
+ esac
do_set "$f" || return 1
done
}
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 28/31] various: s/echo/msg/, s/echo/error/, tweak error messages
---
abuild-keygen.in | 2 + -
abuild-sign.in | 6 ++ ----
abump.in | 10 +++++ -----
apkgrel.in | 4 ++ --
checkapk.in | 10 +++++ -----
functions.sh.in | 2 + -
6 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/abuild-keygen.in b/abuild-keygen.in
index bf9d105..dbedad1 100644
--- a/abuild-keygen.in
+++ b/abuild-keygen.in
@@ -32,7 +32,7 @@ get_privkey_file() {
privkey="$abuild_home/$default_name.rsa"
[ -n "$non_interactive" ] && return 0
- echo "Generating public/private rsa key pair for abuild"
+ msg "Generating public/private rsa key pair for abuild"
echo -n "Enter file in which to save the key [$privkey]: "
read line
diff --git a/abuild-sign.in b/abuild-sign.in
index 96a1826..c1a0c77 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -37,10 +37,8 @@ do_sign() {
rm -f "$tmptargz" "$sig"
chmod 644 "$tmpsigned"
mv "$tmpsigned" "$i"
- if [ -z "$quiet" ]; then
- echo "Signed $i"
- fi
- ) || die "Failed to sign $i"
+ msg "Signed $i"
+ ) || die "failed to sign $i"
done
}
diff --git a/abump.in b/abump.in
index d846e9a..203df8e 100755
--- a/abump.in
+++ b/abump.in
@@ -35,11 +35,11 @@ do_bump() {
# verify APKBUILD
(
. "$a" || exit 1
- [ "$pkgname" = "$name" ] || die "$name: APKBUILD has different \$pkgname"
- type package | grep -q function || die "$name: missing package()"
+ [ "$pkgname" = "$name" ] || die "APKBUILD has different \$pkgname for $name"
+ type package | grep -q function || die "missing package() for $name"
case $(apk version --test "$pkgver" "$ver") in
- '=') die "$pkgname: already at version $pkgver";;
- '>') die "$pkgname: already at newer version $pkgver";;
+ '=') die "$pkgname is already at version $pkgver";;
+ '>') die "$pkgname is already at newer version $pkgver";;
'<') exit 0;;
*) exit 1;;
esac
@@ -59,7 +59,7 @@ do_bump() {
fixes #${fixes#\#}
"
fi
- echo "$message"
+ msg "$message"
sed -i -e "s/^pkgver=.*/pkgver=$ver/" \
-e "s/^pkgrel=.*/pkgrel=0/" \
diff --git a/apkgrel.in b/apkgrel.in
index 7e33e34..1d178aa 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -25,7 +25,7 @@ show_plain() {
show_pretty() {
(
. "$1" || exit 1
- [ -n "$pkgname" ] || die "$1: no pkgname"
+ [ -n "$pkgname" ] || die "no \$pkgname for $1"
printf '%s: r%s\n' "$pkgname" "${pkgrel:-?}"
)
}
@@ -63,7 +63,7 @@ do_verify() {
for f; do
[ -d "$f" ] && f="$f/APKBUILD"
if ! grep -q '^pkgrel=[0-9]' "$f"; then
- echo "$f: Has no proper pkgrel" >&2
+ error "no proper \$pkgrel for $f"
rc=1
fi
done
diff --git a/checkapk.in b/checkapk.in
index 2953b8b..d3e2988 100644
--- a/checkapk.in
+++ b/checkapk.in
@@ -36,14 +36,14 @@ if ! [ -f "$abuild_conf" ] && ! [ -f "$abuild_userconf" ]; then
fi
if ! [ -f APKBUILD ]; then
- die 'This must be run in the directory of a built package.'
+ die 'must be run in the directory of a built package'
fi
. ./APKBUILD
startdir="$PWD"
tmpdir=$(mktemp -d -t checkpkg-script.XXXXXX)
- cd "$tmpdir" || die "Failed to create temp dir"
+ cd "$tmpdir" || die "failed to create temp dir"
for i in $pkgname $subpackages; do
_pkgname=${i%:*}
@@ -57,19 +57,19 @@ for i in $pkgname $subpackages; do
break
fi
done
- [ -f "$filepath" ] || die "could not find $pkgfile"
+ [ -f "$filepath" ] || die "can't find $pkgfile"
# generate a temp repositories file with only the http repos
grep ^http: /etc/apk/repositories > $tmpdir/repositories
oldpkg=$(apk fetch --repositories-file $tmpdir/repositories --simulate 2>&1 | sed 's/^Downloading //')
if [ "${oldpkg}" = "${pkg}" ]; then
- die "The built package ($_pkgname) is the one in the repo right now!"
+ die "the built package ($_pkgname) is already in the repo"
fi
apk fetch --repositories-file $tmpdir/repositories --stdout $_pkgname \
| tar -zt | grep -v '^\.SIGN\.' | sort > filelist-$_pkgname-old \
- || die "Failed to download old pkg. Maybe run 'apk update'?"
+ || die "failed to download old pkg, maybe run 'apk update'?"
tar -ztf "$filepath" | grep -v '^\.SIGN\.' | sort > "filelist-$_pkgname"
diff --git a/functions.sh.in b/functions.sh.in
index 96b0586..a25c39a 100644
--- a/functions.sh.in
+++ b/functions.sh.in
@@ -71,7 +71,7 @@ abuild)
}
error() {
- echo "$@" >&2
+ echo "$prog: $@" >&2
}
;;
esac
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 29/31] apkgrel, functions: refactor calculation of APKBUILD's path
---
apkgrel.in | 13 ++++++++++ ---
functions.sh.in | 13 +++++++++++++
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/apkgrel.in b/apkgrel.in
index 1d178aa..94acd55 100644
--- a/apkgrel.in
+++ b/apkgrel.in
@@ -45,9 +45,8 @@ do_add () {
local f= old=
for f; do
[ -n "$only_clean_git" ] \
- && [ -n "$(git diff --name-only "$f")" ] \
+ && [ -n "$(git diff --name-only "${f%/*}")" ] \
&& continue
- [ -d "$f" ] && f="$f/APKBUILD"
old=$(show_plain "$f")
case $old in
[0-9]*) setto=$((old + 1));;
@@ -61,7 +60,6 @@ do_verify() {
[ -n "$force" ] && return 0
local f= rc=0
for f; do
- [ -d "$f" ] && f="$f/APKBUILD"
if ! grep -q '^pkgrel=[0-9]' "$f"; then
error "no proper \$pkgrel for $f"
rc=1
@@ -124,6 +122,15 @@ if [ $# -eq 0 ]; then
exit 2
fi
+ # normalize $@ into paths to APKBUILDs
+ [ "$(echo "$@" | wc -l)" -eq 1 ] || die "can't handle paths with embedded newlines"
+ args=$(for a; do p=$(any_buildscript "$a") || die "can't find APKBUILD for $a"; echo "$p"; done)
+ [ $? -eq 0 ] || exit 1
+ oldifs=$IFS
+ IFS=$'\n'
+ set -- $args
+ IFS=$oldifs
+
do_verify "$@" || exit 1
$cmd "$@"
diff --git a/functions.sh.in b/functions.sh.in
index a25c39a..ab4dff5 100644
--- a/functions.sh.in
+++ b/functions.sh.in
@@ -30,6 +30,19 @@ aports_buildscript() {
fi
}
+ # expects $1 to be a file, or a directory containing an APKBUILD, or a package directory in the aports tree
+ # outputs APKBUILD's path if successful (doesn't verify that it's a valid APKBUILD)
+ any_buildscript() {
+ if [ -f "$1" ]; then
+ echo "$1"
+ elif [ -d "$1" ]; then
+ [ -f "$1/APKBUILD" ] || return 1
+ echo "$1/APKBUILD"
+ else
+ aports_buildscript "$1" || return 1
+ fi
+ }
+
# output functions
case $prog in
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 30/31] various: fancier readconfig, permit env overrides
---
abuild-keygen.in | 14 +++++ ------
abuild-sign.in | 4 + --
checkapk.in | 2 + -
functions.sh.in | 75 +++++++++++++++++++++++++++++++++++++++++++++ -----------
4 files changed, 71 insertions(+), 24 deletions(-)
diff --git a/abuild-keygen.in b/abuild-keygen.in
index dbedad1..c02ad82 100644
--- a/abuild-keygen.in
+++ b/abuild-keygen.in
@@ -30,7 +30,7 @@ get_privkey_file() {
default_name="${emailaddr:-$USER}-$(printf "%x" $(date +%s))"
- privkey="$abuild_home/$default_name.rsa"
+ privkey="$ABUILD_USERDIR/$default_name.rsa"
[ -n "$non_interactive" ] && return 0
msg "Generating public/private rsa key pair for abuild"
echo -n "Enter file in which to save the key [$privkey]: "
@@ -42,7 +42,7 @@ get_privkey_file() {
}
do_keygen() {
- mkdir -p "$abuild_home"
+ mkdir -p "$ABUILD_USERDIR"
get_privkey_file
pubkey="$privkey.pub"
@@ -68,14 +68,14 @@ do_keygen() {
fi
if [ -n "$append_config" ]; then
- if [ -f "$abuild_userconf" ]; then
+ if [ -f "$ABUILD_USERCONF" ]; then
# comment out the existing values
- sed -i -e 's/^PACKAGER_PRIVKEY=/\#&/' "$abuild_userconf"
+ sed -i -e 's/^PACKAGER_PRIVKEY=/\#&/' "$ABUILD_USERCONF"
fi
- echo "PACKAGER_PRIVKEY=\"$privkey\"" >> "$abuild_userconf"
+ echo "PACKAGER_PRIVKEY=\"$privkey\"" >> "$ABUILD_USERCONF"
else
msg ""
- msg "You might want add following line to $abuild_userconf:"
+ msg "You might want add following line to $ABUILD_USERCONF:"
msg ""
msg "PACKAGER_PRIVKEY=\"$privkey\""
msg ""
@@ -92,7 +92,7 @@ usage() {
$prog $abuild_ver - generate signing keys
Usage: $prog [-a|--append] [-i|--install] [-n]
Options:
- -a, --append Set PACKAGER_PRIVKEY=<generated key> in $abuild_userconf
+ -a, --append Set PACKAGER_PRIVKEY=<generated key> in $ABUILD_USERCONF
-i, --install Install public key into /etc/apk/keys using sudo
-n Non-interactive. Use defaults
-q, --quiet
diff --git a/abuild-sign.in b/abuild-sign.in
index c1a0c77..f00c0a1 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -85,9 +85,9 @@ if [ -z "$privkey" ]; then
cat >&2 << __EOF__
No private key found. Use 'abuild-keygen' to generate the keys.
Then you can either:
- * set the PACKAGER_PRIVKEY in $abuild_userconf
+ * set the PACKAGER_PRIVKEY in $ABUILD_USERCONF
('abuild-keygen -a' does this for you)
- * set the PACKAGER_PRIVKEY in $abuild_conf
+ * set the PACKAGER_PRIVKEY in $ABUILD_CONF
* specify the key with the -k option to $prog
__EOF__
diff --git a/checkapk.in b/checkapk.in
index d3e2988..0d31a0c 100644
--- a/checkapk.in
+++ b/checkapk.in
@@ -31,7 +31,7 @@ if [ $# -gt 0 ]; then
exit 2
fi
- if ! [ -f "$abuild_conf" ] && ! [ -f "$abuild_userconf" ]; then
+ if ! [ -f "$ABUILD_CONF" ] && ! [ -f "$ABUILD_USERCONF" ]; then
die "no abuild.conf found"
fi
diff --git a/functions.sh.in b/functions.sh.in
index ab4dff5..0b0bc3b 100644
--- a/functions.sh.in
+++ b/functions.sh.in
@@ -3,20 +3,67 @@
sysconfdir=@sysconfdir@
prog=${0##*/}
-
- abuild_conf=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
- abuild_home=${ABUILD_USERDIR:-"$HOME/.abuild"}
- abuild_userconf=${ABUILD_USERCONF:-"$abuild_home/abuild.conf"}
-
- # read config
- if [ -f "$abuild_conf" ]; then
- . "$abuild_conf" || abuild_conf=
- fi
-
- # read user config if exists
- if [ -f "$abuild_userconf" ]; then
- . "$abuild_userconf" || abuild_userconf=
- fi
+ readconfig() {
+ local _APORTSDIR _BUILDDIR _PKGDEST _SRCPKGDEST _REPODEST _SRCDEST
+ local _CARCH _CHOST _CTARGET _CPPFLAGS _CFLAGS _CXXFLAGS _LDFLAGS
+ local _JOBS _MAKEFLAGS _PACKAGER _USE_COLORS
+ local gitbase=
+ [ -n "${APORTSDIR+x}" ] && _APORTSDIR=$APORTSDIR
+ [ -n "${BUILDDIR+x}" ] && _BUILDDIR=$BUILDDIR
+ [ -n "${PKGDEST+x}" ] && _PKGDEST=$PKGDEST
+ [ -n "${SRCPKGDEST+x}" ] && _SRCPKGDEST=$SRCPKGDEST
+ [ -n "${REPODEST+x}" ] && _REPODEST=$REPODEST
+ [ -n "${SRCDEST+x}" ] && _SRCDEST=$SRCDEST
+ [ -n "${CARCH+x}" ] && _CARCH=$CARCH
+ [ -n "${CHOST+x}" ] && _CHOST=$CHOST
+ [ -n "${CTARGET+x}" ] && _CTARGET=$CTARGET
+ [ -n "${CPPFLAGS+x}" ] && _CPPFLAGS=$CPPFLAGS
+ [ -n "${CFLAGS+x}" ] && _CFLAGS=$CFLAGS
+ [ -n "${CXXFLAGS+x}" ] && _CXXFLAGS=$CXXFLAGS
+ [ -n "${LDFLAGS+x}" ] && _LDFLAGS=$LDFLAGS
+ [ -n "${JOBS+x}" ] && _JOBS=$JOBS
+ [ -n "${MAKEFLAGS+x}" ] && _MAKEFLAGS=$MAKEFLAGS
+ [ -n "${PACKAGER+x}" ] && _PACKAGER=$PACKAGER
+ [ -n "${USE_COLORS+x}" ] && _USE_COLORS="$USE_COLORS"
+ : ${ABUILD_CONF:=$sysconfdir/abuild.conf}
+ : ${ABUILD_USERDIR:=$HOME/.abuild}
+ : ${ABUILD_USERCONF:=$ABUILD_USERDIR/abuild.conf}
+ [ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF"
+ [ -f "$ABUILD_USERCONF" ] && . "$ABUILD_USERCONF"
+ APORTSDIR=${_APORTSDIR-$APORTSDIR}
+ gitbase=$(git rev-parse --show-toplevel 2>/dev/null) # already is -P
+ if [ -d "$APORTSDIR" ]; then
+ APORTSDIR=$(cd "$APORTSDIR"; pwd -P)
+ elif [ -z "$APORTSDIR" ] && [ -d "$HOME/aports" ]; then
+ APORTSDIR=$(cd "$HOME/aports"; pwd -P)
+ else
+ if [ -n "$gitbase" ]; then
+ case $(git config remote.origin.url) in
+ */aports) APORTSDIR=$gitbase ;;
+ *) APORTSDIR= ;;
+ esac
+ else
+ APORTSDIR=
+ fi
+ fi
+ BUILDDIR=${_BUILDDIR-$BUILDDIR}
+ PKGDEST=${_PKGDEST-$PKGDEST}
+ SRCPKGDEST=${_SRCPKGDEST-$SRCPKGDEST}
+ REPODEST=${_REPODEST-$REPODEST}
+ SRCDEST=${_SRCDEST-$SRCDEST}
+ CARCH=${_CARCH-$CARCH}
+ CHOST=${_CHOST-$CHOST}
+ CTARGET=${_CTARGET-$CTARGET}
+ CPPFLAGS=${_CPPFLAGS-$CPPFLAGS}
+ CFLAGS=${_CFLAGS-$CFLAGS}
+ CXXFLAGS=${_CXXFLAGS-$CXXFLAGS}
+ LDFLAGS=${_LDFLAGS-$LDFLAGS}
+ JOBS=${_JOBS-$JOBS}
+ MAKEFLAGS=${_MAKEFLAGS-$MAKEFLAGS}
+ PACKAGER=${_PACKAGER-$PACKAGER}
+ USE_COLORS=${_USE_COLORS-$USE_COLORS}
+ }
+ readconfig
# expects $1 to be a package directory in the aports tree ('foo' or 'main/foo')
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
[alpine-devel] [PATCH 31/31] functions: also honor .abuild file at gitbase
This permits introducing branch-specific modifications to abuild.conf settings.
Any settings there override /etc/abuild.conf and $HOME/.abuild/abuild.conf.
---
functions.sh.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/functions.sh.in b/functions.sh.in
index 0b0bc3b..395e407 100644
--- a/functions.sh.in
+++ b/functions.sh.in
@@ -46,6 +46,8 @@ readconfig() {
APORTSDIR=
fi
fi
+ # source any .abuild file at the aports root, but only if we are currently in aports tree
+ [ -n "$APORTSDIR" ] && [ -f "$APORTSDIR/.abuild" ] && [ "$APORTSDIR" = "$gitbase" ] && . "$APORTSDIR/.abuild"
BUILDDIR=${_BUILDDIR-$BUILDDIR}
PKGDEST=${_PKGDEST-$PKGDEST}
SRCPKGDEST=${_SRCPKGDEST-$SRCPKGDEST}
--
1.8.3.1
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
Re: [alpine-devel] [PATCH 05/31] abuild-keygen: refactor
Thanks a bunch for those patches.
I have applied 1-4 so far.
On Fri, 5 Jul 2013 00:21:14 -0400
Dubiousjim <dubiousjim@gmail.com > wrote:
> ---
> abuild-keygen.in | 119 ++++++++++++++++++++++++++++---------------------------
> 1 file changed, 61 insertions(+), 58 deletions(-)
Could you please give some explanation why we refactor? Possibly a new
patch with the explanation in commit message. You can also just say it
here and I'll git commit --amend it.
(same with [PATCH 06/31] abuild-sign: refactor)
Thanks!
-nc
>
> diff --git a/abuild-keygen.in b/abuild-keygen.in
> index a095068..3cf5531 100644
> --- a/abuild-keygen.in
> +++ b/abuild-keygen.in
> @@ -22,6 +22,20 @@ msg() {
> # ask for privkey unless non-interactive mode
> # returns value in global $privkey
> get_privkey_file() {
> + emailaddr=${PACKAGER##*<}
> + emailaddr=${emailaddr%%>*}
> +
> + # if PACKAGER does not contain a valid email address, then ask git
> + if [ -z "$emailaddr" ] || [ "${emailaddr##*@}" = "$emailaddr" ]; then
> + emailaddr=$(git config --get user.email 2>/dev/null)
> + fi
> +
> + if [ -n "$emailaddr" ]; then
> + default_name="$emailaddr-$(printf "%x" $(date +%s))"
> + else
> + default_name="$USER-$(printf "%x" $(date +%s))"
> + fi
> +
> privkey="$abuild_home/$default_name.rsa"
> [ "$non_interactive" = "yes" ] && return 0
> echo "Generating public/private rsa key pair for abuild"
> @@ -33,6 +47,52 @@ get_privkey_file() {
> fi
> }
>
> +do_keygen() {
> + mkdir -p "$abuild_home"
> +
> + get_privkey_file
> + pubkey="$privkey.pub"
> +
> + # generate the private key in a subshell with stricter umask
> + (
> + umask 0007
> + openssl genrsa -out "$privkey" 2048
> + )
> + openssl rsa -in "$privkey" -pubout -out "$pubkey"
> +
> +
> + if [ -n "$install_pubkey" ]; then
> + msg "Installing $pubkey to /etc/apk/keys..."
> + sudo mkdir -p /etc/apk/keys
> + sudo cp -i "$pubkey" /etc/apk/keys/
> + else
> +
> + msg ""
> + msg "You'll need to install $pubkey into "
> + msg "/etc/apk/keys to be able to install packages and repositories signed with"
> + msg "$privkey"
> + fi
> +
> + if [ -n "$append_config" ]; then
> + if [ -f "$abuild_userconf" ]; then
> + # comment out the existing values
> + sed -i -e 's/^\(PACKAGER_PRIVKEY=.*\)/\#\1/' "$abuild_userconf"
> + fi
> + echo "PACKAGER_PRIVKEY=\"$privkey\"" >> "$abuild_userconf"
> + else
> + msg ""
> + msg "You might want add following line to $abuild_userconf:"
> + msg ""
> + msg "PACKAGER_PRIVKEY=\"$privkey\""
> + msg ""
> + fi
> +
> + msg ""
> + msg "Please remember to make a safe backup of your private key:"
> + msg "$privkey"
> + msg ""
> +}
> +
> # print usage and exit
> usage() {
> echo "abuild-keygen $abuild_ver"
> @@ -53,20 +113,6 @@ usage() {
> # read user config if exists
> [ -f "$abuild_userconf" ] && . "$abuild_userconf"
>
> -emailaddr=${PACKAGER##*<}
> -emailaddr=${emailaddr%%>*}
> -
> -# if PACKAGER does not contain a valid email address, then ask git
> -if [ -z "$emailaddr" ] || [ "${emailaddr##*@}" = "$emailaddr" ]; then
> - emailaddr=$(git config --get user.email 2>/dev/null)
> -fi
> -
> -if [ -n "$emailaddr" ]; then
> - default_name="$emailaddr-$(printf "%x" $(date +%s))"
> -else
> - default_name="$USER-$(printf "%x" $(date +%s))"
> -fi
> -
> while getopts "ahinq" opt; do
> case $opt in
> a) append_config=yes;;
> @@ -78,47 +124,4 @@ while getopts "ahinq" opt; do
> done
> shift $(( $OPTIND - 1))
>
> -mkdir -p "$abuild_home"
> -
> -get_privkey_file
> -pubkey="$privkey.pub"
> -
> -# generate the private key in a subshell with stricter umask
> -(
> -umask 0007
> -openssl genrsa -out "$privkey" 2048
> -)
> -openssl rsa -in "$privkey" -pubout -out "$pubkey"
> -
> -
> -if [ -n "$install_pubkey" ]; then
> - msg "Installing $pubkey to /etc/apk/keys..."
> - sudo mkdir -p /etc/apk/keys
> - sudo cp -i "$pubkey" /etc/apk/keys/
> -else
> -
> - msg ""
> - msg "You'll need to install $pubkey into "
> - msg "/etc/apk/keys to be able to install packages and repositories signed with"
> - msg "$privkey"
> -fi
> -
> -if [ -n "$append_config" ]; then
> - if [ -f "$abuild_userconf" ]; then
> - # comment out the existing values
> - sed -i -e 's/^\(PACKAGER_PRIVKEY=.*\)/\#\1/' "$abuild_userconf"
> - fi
> - echo "PACKAGER_PRIVKEY=\"$privkey\"" >> "$abuild_userconf"
> -else
> - msg ""
> - msg "You might want add following line to $abuild_userconf:"
> - msg ""
> - msg "PACKAGER_PRIVKEY=\"$privkey\""
> - msg ""
> -fi
> -
> -msg ""
> -msg "Please remember to make a safe backup of your private key:"
> -msg "$privkey"
> -msg ""
> -
> +do_keygen
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---
On Fri, 5 Jul 2013 00:21:09 -0400
Dubiousjim <dubiousjim@gmail.com > wrote:
> Sorry for so many patches. I tried hard to rebase them into natural-sized
> chunks for reviewing. I'll rebase them further if you like. But I thought it
> was time to hand them over to other eyes.
>
> These hardly touch abuild itself, nor newapkbuild, buildrepo, or buildlab. I've
> got some notes for the first two of these, that I'll come back to another day.
>
> Most of the changes here are internal.
>
> The main externally-visible changes are: long options, some tweaked error messages,
> permitting environment variable overrides to settings from abuild.conf files, and
> hopefully some more robust behavior in places.
I pushed them all a fixed a few issues they introduced. I reverted one
abump change in the behaviour. I'd like it to not exit with error if
version is same because I sometimes re-run abump after fixing up issues
in apkbuild (as it git commits for me too with proper commit message)
Also tagged a new release.
Thanks!
>
>
> Dubiousjim (31):
> remove unused files
> abuild-sudo, abuild-tar: cosmetic changes
> various: add descriptions, attribution, license
> various: tweak opening comments, whitespace
> abuild-keygen: refactor
> abuild-sign: refactor
> various: move conf-loading and i/o to functions
> Makefile: add missing files to dist
> Makefile: remove dist
> various: use long options, rework usages
> abuild_keygen: several tweaks
> abuild-sign: reformat error output
> abuild-sign: make vars local
> abuild-sign: wrap cd in a subshell, use set -e
> abuild-sign: fix a race condition
> abump: move loop inside do_bump, refine locals
> abump: introduce subshell, rc
> abump: make abuild also clean
> abump: tweak upgrade/cvelist
> abump, functions: refactor (and verify) calculation of APKBUILD path
> abump: refactor verification of APKBUILD
> abump: verify APKBUILD's version
> abump: verify that we're in git tree
> apkgrel: --clean-git enhancements
> apkgrel: show_plain, show_pretty
> apkgrel: tweaks to loops, add quotes
> apkgrel: handle missing pkgrel in do_add
> various: s/echo/msg/, s/echo/error/, tweak error messages
> apkgrel, functions: refactor calculation of APKBUILD's path
> various: fancier readconfig, permit env overrides
> functions: also honor .abuild file at gitbase
>
> APKBUILD-svn.proto | 46 --------
> Makefile | 14 +--
> abuild-keygen.in | 190 +++++++++++++++++----------------
> abuild-sign.in | 132 ++++++++++++-----------
> abuild-sudo.c | 13 ++-
> abuild-tar.c | 2 +-
> abuild.in | 4 +-
> abump.in | 155 +++++++++++++++++----------
> alpine.mk | 302 -----------------------------------------------------
> alpine.packages | 124 ----------------------
> apkgrel.in | 126 +++++++++++++++-------
> checkapk.in | 52 +++++----
> functions.sh | 34 ------
> functions.sh.in | 150 ++++++++++++++++++++++++++
> mkinitram | 88 ----------------
> mkmodloop | 37 -------
> newapkbuild.in | 60 +++++------
> 17 files changed, 585 insertions(+), 944 deletions(-)
> delete mode 100644 APKBUILD-svn.proto
> delete mode 100755 alpine.mk
> delete mode 100644 alpine.packages
> delete mode 100644 functions.sh
> create mode 100644 functions.sh.in
> delete mode 100644 mkinitram
> delete mode 100644 mkmodloop
>
---
Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org
Help: alpine-devel+help@lists.alpinelinux.org
---