From eae4f2582e21a1c6b266e78592fdc52d14caf0a8 Mon Sep 17 00:00:00 2001 From: Frans Pop Date: Tue, 13 Nov 2007 11:36:44 +0000 Subject: Make debootstrap-udeb 'Architecture: all' For this to be possible, the utility pkgdetails is moved from debootstrap to base-installer r50114 --- Makefile | 18 +---- debian/changelog | 6 +- debian/control | 4 +- debian/rules | 29 +++----- pkgdetails.c | 209 ------------------------------------------------------- 5 files changed, 18 insertions(+), 248 deletions(-) delete mode 100644 pkgdetails.c diff --git a/Makefile b/Makefile index 69f790a..f6c2856 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,3 @@ -CC=gcc -CFLAGS=-Wall -W -O2 - # avoid dpkg-dev dependency; fish out the version with sed VERSION := $(shell sed 's/.*(\(.*\)).*/\1/; q' debian/changelog) @@ -8,10 +5,9 @@ ARCH := $(shell dpkg --print-architecture) MAKEDEV := $(shell if [ -e /dev/MAKEDEV ]; then echo /dev/MAKEDEV; else echo /sbin/MAKEDEV; fi) -all: pkgdetails devices.tar.gz debootstrap-arch +all: devices.tar.gz clean: - rm -f pkgdetails pkgdetails.o devices.tar.gz - rm -f debootstrap-arch + rm -f devices.tar.gz rm -rf dev DSDIR=$(DESTDIR)/usr/lib/debootstrap @@ -36,16 +32,6 @@ install: install -o root -g root -m 0644 devices.tar.gz $(DSDIR)/ -install-udeb: install - install -o root -g root -m 0755 pkgdetails $(DSDIR)/ - install -o root -g root -m 0644 debootstrap-arch $(DSDIR)/arch - -pkgdetails: pkgdetails.o - $(CC) -o $@ $^ - -debootstrap-arch: - echo $(ARCH) >debootstrap-arch - devices.tar.gz: rm -rf dev mkdir -p dev diff --git a/debian/changelog b/debian/changelog index c69aa97..e457fff 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,11 @@ debootstrap (1.0.7) UNRELEASED; urgency=low * No longer include full devices tarball in udeb. - Requires base-installer 1.85. + * Utility pkgdetails moved from debootstrap-udeb to bootstrap-base so that + the udeb can become 'Architecture: all'. + * Changes in udeb require base-installer 1.85. - -- Frans Pop Fri, 09 Nov 2007 21:21:11 +0100 + -- Frans Pop Tue, 13 Nov 2007 02:14:55 +0100 debootstrap (1.0.6) unstable; urgency=low diff --git a/debian/control b/debian/control index 8622c1d..aef1b07 100644 --- a/debian/control +++ b/debian/control @@ -20,6 +20,6 @@ Package: debootstrap-udeb Priority: required Section: debian-installer XC-Package-Type: udeb -Architecture: any -Depends: ${shlibs:Depends}, mounted-partitions +Architecture: all +Depends: mounted-partitions Description: Bootstrap the Debian system diff --git a/debian/rules b/debian/rules index 99383a7..abc8232 100755 --- a/debian/rules +++ b/debian/rules @@ -31,7 +31,7 @@ install: real-build # install the package into debian/debootstrap $(MAKE) install DESTDIR=$(CURDIR)/debian/debootstrap - $(MAKE) install-udeb DESTDIR=$(CURDIR)/debian/debootstrap-udeb + $(MAKE) install DESTDIR=$(CURDIR)/debian/debootstrap-udeb binary-indep: install # We have nothing to do by default. @@ -64,17 +64,6 @@ binary-indep: install dh_installman -i debootstrap.8 dh_installchangelogs -i dh_link -i - dh_compress -i - dh_fixperms -i - dh_installdeb -i - dh_shlibdeps -i - dh_gencontrol -i - dh_md5sums -i - dh_builddeb -i - -binary-arch: install - dh_testdir - dh_testroot -rm -rf debian/debootstrap-udeb/usr/share \ debian/debootstrap-udeb/usr/lib/debootstrap/scripts/potato \ debian/debootstrap-udeb/usr/lib/debootstrap/scripts/woody \ @@ -87,13 +76,15 @@ binary-arch: install debian/debootstrap-udeb/usr/lib/debootstrap/scripts/feisty \ debian/debootstrap-udeb/usr/lib/debootstrap/scripts/*.buildd \ debian/debootstrap-udeb/usr/lib/debootstrap/scripts/*.fakechroot - dh_strip -s - dh_compress -s - dh_fixperms -s - dh_installdeb -s - dh_shlibdeps -s - dh_gencontrol -s - dh_builddeb -s + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_shlibdeps -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i + +binary-arch: binary: binary-indep binary-arch .PHONY: build real-build clean binary-indep binary-arch binary install configure binary-basedebs diff --git a/pkgdetails.c b/pkgdetails.c deleted file mode 100644 index be4f7c8..0000000 --- a/pkgdetails.c +++ /dev/null @@ -1,209 +0,0 @@ -#include -#include -#include -#include - -#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) { - int any = 0; - skip = 1; - fieldcpy(cur_pkg, buf); - 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); - } -} -- cgit v0.12