diff options
author | Leonardo Arena <rnalrd@gmail.com> | 2010-02-24 17:52:21 +0000 |
---|---|---|
committer | Leonardo Arena <rnalrd@gmail.com> | 2010-02-24 17:52:21 +0000 |
commit | ee87d061b9f23cfdd00924aaeb1f7fbfe3424894 (patch) | |
tree | 3d41d33387e3bac301a838c7ce465796b9adc985 | |
parent | ad7a50db8fa7fd32df9ee207d3e36717c9ba9089 (diff) | |
parent | b5bd5079913b8c1e06ec502bd0f61239966e2f39 (diff) | |
download | aports-ee87d061b9f23cfdd00924aaeb1f7fbfe3424894.tar.bz2 aports-ee87d061b9f23cfdd00924aaeb1f7fbfe3424894.tar.xz |
Merge branch 'master' of git://dev.alpinelinux.org/aports
-rw-r--r-- | main/debootstrap/APKBUILD | 45 | ||||
-rw-r--r-- | main/debootstrap/pkgdetails.c | 209 | ||||
-rw-r--r-- | main/dpkg/APKBUILD | 60 | ||||
-rw-r--r-- | main/util-vserver/APKBUILD | 4 | ||||
-rw-r--r-- | main/util-vserver/setup-vs-guest | 2 |
5 files changed, 317 insertions, 3 deletions
diff --git a/main/debootstrap/APKBUILD b/main/debootstrap/APKBUILD new file mode 100644 index 0000000000..9bd4502ce2 --- /dev/null +++ b/main/debootstrap/APKBUILD @@ -0,0 +1,45 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=debootstrap +pkgver=1.0.22 +pkgrel=0 +pkgdesc="Debian/Ubuntu bootstrap scripts" +url="http://packages.qa.debian.org/d/debootstrap.html" +license="GPL-2" +depends="dpkg" +source="http://ftp.de.debian.org/debian/pool/main/d/debootstrap/debootstrap_$pkgver.tar.gz + pkgdetails.c" + +_builddir="$srcdir"/$pkgname-$pkgver +build() { + cd "$_builddir" + gcc $CFLAGS $LDFLAGS -o pkgdetails "$srcdir"/pkgdetails.c +} + +package() { + cd "$_builddir" + # create devices.tar.gz + rm -rf dev + mkdir -p dev + chown 0:0 dev + chmod 755 dev + ( cd dev + ln -s /proc/self/fd fd + ln -s fd/0 stdin + ln -s fd/1 stdout + ln -s fd/2 stderr + mknod full c 1 7 + mknod null c 1 3 + mknod ptmx c 5 2 + mkdir pts shm + mknod random c 1 8 + mknod tty c 5 0 + mknod urandom c 1 9 + mknod zero c 1 5 + ) + tar -czf devices.tar.gz dev + rm -rf dev + make DESTDIR="$pkgdir" install || return + install -Dm755 pkgdetails "$pkgdir"/usr/lib/debootstrap/pkgdetails +} +md5sums="d3fbb612b381841a616a804c946a344a debootstrap_1.0.22.tar.gz +cff11c88c5176c0ccb714e2d378f4d35 pkgdetails.c" diff --git a/main/debootstrap/pkgdetails.c b/main/debootstrap/pkgdetails.c new file mode 100644 index 0000000000..8403afb4c8 --- /dev/null +++ b/main/debootstrap/pkgdetails.c @@ -0,0 +1,209 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#define MAX_LINE 1000 +#define MAX_PKGS 100 + +static char *fieldcpy(char *dst, char *fld) { + while (*fld && *fld != ':') + fld++; + if (!*(fld++)) + return NULL; + while (isspace(*fld)) fld++; + return strcpy(dst, fld); +} + +static void dogetdeps(char *pkgsfile, char **in_pkgs, int pkgc) { + char buf[MAX_LINE]; + char cur_pkg[MAX_LINE]; + char cur_deps[MAX_LINE]; + char *pkgs[MAX_PKGS]; + int i; + int skip; + FILE *f; + + cur_pkg[0] = cur_deps[0] = '\0'; + + for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i]; + + f = fopen(pkgsfile, "r"); + if (f == NULL) { + perror(pkgsfile); + exit(1); + } + + skip = 1; + while (fgets(buf, sizeof(buf), f)) { + if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; + if (strncasecmp(buf, "Package:", 8) == 0) { + skip = 1; + fieldcpy(cur_pkg, buf); + int any = 0; + for (i = 0; i < pkgc; i++) { + if (!pkgs[i]) continue; + any = 1; + if (strcmp(cur_pkg, pkgs[i]) == 0) { + skip = 0; + pkgs[i] = NULL; + break; + } + } + if (!any) break; + } else if (!skip && + (strncasecmp(buf, "Depends:", 8) == 0 || + strncasecmp(buf, "Pre-Depends:", 12) == 0)) + { + char *pch; + fieldcpy(cur_deps, buf); + pch = cur_deps; + while (1) { + while (isspace(*pch)) pch++; + if (!*pch) break; + + while (*pch && *pch != '(' && *pch != '|' && *pch != ',' + && !isspace(*pch)) + { + fputc(*pch++, stdout); + } + fputc('\n', stdout); + while (*pch && *pch++ != ',') (void)NULL; + } + } + } + fclose(f); +} + +static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile, + char *fieldname, char **in_pkgs, int pkgc) +{ + char buf[MAX_LINE]; + char cur_field[MAX_LINE]; + char cur_pkg[MAX_LINE]; + char cur_ver[MAX_LINE]; + char cur_arch[MAX_LINE]; + char cur_size[MAX_LINE]; + char cur_md5[MAX_LINE]; + char cur_filename[MAX_LINE]; + char *pkgs[MAX_PKGS]; + int i; + FILE *f; + + cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_filename[0] = '\0'; + + for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i]; + + f = fopen(pkgsfile, "r"); + if (f == NULL) { + perror(pkgsfile); + exit(1); + } + while (fgets(buf, sizeof(buf), f)) { + if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; + if (strncasecmp(buf, fieldname, strlen(fieldname)) == 0) { + fieldcpy(cur_field, buf); + } + if (strncasecmp(buf, "Package:", 8) == 0) { + fieldcpy(cur_pkg, buf); + } else if (strncasecmp(buf, "Version:", 8) == 0) { + fieldcpy(cur_ver, buf); + } else if (strncasecmp(buf, "Architecture:", 13) == 0) { + fieldcpy(cur_arch, buf); + } else if (strncasecmp(buf, "Size:", 5) == 0) { + fieldcpy(cur_size, buf); + } else if (strncasecmp(buf, "MD5sum:", 7) == 0) { + fieldcpy(cur_md5, buf); + } else if (strncasecmp(buf, "Filename:", 9) == 0) { + fieldcpy(cur_filename, buf); + } else if (!*buf) { + int any = 0; + for (i = 0; i < pkgc; i++) { + if (!pkgs[i]) continue; + any = 1; + if (strcmp(cur_field, pkgs[i]) == 0) { + printf("%s %s %s %s %s %s %s\n", cur_pkg, cur_ver, cur_arch, mirror, cur_filename, cur_md5, cur_size); + if (uniq) pkgs[i] = NULL; + break; + } + } + if (!any) break; + } + } + fclose(f); + + /* any that weren't found are returned as "pkg -" */ + if (uniq) { + for (i = 0; i < pkgc; i++) { + if (pkgs[i]) { + printf("%s -\n", pkgs[i]); + } + } + } +} + +static int dotranslatewgetpercent(int low, int high, int end, char *str) { + int ch; + int val, lastval; + + /* print out anything that looks like a % on its own line, appropriately + * scaled */ + + lastval = val = 0; + while ( (ch = getchar()) != EOF ) { + if (isdigit(ch)) { + val *= 10; val += ch - '0'; + } else if (ch == '%') { + float f = (float) val / 100.0 * (high - low) + low; + if (str) { + printf("P: %d %d %s\n", (int) f, end, str); + } else { + printf("P: %d %d\n", (int) f, end); + } + lastval = val; + } else { + val = 0; + } + } + return lastval == 100; +} + +int main(int argc, char *argv[]) { + if ((argc == 6 || argc == 5) && strcmp(argv[1], "WGET%") == 0) { + if (dotranslatewgetpercent(atoi(argv[2]), atoi(argv[3]), + atoi(argv[4]), argc == 6 ? argv[5] : NULL)) + { + exit(0); + } else { + exit(1); + } + } else if (argc >= 4 && strcmp(argv[1], "GETDEPS") == 0) { + int i; + for (i = 3; argc - i > MAX_PKGS; i += MAX_PKGS) { + dogetdeps(argv[2], argv+i, MAX_PKGS); + } + dogetdeps(argv[2], argv+i, argc-i); + exit(0); + } else if (argc >= 5 && strcmp(argv[1], "PKGS") == 0) { + int i; + for (i = 4; argc - i > MAX_PKGS; i += MAX_PKGS) { + dopkgmirrorpkgs(1, argv[2], argv[3], "Package:", argv+i, MAX_PKGS); + } + dopkgmirrorpkgs(1, argv[2], argv[3], "Package:", argv+i, argc-i); + exit(0); + } else if (argc >= 6 && strcmp(argv[1], "FIELD") == 0) { + int i; + for (i = 5; argc - i > MAX_PKGS; i += MAX_PKGS) { + dopkgmirrorpkgs(0, argv[3], argv[4], argv[2], argv+i, MAX_PKGS); + } + dopkgmirrorpkgs(0, argv[3], argv[4], argv[2], argv+i, argc-i); + exit(0); + } else { + fprintf(stderr, "usage: %s PKGS mirror packagesfile pkgs..\n", argv[0]); + fprintf(stderr, " or: %s FIELD field mirror packagesfile pkgs..\n", + argv[0]); + fprintf(stderr, " or: %s GETDEPS packagesfile pkgs..\n", argv[0]); + fprintf(stderr, " or: %s WGET%% low high end reason\n", argv[0]); + exit(1); + } +} diff --git a/main/dpkg/APKBUILD b/main/dpkg/APKBUILD new file mode 100644 index 0000000000..5710f9c5ad --- /dev/null +++ b/main/dpkg/APKBUILD @@ -0,0 +1,60 @@ +# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +pkgname=dpkg +pkgver=1.15.5.6 +pkgrel=0 +pkgdesc="The Debian Package Manager" +url="http://packages.debian.org/dpkg" +license="GPL" +makedepends="bzip2-dev zlib-dev perl" +subpackages="$pkgname-doc $pkgname-dev" +source="http://ftp.de.debian.org/debian/pool/main/d/$pkgname/${pkgname}_$pkgver.tar.bz2" + +_builddir="$srcdir"/$pkgname-$pkgver +prepare() { + cd "$_builddir" + sed -i "s|<ncursesw/curses.h>|<curses.h>|g" dselect/dselect.h \ + dselect/Makefile.in || return 1 + sed -i "s|<ncursesw/term.h>|<term.h>|g" dselect/main.cc || return 1 +} + +build() { + cd "$_builddir" + ./configure --prefix=/usr \ + --with-zlib \ + --without-dselect \ + --without-start-stop-daemon \ + || return 1 + make || return 1 +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir" install || return 1 +} + +dev() { + pkgdesc="Debian package development tools" + depends="perl" + mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/share \ + "$subpkgdir"/usr/lib/dpkg + + mv "$pkgdir"/usr/bin/dpkg-architecture \ + "$pkgdir"/usr/bin/dpkg-buildpackage \ + "$pkgdir"/usr/bin/dpkg-checkbuilddeps \ + "$pkgdir"/usr/bin/dpkg-distaddfile \ + "$pkgdir"/usr/bin/dpkg-genchanges \ + "$pkgdir"/usr/bin/dpkg-gencontrol \ + "$pkgdir"/usr/bin/dpkg-gensymbols \ + "$pkgdir"/usr/bin/dpkg-name \ + "$pkgdir"/usr/bin/dpkg-parsechangelog \ + "$pkgdir"/usr/bin/dpkg-scanpackages \ + "$pkgdir"/usr/bin/dpkg-scansources \ + "$pkgdir"/usr/bin/dpkg-shlibdeps \ + "$pkgdir"/usr/bin/dpkg-source \ + "$pkgdir"/usr/bin/dpkg-vendor \ + "$subpkgdir"/usr/bin/ + mv "$pkgdir"/usr/share/perl* "$subpkgdir"/usr/share/ + mv "$pkgdir"/usr/lib/dpkg/parsechangelog "$subpkgdir"/usr/lib/dpkg/ +} + +md5sums="4dcb0de9af234d16a62272bcc61b8873 dpkg_1.15.5.6.tar.bz2" diff --git a/main/util-vserver/APKBUILD b/main/util-vserver/APKBUILD index 24d8150ae8..901d375d86 100644 --- a/main/util-vserver/APKBUILD +++ b/main/util-vserver/APKBUILD @@ -2,7 +2,7 @@ pkgname=util-vserver pkgver=0.30.216_pre2864 _realver=0.30.216-pre2864 -pkgrel=5 +pkgrel=6 pkgdesc="Linux-VServer admin utilities" url="http://www.nongnu.org/util-vserver/" license="GPL" @@ -64,4 +64,4 @@ ff8f561f672524eb46fe633f584ef60e ensc_pathprog.patch da8b70c4fd40e68894b3903ffd121397 validate.patch 04000261fd990a3963b0e98260b481bd alpine.patch 49bca7969cc284adf68e0ef284c0660e setup-vs-template -838511f74983453ef9827ed875b70d59 setup-vs-guest" +1f183cba111f973a9981a35335a55e2e setup-vs-guest" diff --git a/main/util-vserver/setup-vs-guest b/main/util-vserver/setup-vs-guest index dffd3c8804..2985af96f5 100644 --- a/main/util-vserver/setup-vs-guest +++ b/main/util-vserver/setup-vs-guest @@ -221,7 +221,7 @@ ask_ifaceopts() { _context=$((10000 + $_last_digit)) fi done - resp="$ifacesopts" + resp="$ifaceopts" } ask_context() { |