Commit c9a3a8dd authored by blogic's avatar blogic

branch Attitude Adjustment packages



git-svn-id: svn://svn.openwrt.org/openwrt/branches/packages_12.09@33626 3c298f89-4303-0410-b956-a3cf2f4a3e73
parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

*.orig
*.rej
#
# Copyright (C) 2010 Gianluigi Tiesi <sherpya@netfarm.it>
# Copyright (C) 2011-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=debootstrap
PKG_VERSION:=1.0.42
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-udeb_$(PKG_VERSION)_all.udeb
PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/d/debootstrap
PKG_MD5SUM:=749638b8afc0c3e2a06c9b31cfe40b55
UNPACK_CMD=ar -p "$(DL_DIR)/$(PKG_SOURCE)" data.tar.xz | xzcat | tar -C $(1) -xf -
include $(INCLUDE_DIR)/package.mk
define Package/debootstrap
SECTION:=admin
CATEGORY:=Administration
TITLE:=Bootstrap a basic Debian system
URL:=http://wiki.debian.org/Debootstrap
DEPENDS:=+coreutils-chroot +coreutils-sha1sum
MAINTAINER:=Luka Perkov <openwrt@lukaperkov.net>
endef
define Package/debootstrap/description
debootstrap is used to create a Debian base system from scratch, without
requiring the availability of dpkg or apt. It does this by downloading .deb
files from a mirror site, and carefully unpacking them into a directory which
can eventually be chrooted into.
endef
define Build/Compile
# file pkgdetails.c was imported from debian package base-installer version 1.123
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) ./files/pkgdetails.c -o $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails
endef
define Package/debootstrap/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/sbin/$(PKG_NAME) $(1)/usr/sbin
$(INSTALL_DIR) $(1)/usr/share/debootstrap
$(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails $(1)/usr/share/debootstrap
$(INSTALL_DATA) $(PKG_BUILD_DIR)/usr/share/debootstrap/functions $(1)/usr/share/debootstrap
$(INSTALL_DIR) $(1)/usr/share/debootstrap/scripts
$(INSTALL_DATA) $(PKG_BUILD_DIR)/usr/share/debootstrap/scripts/* $(1)/usr/share/debootstrap/scripts
endef
$(eval $(call BuildPackage,debootstrap))
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdarg.h>
#include <errno.h>
#define MAX_LINE 1000
#define MAX_PKGS 100
char *checksum_field=NULL;
static void oom_die(void)
{
fputs("Out of memory!\n", stderr);
exit(1);
}
static char *xvasprintf(const char *fmt, va_list ap) {
char *ret;
if (vasprintf (&ret, fmt, ap) < 0) {
if (errno == ENOMEM)
oom_die();
return NULL;
}
return ret;
}
static char *xasprintf(const char *fmt, ...) {
va_list ap;
char *ret;
va_start(ap, fmt);
ret = xvasprintf(fmt, ap);
va_end(ap);
return ret;
}
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 outputdeps(char *deps) {
char *pch = 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;
}
}
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 cur_predeps[MAX_LINE];
char prev_pkg[MAX_LINE];
char *pkgs[MAX_PKGS];
int i;
int skip;
FILE *f;
int output_pkg = -1;
cur_pkg[0] = cur_deps[0] = cur_predeps[0] = prev_pkg[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);
if (strcmp(cur_pkg, prev_pkg) != 0) {
if (output_pkg != -1)
pkgs[output_pkg] = NULL;
if (cur_deps[0])
outputdeps(cur_deps);
if (cur_predeps[0])
outputdeps(cur_predeps);
strcpy(prev_pkg, cur_pkg);
}
cur_deps[0] = cur_predeps[0] = '\0';
output_pkg = -1;
for (i = 0; i < pkgc; i++) {
if (!pkgs[i]) continue;
any = 1;
if (strcmp(cur_pkg, pkgs[i]) == 0) {
skip = 0;
output_pkg = i;
break;
}
}
if (!any) break;
} else if (!skip && strncasecmp(buf, "Depends:", 8) == 0)
fieldcpy(cur_deps, buf);
else if (!skip && strncasecmp(buf, "Pre-Depends:", 12) == 0)
fieldcpy(cur_predeps, buf);
}
if (cur_deps[0])
outputdeps(cur_deps);
if (cur_predeps[0])
outputdeps(cur_predeps);
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_checksum[MAX_LINE];
char cur_filename[MAX_LINE];
char prev_pkg[MAX_LINE];
char *pkgs[MAX_PKGS];
int i;
FILE *f;
char *output = NULL;
int output_pkg = -1;
cur_field[0] = cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_filename[0] = prev_pkg[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);
if (strcmp(cur_pkg, prev_pkg) != 0) {
if (output)
fputs(output, stdout);
if (uniq && output_pkg != -1)
pkgs[output_pkg] = NULL;
strcpy(prev_pkg, cur_pkg);
}
free(output);
output = NULL;
output_pkg = -1;
} 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, checksum_field, strlen(checksum_field)) == 0
&& buf[strlen(checksum_field)] == ':') {
fieldcpy(cur_checksum, buf);
} else if (strncasecmp(buf, "Filename:", 9) == 0) {
fieldcpy(cur_filename, buf);