1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-27 17:15:00 +02:00

[backfire] merge r22814, r22815, r22819, r22871, r23084, r23102 and r23171

git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@23203 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2010-10-03 19:23:52 +00:00
parent 30bbe8bbe5
commit f30b232516
3 changed files with 53 additions and 23 deletions

View File

@ -15,7 +15,7 @@ import getopt
opt_dryrun = False
def parseVer_1234(match):
def parseVer_1234(match, filepath):
progname = match.group(1)
progversion = (int(match.group(2)) << 64) |\
(int(match.group(3)) << 48) |\
@ -23,7 +23,7 @@ def parseVer_1234(match):
(int(match.group(5)) << 16)
return (progname, progversion)
def parseVer_123(match):
def parseVer_123(match, filepath):
progname = match.group(1)
try:
patchlevel = match.group(5)
@ -39,7 +39,7 @@ def parseVer_123(match):
patchlevel
return (progname, progversion)
def parseVer_12(match):
def parseVer_12(match, filepath):
progname = match.group(1)
try:
patchlevel = match.group(4)
@ -54,18 +54,24 @@ def parseVer_12(match):
patchlevel
return (progname, progversion)
def parseVer_r(match):
def parseVer_r(match, filepath):
progname = match.group(1)
progversion = (int(match.group(2)) << 64)
return (progname, progversion)
def parseVer_ymd(match):
def parseVer_ymd(match, filepath):
progname = match.group(1)
progversion = (int(match.group(2)) << 64) |\
(int(match.group(3)) << 48) |\
(int(match.group(4)) << 32)
return (progname, progversion)
def parseVer_GIT(match, filepath):
progname = match.group(1)
st = os.stat(filepath)
progversion = int(st.st_mtime) << 64
return (progname, progversion)
extensions = (
".tar.gz",
".tar.bz2",
@ -77,6 +83,7 @@ extensions = (
)
versionRegex = (
(re.compile(r"(.+)[-_]([0-9a-fA-F]{40,40})"), parseVer_GIT), # xxx-GIT_SHASUM
(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)\.(\d+)"), parseVer_1234), # xxx-1.2.3.4
(re.compile(r"(.+)[-_](\d\d\d\d)-?(\d\d)-?(\d\d)"), parseVer_ymd), # xxx-YYYY-MM-DD
(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)(\w?)"), parseVer_123), # xxx-1.2.3a
@ -102,10 +109,12 @@ class Entry:
self.directory = directory
self.filename = filename
self.progname = ""
self.fileext = ""
for ext in extensions:
if filename.endswith(ext):
filename = filename[0:0-len(ext)]
self.fileext = ext
break
else:
print self.filename, "has an unknown file-extension"
@ -113,7 +122,8 @@ class Entry:
for (regex, parseVersion) in versionRegex:
match = regex.match(filename)
if match:
(self.progname, self.version) = parseVersion(match)
(self.progname, self.version) = parseVersion(
match, directory + "/" + filename + self.fileext)
break
else:
print self.filename, "has an unknown version pattern"

View File

@ -26,6 +26,10 @@ $valid_mk or die "Unsupported version of make found: $mk\n";
my @feeds;
my %build_packages;
my %installed;
my %feed_cache;
my $feed_package = {};
my $feed_src = {};
sub parse_config() {
my $line = 0;
@ -148,16 +152,22 @@ sub update_feed_via($$$$) {
sub get_feed($) {
my $feed = shift;
my $file = "./feeds/$feed.index";
clear_packages();
if (!defined($feed_cache{$feed})) {
my $file = "./feeds/$feed.index";
-f $file or do {
print "Ignoring feed '$feed' - index missing\n";
return;
};
parse_package_metadata($file) or return;
return { %package };
clear_packages();
-f $file or do {
print "Ignoring feed '$feed' - index missing\n";
return;
};
parse_package_metadata($file) or return;
$feed_cache{$feed} = [ { %package }, { %srcpackage } ];
}
$feed_package = $feed_cache{$feed}->[0];
$feed_src = $feed_cache{$feed}->[1];
return $feed_cache{$feed}->[0];
}
sub get_installed() {
@ -174,8 +184,8 @@ sub search_feed {
return unless @substr > 0;
get_feed($feed);
foreach my $name (sort { lc($a) cmp lc($b) } keys %package) {
my $pkg = $package{$name};
foreach my $name (sort { lc($a) cmp lc($b) } keys %$feed_package) {
my $pkg = $feed_package->{$name};
my $substr;
my $pkgmatch = 1;
@ -211,8 +221,8 @@ sub list_feed {
my $feed = shift;
get_feed($feed);
foreach my $name (sort { lc($a) cmp lc($b) } keys %package) {
my $pkg = $package{$name};
foreach my $name (sort { lc($a) cmp lc($b) } keys %$feed_package) {
my $pkg = $feed_package->{$name};
next if $pkg->{vdepends};
if($pkg->{name}) {
printf "\%-32s\t\%s\n", $pkg->{name}, $pkg->{title};
@ -293,10 +303,13 @@ sub install_package {
$feed or do {
$installed{$name} and return 0;
# TODO: check if it's already installed within ./package directory
$srcpackage{$name} or -d "./package/$name" or warn "WARNING: No feed for package '$name' found, maybe it's already part of the standard packages?\n";
$feed_src->{$name} or -d "./package/$name" or warn "WARNING: No feed for package '$name' found, maybe it's already part of the standard packages?\n";
return 0;
};
# switch to the metadata for the selected feed
get_feed($feed->[1]);
my $pkg = $feed{$feed->[1]}->{$name} or return 1;
$pkg->{name} or do {
$installed{$name} and return 0;
@ -327,8 +340,8 @@ sub install_package {
return 1;
};
# install all dependencies
foreach my $vpkg (@{$srcpackage{$src}}, $pkg) {
# install all dependencies referenced from the source package
foreach my $vpkg (@{$feed_src->{$src}}) {
foreach my $dep (@{$vpkg->{depends}}, @{$vpkg->{builddepends}}, @{$vpkg->{"builddepends/host"}}) {
next if $dep =~ /@/;
$dep =~ s/^\+//;
@ -384,11 +397,12 @@ sub install {
if (!defined($opts{p}) or $opts{p} eq $f->[1]) {
printf "Installing all packages from feed %s.\n", $f->[1];
get_feed($f->[1]);
foreach my $name (sort { lc($a) cmp lc($b) } keys %package) {
my $p = $package{$name};
foreach my $name (sort { lc($a) cmp lc($b) } keys %$feed_package) {
my $p = $feed_package->{$name};
next if $p->{vdepends};
if( $p->{name} ) {
install_package($feed, $p->{name}) == 0 or $ret = 1;
get_feed($f->[1]);
}
}
}

View File

@ -638,6 +638,9 @@ sub gen_package_mk() {
$pkg->{buildonly} and $config = "";
print "package-$config += $pkg->{subdir}$pkg->{src}\n";
if ($pkg->{variant}) {
if (!defined($done{$pkg->{src}})) {
print "\$(curdir)/$pkg->{subdir}$pkg->{src}/default-variant := $pkg->{variant}\n";
}
print "\$(curdir)/$pkg->{subdir}$pkg->{src}/variants += \$(if $config,$pkg->{variant})\n"
}
$pkg->{prereq} and print "prereq-$config += $pkg->{subdir}$pkg->{src}\n";
@ -772,6 +775,7 @@ sub gen_package_mk() {
next unless $cmds;
print <<EOF
ifndef DUMP_TARGET_DB
\$(TARGET_DIR)/etc/uci-defaults/$preconfig: FORCE
( \\
$cmds \\
@ -780,6 +784,8 @@ $cmds \\
ifneq (\$(IMAGEOPT)\$(CONFIG_IMAGEOPT),)
package/preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig
endif
endif
EOF
}
}