[Collab-qa-commits] r465 - in svnbuildstat: . trunk trunk/lib trunk/script
goneri-guest at alioth.debian.org
goneri-guest at alioth.debian.org
Sat Sep 29 23:13:59 UTC 2007
Author: goneri-guest
Date: 2007-09-29 23:13:59 +0000 (Sat, 29 Sep 2007)
New Revision: 465
Added:
svnbuildstat/branches/
svnbuildstat/tags/
svnbuildstat/trunk/
svnbuildstat/trunk/Changes
svnbuildstat/trunk/META.yml
svnbuildstat/trunk/Makefile.PL
svnbuildstat/trunk/README
svnbuildstat/trunk/inc/
svnbuildstat/trunk/lib/
svnbuildstat/trunk/lib/SvnBuildStat/
svnbuildstat/trunk/root/
svnbuildstat/trunk/schema-pg.sql
svnbuildstat/trunk/script/
svnbuildstat/trunk/script/clean.pl
svnbuildstat/trunk/script/svnbuildstat_import-new-report.pl
svnbuildstat/trunk/script/svnbuildstat_update-db.pl
svnbuildstat/trunk/script/svnbuildstat_update-repository.pl
svnbuildstat/trunk/svnbuildstat.conf
svnbuildstat/trunk/svnbuildstat_www.yml
svnbuildstat/trunk/t/
Removed:
svnbuildstat/inc/
svnbuildstat/root/
svnbuildstat/script/
svnbuildstat/t/
svnbuildstat/trunk/lib/SvnBuildStat/
svnbuildstat/trunk/script/clean.pl
svnbuildstat/trunk/script/svnbuildstat_import-new-report.pl
svnbuildstat/trunk/script/svnbuildstat_update-db.pl
Log:
create a trunk / branches / tags structure
Copied: svnbuildstat/trunk/Changes (from rev 395, svnbuildstat/Changes)
===================================================================
--- svnbuildstat/trunk/Changes (rev 0)
+++ svnbuildstat/trunk/Changes 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,4 @@
+This file documents the revision history for Perl extension SvnBuildStat::WWW.
+
+0.01 2007-04-25 12:09:45
+ - initial revision, generated by Catalyst
Copied: svnbuildstat/trunk/META.yml (from rev 395, svnbuildstat/META.yml)
===================================================================
--- svnbuildstat/trunk/META.yml (rev 0)
+++ svnbuildstat/trunk/META.yml 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,21 @@
+---
+abstract: Catalyst based application
+author: 'Goneri Le Bouder,,,'
+distribution_type: module
+generated_by: Module::Install version 0.65
+license: perl
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.3.html
+ version: 1.3
+name: SvnBuildStat-WWW
+no_index:
+ directory:
+ - inc
+ - t
+requires:
+ Catalyst: 5.7007
+ Catalyst::Action::RenderView: 0
+ Catalyst::Plugin::ConfigLoader: 0
+ Catalyst::Plugin::Static::Simple: 0
+ YAML: 0
+version: 0.01
Copied: svnbuildstat/trunk/Makefile.PL (from rev 395, svnbuildstat/Makefile.PL)
===================================================================
--- svnbuildstat/trunk/Makefile.PL (rev 0)
+++ svnbuildstat/trunk/Makefile.PL 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,16 @@
+use inc::Module::Install;
+
+name 'SvnBuildStat-WWW';
+all_from 'lib/SvnBuildStat/WWW.pm';
+
+requires 'Catalyst' => '5.7007';
+requires 'Catalyst::Plugin::ConfigLoader';
+requires 'Catalyst::Plugin::Static::Simple';
+requires 'Catalyst::Action::RenderView';
+requires 'YAML'; # This should reflect the config file format you've chosen
+ # See Catalyst::Plugin::ConfigLoader for supported formats
+catalyst;
+
+install_script glob('script/*.pl');
+auto_install;
+WriteAll;
Copied: svnbuildstat/trunk/README (from rev 461, svnbuildstat/README)
===================================================================
--- svnbuildstat/trunk/README (rev 0)
+++ svnbuildstat/trunk/README 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,78 @@
+Run script/svnbuildstat_www_server.pl to test the application.
+
+to get the packages to build:
+select package.name,build.rev from package left join build on package.id=build.package_id and package.rev=build.rev where build.rev is null and (package.isnative=true or package.istarballpresent=true);
+
+INSTALLATION:
+ This is the Apache configuration for svnbp:
+ NameVirtualHost *:80
+ <VirtualHost *:80>
+ ServerAdmin goneri at rulezlan.org
+ DocumentRoot /home/sites/svnbuildstat.debian.net/
+ ServerName svnbuildstat.debian.net
+ RewriteEngine On
+ ErrorLog /var/log/apache2/svnbuildstat-debian-net-error_log
+ CustomLog /var/log/apache2/svnbuildstat-debian-net-access_log common
+
+ LogLevel info
+
+
+ # Uncomment if you want to use Apache mod_cache
+ #<IfModule mod_cache.c>
+ ##LoadModule disk_cache_module modules/mod_disk_cache.so
+ ## If you want to use mod_disk_cache instead of mod_mem_cache,
+ ## uncomment the line above and comment out the LoadModule line below.
+ #<IfModule mod_disk_cache.c>
+ #CacheRoot /tmp
+ #CacheEnable disk /
+ #CacheDirLevels 5
+ #CacheDirLength 3
+ #CacheDefaultExpire 600
+ #CacheIgnoreNoLastMod On
+ #CacheMaxExpire 600
+ #CacheIgnoreCacheControl On
+ #</IfModule>
+ ##
+ #<IfModule mod_mem_cache.c>
+ #CacheEnable mem /
+ #MCacheSize 4096
+ #CacheDefaultExpire 60
+ #CacheMaxObjectCount 100
+ #MCacheMinObjectSize 1
+ #CacheMaxObjectSize 2048
+ #</IfModule>
+ ##
+ ### seems to impossible to do regex here
+ #CacheDisable /packages/tobuildv2/amd64
+ #CacheDisable /packages/tobuildv2/i386
+ #CacheDisable /packages/tobuildv2/ppc
+ #CacheDisable /packages/tobuildv2/sparc
+ #</IfModule>
+
+ <Perl>
+ # Where your svnbp installation is
+ use lib '/home/sites/svnbuildstat.debian.net/svnbuildstat/lib';
+ </Perl>
+
+ PerlModule SvnBuildStat::WWW
+
+ <Location />
+ SetHandler modperl
+ PerlResponseHandler SvnBuildStat::WWW
+
+ AllowOverride None
+ Options None
+ Order allow,deny
+ Allow from all
+ </Location>
+
+ </VirtualHost>
+
+Crontab:
+*/30 * * * * root /home/sites/svnbuildstat.debian.net/svnbuildstat/script/svnbuildstat_update-db.pl > /dev/null 2>&1
+5 * * * * root /home/sites/svnbuildstat.debian.net/svnbuildstat/script/svnbuildstat_update-bugs.pl > /dev/null 2>&1
+* * * * * root /home/sites/svnbuildstat.debian.net/svnbuildstat/script/svnbuildstat_update-repository.pl > /dev/null 2>&1
+* * * * * root /home/sites/svnbuildstat.debian.net/svnbuildstat/script/svnbuildstat_import-new-report.pl > /dev/null 2>&1
+0 0 * * * root /home/sites/svnbuildstat.debian.net/svnbuildstat/script/svnbuildstat_purge-buildinprogress.pl > /dev/null 2>&1
+
+
Copied: svnbuildstat/trunk/inc (from rev 395, svnbuildstat/inc)
Copied: svnbuildstat/trunk/lib (from rev 395, svnbuildstat/lib)
Copied: svnbuildstat/trunk/lib/SvnBuildStat (from rev 464, svnbuildstat/lib/SvnBuildStat)
Copied: svnbuildstat/trunk/root (from rev 395, svnbuildstat/root)
Copied: svnbuildstat/trunk/schema-pg.sql (from rev 464, svnbuildstat/schema-pg.sql)
===================================================================
--- svnbuildstat/trunk/schema-pg.sql (rev 0)
+++ svnbuildstat/trunk/schema-pg.sql 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,753 @@
+--
+-- PostgreSQL database dump
+--
+
+SET client_encoding = 'utf8';
+SET check_function_bodies = false;
+SET client_min_messages = warning;
+
+--
+-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
+--
+
+COMMENT ON SCHEMA public IS 'Standard public schema';
+
+
+SET search_path = public, pg_catalog;
+
+--
+-- Name: lindacount(integer); Type: FUNCTION; Schema: public; Owner: svnbuildstat
+--
+
+CREATE FUNCTION lindacount(integer) RETURNS bigint
+ AS $_$SELECT count(linda.id) FROM build,build_linda,linda WHERE build.id=build_linda.build_id AND linda.id=build_linda.linda_id AND build.id=$1;$_$
+ LANGUAGE sql;
+
+
+ALTER FUNCTION public.lindacount(integer) OWNER TO svnbuildstat;
+
+--
+-- Name: lindaerrcount(integer); Type: FUNCTION; Schema: public; Owner: svnbuildstat
+--
+
+CREATE FUNCTION lindaerrcount(integer) RETURNS bigint
+ AS $_$SELECT count(linda.id) FROM build,build_linda,linda WHERE build.id=build_linda.build_id AND linda.id=build_linda.linda_id AND build.id=$1 AND linda.iserror='t';$_$
+ LANGUAGE sql;
+
+
+ALTER FUNCTION public.lindaerrcount(integer) OWNER TO svnbuildstat;
+
+--
+-- Name: lintiancount(integer); Type: FUNCTION; Schema: public; Owner: svnbuildstat
+--
+
+CREATE FUNCTION lintiancount(integer) RETURNS bigint
+ AS $_$SELECT count(lintian.id) FROM build,build_lintian,lintian WHERE build.id=build_lintian.build_id AND lintian.id=build_lintian.lintian_id AND build.id=$1;$_$
+ LANGUAGE sql;
+
+
+ALTER FUNCTION public.lintiancount(integer) OWNER TO svnbuildstat;
+
+--
+-- Name: lintianerrcount(integer); Type: FUNCTION; Schema: public; Owner: svnbuildstat
+--
+
+CREATE FUNCTION lintianerrcount(integer) RETURNS bigint
+ AS $_$SELECT count(lintian.id) FROM build,build_lintian,lintian WHERE build.id=build_lintian.build_id AND lintian.id=build_lintian.lintian_id AND build.id=$1 AND lintian.iserror='t';$_$
+ LANGUAGE sql;
+
+
+ALTER FUNCTION public.lintianerrcount(integer) OWNER TO svnbuildstat;
+
+SET default_tablespace = '';
+
+SET default_with_oids = false;
+
+--
+-- Name: aliothlogin; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE aliothlogin (
+ id serial NOT NULL,
+ maintainer_id serial NOT NULL,
+ name text
+);
+
+
+ALTER TABLE public.aliothlogin OWNER TO svnbuildstat;
+
+--
+-- Name: arch_id_seq; Type: SEQUENCE; Schema: public; Owner: svnbuildstat
+--
+
+CREATE SEQUENCE arch_id_seq
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.arch_id_seq OWNER TO svnbuildstat;
+
+--
+-- Name: arch; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE arch (
+ id integer DEFAULT nextval('arch_id_seq'::regclass) NOT NULL,
+ name text NOT NULL
+);
+
+
+ALTER TABLE public.arch OWNER TO svnbuildstat;
+
+--
+-- Name: bug; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE bug (
+ bug_id integer NOT NULL,
+ severity_id integer,
+ package_id integer,
+ name text
+);
+
+
+ALTER TABLE public.bug OWNER TO svnbuildstat;
+
+--
+-- Name: build_id_seq; Type: SEQUENCE; Schema: public; Owner: svnbuildstat
+--
+
+CREATE SEQUENCE build_id_seq
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.build_id_seq OWNER TO svnbuildstat;
+
+--
+-- Name: build; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE build (
+ id integer DEFAULT nextval('build_id_seq'::regclass) NOT NULL,
+ package_id integer,
+ svndebrelease text,
+ build_log text,
+ lintian_log text,
+ linda_log text,
+ piuparts_log text,
+ host_id integer,
+ rev integer,
+ buildisok boolean DEFAULT false,
+ duration integer,
+ lintian_release text,
+ linda_release text,
+ piuparts_release text,
+ pbuilder_release text,
+ agent_release text,
+ arch_id integer,
+ "time" timestamp without time zone,
+ piupartsisok boolean DEFAULT false,
+ changelog text
+);
+
+
+ALTER TABLE public.build OWNER TO svnbuildstat;
+
+--
+-- Name: COLUMN build.changelog; Type: COMMENT; Schema: public; Owner: svnbuildstat
+--
+
+COMMENT ON COLUMN build.changelog IS 'rcs log since the previous builded revision';
+
+
+--
+-- Name: build_linda; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE build_linda (
+ build_id integer NOT NULL,
+ linda_id integer NOT NULL
+);
+
+
+ALTER TABLE public.build_linda OWNER TO svnbuildstat;
+
+--
+-- Name: build_lintian; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE build_lintian (
+ build_id integer NOT NULL,
+ lintian_id integer NOT NULL
+);
+
+
+ALTER TABLE public.build_lintian OWNER TO svnbuildstat;
+
+--
+-- Name: host_id_seq; Type: SEQUENCE; Schema: public; Owner: svnbuildstat
+--
+
+CREATE SEQUENCE host_id_seq
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.host_id_seq OWNER TO svnbuildstat;
+
+--
+-- Name: host; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE host (
+ id integer DEFAULT nextval('host_id_seq'::regclass) NOT NULL,
+ name text,
+ arch text,
+ maintainer_id integer
+);
+
+
+ALTER TABLE public.host OWNER TO svnbuildstat;
+
+--
+-- Name: linda_id_seq; Type: SEQUENCE; Schema: public; Owner: svnbuildstat
+--
+
+CREATE SEQUENCE linda_id_seq
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.linda_id_seq OWNER TO svnbuildstat;
+
+--
+-- Name: linda; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE linda (
+ id integer DEFAULT nextval('linda_id_seq'::regclass) NOT NULL,
+ iserror boolean,
+ name text
+);
+
+
+ALTER TABLE public.linda OWNER TO svnbuildstat;
+
+--
+-- Name: lintian_id_seq; Type: SEQUENCE; Schema: public; Owner: svnbuildstat
+--
+
+CREATE SEQUENCE lintian_id_seq
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.lintian_id_seq OWNER TO svnbuildstat;
+
+--
+-- Name: lintian; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE lintian (
+ id integer DEFAULT nextval('lintian_id_seq'::regclass) NOT NULL,
+ iserror boolean,
+ name text
+);
+
+
+ALTER TABLE public.lintian OWNER TO svnbuildstat;
+
+--
+-- Name: maintainer_id_seq; Type: SEQUENCE; Schema: public; Owner: svnbuildstat
+--
+
+CREATE SEQUENCE maintainer_id_seq
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.maintainer_id_seq OWNER TO svnbuildstat;
+
+--
+-- Name: maintainer; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE maintainer (
+ id integer DEFAULT nextval('maintainer_id_seq'::regclass) NOT NULL,
+ email text,
+ name text
+);
+
+
+ALTER TABLE public.maintainer OWNER TO svnbuildstat;
+
+--
+-- Name: package_id_seq; Type: SEQUENCE; Schema: public; Owner: svnbuildstat
+--
+
+CREATE SEQUENCE package_id_seq
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.package_id_seq OWNER TO svnbuildstat;
+
+--
+-- Name: package; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE package (
+ id integer DEFAULT nextval('package_id_seq'::regclass) NOT NULL,
+ tarballuri text,
+ repository_id integer,
+ name text,
+ rev text,
+ istarballpresent boolean DEFAULT false,
+ isindebian boolean DEFAULT false,
+ svndebrelease text,
+ uri text,
+ isuptodate boolean,
+ upstreamrelease character varying(200),
+ isnative boolean DEFAULT false,
+ lastcheck timestamp without time zone,
+ iswatchfilebroken boolean,
+ lastbuildstart timestamp without time zone,
+ blacklisted boolean DEFAULT false,
+ i386 boolean DEFAULT true,
+ powerpc boolean DEFAULT true,
+ amd64 boolean DEFAULT true,
+ sparc boolean DEFAULT true,
+ todo text,
+ currentchangelogentry text,
+ currentpendingbug text,
+ isinincoming boolean DEFAULT false,
+ isinnew boolean DEFAULT false,
+ issrcinmypool boolean DEFAULT false,
+ realsvndebrelease text
+);
+
+
+ALTER TABLE public.package OWNER TO svnbuildstat;
+
+--
+-- Name: package_maintainer; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE package_maintainer (
+ package_id integer NOT NULL,
+ maintainer_id integer NOT NULL
+);
+
+
+ALTER TABLE public.package_maintainer OWNER TO svnbuildstat;
+
+--
+-- Name: repository_id_seq; Type: SEQUENCE; Schema: public; Owner: svnbuildstat
+--
+
+CREATE SEQUENCE repository_id_seq
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.repository_id_seq OWNER TO svnbuildstat;
+
+--
+-- Name: repository; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE repository (
+ id integer DEFAULT nextval('repository_id_seq'::regclass) NOT NULL,
+ uri text,
+ name text,
+ tarballlayout text,
+ enabled boolean DEFAULT true,
+ rev integer,
+ lastcheck timestamp without time zone
+);
+
+
+ALTER TABLE public.repository OWNER TO svnbuildstat;
+
+--
+-- Name: severity_id_seq; Type: SEQUENCE; Schema: public; Owner: svnbuildstat
+--
+
+CREATE SEQUENCE severity_id_seq
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+
+ALTER TABLE public.severity_id_seq OWNER TO svnbuildstat;
+
+--
+-- Name: severity; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE severity (
+ id integer DEFAULT nextval('severity_id_seq'::regclass) NOT NULL,
+ name text
+);
+
+
+ALTER TABLE public.severity OWNER TO svnbuildstat;
+
+--
+-- Name: vcschangelog; Type: TABLE; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE TABLE vcschangelog (
+ id serial NOT NULL,
+ aliothlogin_id integer,
+ package_id integer NOT NULL,
+ date timestamp without time zone,
+ log text,
+ rev integer NOT NULL
+);
+
+
+ALTER TABLE public.vcschangelog OWNER TO svnbuildstat;
+
+--
+-- Name: viewchangelog; Type: VIEW; Schema: public; Owner: svnbuildstat
+--
+
+CREATE VIEW viewchangelog AS
+ SELECT aliothlogin.name, vcschangelog.date, vcschangelog.log, vcschangelog.rev, build.buildisok, package.id FROM vcschangelog, build, package, aliothlogin WHERE ((((build.package_id = package.id) AND (vcschangelog.rev = build.rev)) AND (vcschangelog.package_id = package.id)) AND (vcschangelog.aliothlogin_id = aliothlogin.id));
+
+
+ALTER TABLE public.viewchangelog OWNER TO svnbuildstat;
+
+--
+-- Name: viewpackage; Type: VIEW; Schema: public; Owner: svnbuildstat
+--
+
+CREATE VIEW viewpackage AS
+ SELECT DISTINCT count(build.id) AS builded, max(lintiancount(build.id)) AS lintiancount, max(lintianerrcount(build.id)) AS lintianerrcount, max(lindacount(build.id)) AS lindacount, max(lindaerrcount(build.id)) AS lindaerrcount, bool_or(build.buildisok) AS buildisok, bool_or(build.piupartsisok) AS piupartsisok, max(build."time") AS lastbuilddate, package.id AS package_id, package.name, package.repository_id, package.isindebian, package.isuptodate, package.tarballuri, package.uri, package.isnative, package.iswatchfilebroken, count(bug.bug_id) AS bugcount, max(bug.severity_id) AS bugmaxseverity, package.istarballpresent, package.svndebrelease, package.lastbuildstart, package.currentpendingbug FROM ((package LEFT JOIN build build ON (((package.id = build.package_id) AND (package.rev = (build.rev)::text)))) LEFT JOIN bug ON ((package.id = bug.package_id))) GROUP BY package.id, package.name, package.repository_id, package.isindebian, package.isuptodate, package.istarballpresent, package.tarballuri, package.uri, package.svndebrelease, package.isnative, package.iswatchfilebroken, package.lastbuildstart, package.currentpendingbug ORDER BY count(build.id), max(lintiancount(build.id)), max(lintianerrcount(build.id)), max(lindacount(build.id)), max(lindaerrcount(build.id)), bool_or(build.buildisok), bool_or(build.piupartsisok), max(build."time"), package.id, package.name, package.repository_id, package.isindebian, package.isuptodate, package.tarballuri, package.uri, package.isnative, package.iswatchfilebroken, count(bug.bug_id), max(bug.severity_id), package.istarballpresent, package.svndebrelease, package.lastbuildstart, package.currentpendingbug;
+
+
+ALTER TABLE public.viewpackage OWNER TO svnbuildstat;
+
+--
+-- Name: viewtobuild; Type: VIEW; Schema: public; Owner: svnbuildstat
+--
+
+CREATE VIEW viewtobuild AS
+ SELECT package.id, package.i386, package.powerpc, package.sparc, package.amd64 FROM (package LEFT JOIN build ON (((package.id = build.package_id) AND (package.rev = (build.rev)::text)))) WHERE (((package.blacklisted = false) AND ((package.isnative = true) OR (package.istarballpresent = true))) AND ((package.lastbuildstart IS NULL) OR (package.lastbuildstart < (now() - '03:00:00'::interval)))) ORDER BY (build.id IS NOT NULL), build."time";
+
+
+ALTER TABLE public.viewtobuild OWNER TO svnbuildstat;
+
+--
+-- Name: viewtobuild2; Type: VIEW; Schema: public; Owner: svnbuildstat
+--
+
+CREATE VIEW viewtobuild2 AS
+ SELECT package.id, package.i386, package.powerpc, package.sparc, package.amd64 FROM (package LEFT JOIN build ON (((package.id = build.package_id) AND (package.rev = (build.rev)::text)))) WHERE (((package.blacklisted = false) AND (package.issrcinmypool = true)) AND ((package.lastbuildstart IS NULL) OR (package.lastbuildstart < (now() - '03:00:00'::interval)))) ORDER BY (build.id IS NOT NULL), build."time";
+
+
+ALTER TABLE public.viewtobuild2 OWNER TO svnbuildstat;
+
+--
+-- Name: aliothlogin_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY aliothlogin
+ ADD CONSTRAINT aliothlogin_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: arch_arch_key; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY arch
+ ADD CONSTRAINT arch_arch_key UNIQUE (name);
+
+
+--
+-- Name: arch_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY arch
+ ADD CONSTRAINT arch_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: bug_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY bug
+ ADD CONSTRAINT bug_pkey PRIMARY KEY (bug_id);
+
+
+--
+-- Name: build_linda_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY build_linda
+ ADD CONSTRAINT build_linda_pkey PRIMARY KEY (build_id, linda_id);
+
+
+--
+-- Name: build_lintian_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY build_lintian
+ ADD CONSTRAINT build_lintian_pkey PRIMARY KEY (build_id, lintian_id);
+
+
+--
+-- Name: build_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY build
+ ADD CONSTRAINT build_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: host_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY host
+ ADD CONSTRAINT host_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: linda_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY linda
+ ADD CONSTRAINT linda_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: lintian_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY lintian
+ ADD CONSTRAINT lintian_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: maintainer_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY maintainer
+ ADD CONSTRAINT maintainer_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: package_maintainer_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY package_maintainer
+ ADD CONSTRAINT package_maintainer_pkey PRIMARY KEY (package_id, maintainer_id);
+
+
+--
+-- Name: package_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY package
+ ADD CONSTRAINT package_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: repository_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY repository
+ ADD CONSTRAINT repository_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: severity_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY severity
+ ADD CONSTRAINT severity_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: vcschangelog_pkey; Type: CONSTRAINT; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+ALTER TABLE ONLY vcschangelog
+ ADD CONSTRAINT vcschangelog_pkey PRIMARY KEY (id);
+
+
+--
+-- Name: arch_arch_name; Type: INDEX; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE INDEX arch_arch_name ON arch USING btree (name);
+
+
+--
+-- Name: idx_name; Type: INDEX; Schema: public; Owner: svnbuildstat; Tablespace:
+--
+
+CREATE INDEX idx_name ON package USING btree (name);
+
+
+--
+-- Name: $1; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY host
+ ADD CONSTRAINT "$1" FOREIGN KEY (maintainer_id) REFERENCES maintainer(id);
+
+
+--
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY build_linda
+ ADD CONSTRAINT "$2" FOREIGN KEY (linda_id) REFERENCES linda(id);
+
+
+--
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY build_lintian
+ ADD CONSTRAINT "$2" FOREIGN KEY (lintian_id) REFERENCES lintian(id);
+
+
+--
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY package_maintainer
+ ADD CONSTRAINT "$2" FOREIGN KEY (maintainer_id) REFERENCES maintainer(id);
+
+
+--
+-- Name: $2; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY build
+ ADD CONSTRAINT "$2" FOREIGN KEY (host_id) REFERENCES host(id);
+
+
+--
+-- Name: $3; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY build
+ ADD CONSTRAINT "$3" FOREIGN KEY (arch_id) REFERENCES arch(id);
+
+
+--
+-- Name: aliothlogin_maintainer_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY aliothlogin
+ ADD CONSTRAINT aliothlogin_maintainer_id_fkey FOREIGN KEY (maintainer_id) REFERENCES maintainer(id) ON DELETE SET NULL;
+
+
+--
+-- Name: bug_package_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY bug
+ ADD CONSTRAINT bug_package_id_fkey FOREIGN KEY (package_id) REFERENCES package(id) ON DELETE CASCADE;
+
+
+--
+-- Name: bug_severity_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY bug
+ ADD CONSTRAINT bug_severity_id_fkey FOREIGN KEY (severity_id) REFERENCES severity(id) ON DELETE RESTRICT;
+
+
+--
+-- Name: build_linda_build_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY build_linda
+ ADD CONSTRAINT build_linda_build_id_fkey FOREIGN KEY (build_id) REFERENCES build(id) ON DELETE CASCADE;
+
+
+--
+-- Name: build_lintian_build_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY build_lintian
+ ADD CONSTRAINT build_lintian_build_id_fkey FOREIGN KEY (build_id) REFERENCES build(id) ON DELETE CASCADE;
+
+
+--
+-- Name: build_package_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY build
+ ADD CONSTRAINT build_package_id_fkey FOREIGN KEY (package_id) REFERENCES package(id) ON DELETE CASCADE;
+
+
+--
+-- Name: package_maintainer_package_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY package_maintainer
+ ADD CONSTRAINT package_maintainer_package_id_fkey FOREIGN KEY (package_id) REFERENCES package(id) ON DELETE CASCADE;
+
+
+--
+-- Name: package_repository_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY package
+ ADD CONSTRAINT package_repository_id_fkey FOREIGN KEY (repository_id) REFERENCES repository(id) ON DELETE RESTRICT;
+
+
+--
+-- Name: vcschangelog_aliothlogin_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY vcschangelog
+ ADD CONSTRAINT vcschangelog_aliothlogin_id_fkey FOREIGN KEY (aliothlogin_id) REFERENCES aliothlogin(id) ON DELETE SET NULL;
+
+
+--
+-- Name: vcschangelog_package_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: svnbuildstat
+--
+
+ALTER TABLE ONLY vcschangelog
+ ADD CONSTRAINT vcschangelog_package_id_fkey FOREIGN KEY (package_id) REFERENCES package(id) ON DELETE CASCADE;
+
+
+--
+-- Name: public; Type: ACL; Schema: -; Owner: postgres
+--
+
+REVOKE ALL ON SCHEMA public FROM PUBLIC;
+REVOKE ALL ON SCHEMA public FROM postgres;
+GRANT ALL ON SCHEMA public TO postgres;
+GRANT ALL ON SCHEMA public TO PUBLIC;
+
+
+--
+-- PostgreSQL database dump complete
+--
+
Copied: svnbuildstat/trunk/script (from rev 395, svnbuildstat/script)
Deleted: svnbuildstat/trunk/script/clean.pl
===================================================================
--- svnbuildstat/script/clean.pl 2007-08-30 13:11:13 UTC (rev 395)
+++ svnbuildstat/trunk/script/clean.pl 2007-09-29 23:13:59 UTC (rev 465)
@@ -1,39 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-use lib '/home/sites/svnbuildstat.debian.net/svnbuildstat/lib';
-use SvnBuildStat::Schema;
-use SvnBuildStat::Config;
-
-
-my $pkgname = shift;
-
-
-
-my $config = new SvnBuildStat::Config();
-my $schema = SvnBuildStat::Schema->connect(
- $config->db_dsn,
- $config->db_user,
- $config->db_password,
- {AutoCommit => 1, debug => 1}
-);
-
-
-
-my $package = $schema->resultset('Package')->search({name => $pkgname})->first;
-die unless $package;
-
-my $build_rs = $schema->resultset('Build')->search({package_id => $package->id, rev => $package->rev});
-
-$build_rs->delete_all;
-while (my $build = $build_rs->next) {
-print "->".$build->id."\n";
-}
-
-## Import packages
-#my $repository_rs = $schema->resultset('Repository')->search({enabled => 'true'});
-#while (my $repository = $repository_rs->next) {
-# # importRepository(\$repository);
-# $poolImportRepository->add(\$repository) or die "Fucked\n";
-#}#
-#print "threads launched\n";
Copied: svnbuildstat/trunk/script/clean.pl (from rev 464, svnbuildstat/script/clean.pl)
===================================================================
--- svnbuildstat/trunk/script/clean.pl (rev 0)
+++ svnbuildstat/trunk/script/clean.pl 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,40 @@
+#!/usr/bin/perl -w
+use strict;
+
+use lib '/home/sites/svnbuildstat.debian.net/svnbuildstat/lib';
+use SvnBuildStat::Schema;
+use SvnBuildStat::Config;
+
+
+my $pkgname = shift;
+
+
+
+my $config = new SvnBuildStat::Config();
+my $schema = SvnBuildStat::Schema->connect(
+ $config->db_dsn,
+ $config->db_user,
+ $config->db_password,
+ {AutoCommit => 1, debug => 1}
+);
+
+
+
+my $package = $schema->resultset('Package')->search({name => $pkgname})->first;
+die unless $package;
+
+#my $build_rs = $schema->resultset('Build')->search({package_id => $package->id, rev => $package->rev});
+my $build_rs = $schema->resultset('Build')->search({package_id => $package->id});
+
+$build_rs->delete_all;
+while (my $build = $build_rs->next) {
+print "->".$build->id."\n";
+}
+
+## Import packages
+#my $repository_rs = $schema->resultset('Repository')->search({enabled => 'true'});
+#while (my $repository = $repository_rs->next) {
+# # importRepository(\$repository);
+# $poolImportRepository->add(\$repository) or die "Fucked\n";
+#}#
+#print "threads launched\n";
Deleted: svnbuildstat/trunk/script/svnbuildstat_import-new-report.pl
===================================================================
--- svnbuildstat/script/svnbuildstat_import-new-report.pl 2007-08-30 13:11:13 UTC (rev 395)
+++ svnbuildstat/trunk/script/svnbuildstat_import-new-report.pl 2007-09-29 23:13:59 UTC (rev 465)
@@ -1,206 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-use lib '/home/sites/svnbuildstat.debian.net/svnbuildstat/lib';
-use File::Glob ':globally';
-
-use Encode;
-use File::stat;
-use File::Copy;
-
-
-use SvnBuildStat::Config;
-use SvnBuildStat::Schema;
-
-use Data::Dumper;
-my $config = new SvnBuildStat::Config();
-my $schema = SvnBuildStat::Schema->connect(
- $config->db_dsn,
- $config->db_user,
- $config->db_password,
- {AutoCommit => 1, debug => 1}
-);
-
-my @sourcedir;
-my @reporttarball;
-foreach (split / /,$config->report_sourcedir()) {
- if (!-d) {
- print STDERR "Error in the sourcedir section of the config file.".
- " $_ doesn't exist.\n";
- next;
- }
- push @reporttarball, <$_/*.tar>;
-}
-my $workdir = $config->report_workdir();
-my $rejecteddir = $config->report_rejecteddir();
-
-die "Please create `$workdir' directory." unless -d $workdir;
-die "Please create `$rejecteddir' directory." unless -d $rejecteddir;
-
-my $build_rs = $schema->resultset('Build');
-
-# Load the new report
-foreach my $reporttarball (@reporttarball) {
-
- my $st = stat($reporttarball);
- if ((!$reporttarball =~ /.*\/(.+)_(\d+)_(.+)_(.+)\.tar$/) ||
- !$st || ($st->mtime < time - 3600)) {
- move($reporttarball, $rejecteddir);
- next;
- }
- print localtime().": new report ".$reporttarball."\n";
- `cd $workdir && tar xf $reporttarball`;
-
- my %report;
- if (!open INFO, "<$workdir/report/info") {
- move($reporttarball, $rejecteddir);
- `rm -r $workdir/report`;
- next;
- }
- foreach (<INFO>) {
- $report{$1} = $2 if (/(.*)=(.*)/);
- }
- close INFO;
-
- foreach my $logfile (qw/build.log lintian.log linda.log piuparts.log/) {
- if (open TMP, "<$workdir/report/$logfile") {
- $report{$logfile} = '';
- foreach (<TMP>) {
- $report{$logfile} .= encode("UTF-8", $_);
- }
- close TMP;
- } else {
- $report{$logfile} = undef;
- }
- }
-
- my $package = $schema->resultset('Package')->search({name =>
- $report{source}})->first;
-
- if (!$package) {
- print "unknow package: $report{source}\n";
- move($reporttarball, $rejecteddir);
- next;
- }
-
- my $host = $schema->resultset('Host')->find_or_create(name => $report{hostname},
- arch => $report{arch});
- my $arch = $schema->resultset('Arch')->find_or_create(name => $report{arch});
-
-
- my $build = $schema->resultset('Build')->find_or_create({
- package_id => $package->id,
- arch_id => $arch->id,
- rev => $report{svn_rev},
- });
- $build->time('now');
- $build->set_from_related('host_id', $host);
- $build->update;
- $build->svndebrelease ($report{release});
- $build->update;
- $build->buildisok ($report{build} eq "ok"?"true":"false");
- $build->update;
- $build->checkoutisok ($report{checkout} eq "ok"?"true":"false");
- $build->update;
- $build->downloadisok ($report{download} eq "ok"?"true":"false");
- $build->update;
- $build->duration
- ($report{'stamp_build-end'}-$report{'stamp_build-start'});
- $build->update;
- $build->build_log ($report{'build.log'});
- $build->update;
- $build->lintian_log ($report{'lintian.log'});
- $build->update;
- $build->update;
- $build->linda_log ($report{'linda.log'});
- $build->update;
- $build->piuparts_log ($report{'piuparts.log'});
- $build->update;
- $build->lintian_release ($report{lintian_release});
- $build->update;
- $build->linda_release ($report{linda_release});
- $build->piuparts_release ($report{piuparts_release});
- $build->update;
- $build->svnbp_release ($report{'svnbp_release'});
- $build->pbuilder_release ($report{pbuilder_release});
- $build->update;
- $build->agent_release ($report{agent_release});
- $build->update;
-
-
- # lintian
- my %lintian;
- if ($report{'lintian.log'}) {
- foreach (split $/, $report{'lintian.log'}) {
- $lintian{$2} = $1 if (/^(.): \S*: (\S*)/);
- }
- }
-
- my @lintian;
- foreach (keys %lintian) {
- my $iserror = ($lintian{$_} eq "E")?1:0;
-
- my $lintian= $schema->resultset('Lintian')->find_or_create(name => $_);
- $lintian->iserror($iserror);
- my $build_lintian =
- $build->find_or_create_related('build_lintians', {
- lintian_id => $lintian->id});
- $lintian->update();
- }
-
- # linda
- my %linda;
- if ($report{'linda.log'}) {
- foreach (split $/, $report{'linda.log'}) {
- $linda{$2} = $1 if (/^(.):.*\((\S*)\)$/);
- }
- }
-
- # Update package rev just in case it'd been updated during the build
- my $svnbase = $package->uri;
- foreach (`LC_ALL=C svn info $svnbase`) {
- if (/Last Changed Rev:\ (\d+)/) {
- $package->rev($1);
- last;
- }
- }
-
- $package->update;
- $package->update;
-
- my @linda;
- foreach (keys %linda) {
- my $iserror = ($linda{$_} eq "E")?1:0;
-
- my $linda= $schema->resultset('Linda')->find_or_create(name => $_);
- $linda->iserror($iserror);
- my $build_linda =
- $build->find_or_create_related('build_lindas', {
- linda_id => $linda->id});
- $linda->update();
- }
-
- # piuparts
- if ($report{'piuparts.log'}) {
- foreach (split $/, $report{'piuparts.log'}) {
- $build->piupartsisok(1) if (/INFO: PASS: All tests./);
- }
- }
-
-
- $build->update;
-
- unlink $reporttarball or warn "Can't unlink $reporttarball\n";
-
- `rm -r $workdir/report`;
- unlink $reporttarball;
-}
-
-### PURGE of the lock file. To remove after the agent migration
-
-my @lockfile;
-
-foreach (split / /,$config->report_sourcedir()) {
- unlink if (-f && /lock$/);
-}
Copied: svnbuildstat/trunk/script/svnbuildstat_import-new-report.pl (from rev 464, svnbuildstat/script/svnbuildstat_import-new-report.pl)
===================================================================
--- svnbuildstat/trunk/script/svnbuildstat_import-new-report.pl (rev 0)
+++ svnbuildstat/trunk/script/svnbuildstat_import-new-report.pl 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,211 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use lib '/home/sites/svnbuildstat.debian.net/svnbuildstat/lib';
+use File::Glob ':globally';
+
+use Encode;
+use File::stat;
+use File::Copy;
+
+
+use SvnBuildStat::Config;
+use SvnBuildStat::Schema;
+
+use Data::Dumper;
+my $config = new SvnBuildStat::Config();
+my $schema = SvnBuildStat::Schema->connect(
+ $config->db_dsn,
+ $config->db_user,
+ $config->db_password,
+ {AutoCommit => 1, debug => 1}
+);
+
+my @sourcedir;
+my @reporttarball;
+foreach (split / /,$config->report_sourcedir()) {
+ if (!-d) {
+ print STDERR "Error in the sourcedir section of the config file.".
+ " $_ doesn't exist.\n";
+ next;
+ }
+ push @reporttarball, <$_/*.tar>;
+}
+my $workdir = $config->report_workdir();
+my $rejecteddir = $config->report_rejecteddir();
+
+die "Please create `$workdir' directory." unless -d $workdir;
+die "Please create `$rejecteddir' directory." unless -d $rejecteddir;
+
+my $build_rs = $schema->resultset('Build');
+
+# Load the new report
+foreach my $reporttarball (@reporttarball) {
+
+ my $st = stat($reporttarball);
+ if ((!$reporttarball =~ /.*\/(.+)_(\d+)_(.+)_(.+)\.tar$/) ||
+ !$st || ($st->mtime < time - 3600)) {
+ print "$reporttarball> tarball too old\n";
+ move($reporttarball, $rejecteddir);
+ next;
+ }
+ print localtime().": new report ".$reporttarball."\n";
+ `cd $workdir && tar xf $reporttarball`;
+
+ my %report;
+ if (!open INFO, "<$workdir/report/info") {
+ print "$reporttarball> can't open info file\n";
+ move($reporttarball, $rejecteddir);
+ `rm -r $workdir/report`;
+ next;
+ }
+ foreach (<INFO>) {
+ $report{$1} = $2 if (/(.*)=(.*)/);
+ }
+ close INFO;
+
+ if (!($report{source})||!($report{hostname})||!($report{svn_rev})) {
+ print "$reporttarball> invalide info file\n";
+ move($reporttarball, $rejecteddir);
+ `rm -r $workdir/report`;
+ next;
+ }
+
+
+ foreach my $logfile (qw/build.log lintian.log linda.log piuparts.log/) {
+ if (open TMP, "<$workdir/report/$logfile") {
+ $report{$logfile} = '';
+ foreach (<TMP>) {
+ $report{$logfile} .= encode("UTF-8", $_);
+ }
+ close TMP;
+ } else {
+ $report{$logfile} = undef;
+ }
+ }
+
+ my $package = $schema->resultset('Package')->search({name =>
+ $report{source}})->first;
+
+ if (!$package) {
+ print "$reporttarball> unknow package: $report{source}\n";
+ move($reporttarball, $rejecteddir);
+ next;
+ }
+
+ my $host = $schema->resultset('Host')->find_or_create(name => $report{hostname},
+ arch => $report{arch});
+ my $arch = $schema->resultset('Arch')->find_or_create(name => $report{arch});
+
+ my $build = $schema->resultset('Build')->find_or_create({
+ package_id => $package->id,
+ arch_id => $arch->id,
+ rev => $report{svn_rev},
+ });
+ $build->time('now');
+ $build->set_from_related('host_id', $host);
+ $build->update;
+ $build->svndebrelease ($report{release});
+ $build->update;
+ $build->update;
+ $build->buildisok ($report{build} eq "ok"?"true":"false");
+ $build->update;
+ $build->duration
+ ($report{'stamp_build-end'}-$report{'stamp_build-start'});
+ $build->update;
+ $build->build_log ($report{'build.log'});
+ $build->update;
+ $build->lintian_log ($report{'lintian.log'});
+ $build->update;
+ $build->update;
+ $build->linda_log ($report{'linda.log'});
+ $build->update;
+ $build->piuparts_log ($report{'piuparts.log'});
+ $build->update;
+ $build->lintian_release ($report{lintian_release});
+ $build->update;
+ $build->linda_release ($report{linda_release});
+ $build->piuparts_release ($report{piuparts_release});
+ $build->update;
+ $build->pbuilder_release ($report{pbuilder_release});
+ $build->update;
+ $build->agent_release ($report{agent_release});
+ $build->update;
+
+
+ # lintian
+ my %lintian;
+ if ($report{'lintian.log'}) {
+ foreach (split $/, $report{'lintian.log'}) {
+ $lintian{$2} = $1 if (/^(.): \S*: (\S*)/);
+ }
+ }
+
+ my @lintian;
+ foreach (keys %lintian) {
+ my $iserror = ($lintian{$_} eq "E")?1:0;
+
+ my $lintian= $schema->resultset('Lintian')->find_or_create(name => $_);
+ $lintian->iserror($iserror);
+ my $build_lintian =
+ $build->find_or_create_related('build_lintians', {
+ lintian_id => $lintian->id});
+ $lintian->update();
+ }
+
+ # linda
+ my %linda;
+ if ($report{'linda.log'}) {
+ foreach (split $/, $report{'linda.log'}) {
+ $linda{$2} = $1 if (/^(.):.*\((\S*)\)$/);
+ }
+ }
+
+ # Update package rev just in case it'd been updated during the build
+ my $svnbase = $package->uri;
+ foreach (`LC_ALL=C svn info $svnbase`) {
+ if (/Last Changed Rev:\ (\d+)/) {
+ $package->rev($1);
+ last;
+ }
+ }
+
+ $package->update;
+ $package->update;
+
+ my @linda;
+ foreach (keys %linda) {
+ my $iserror = ($linda{$_} eq "E")?1:0;
+
+ my $linda= $schema->resultset('Linda')->find_or_create(name => $_);
+ $linda->iserror($iserror);
+ my $build_linda =
+ $build->find_or_create_related('build_lindas', {
+ linda_id => $linda->id});
+ $linda->update();
+ }
+
+ # piuparts
+ if ($report{'piuparts.log'}) {
+ foreach (split $/, $report{'piuparts.log'}) {
+ $build->piupartsisok(1) if (/INFO: PASS: All tests./);
+ }
+ }
+
+
+ $build->update;
+
+ unlink $reporttarball or warn "Can't unlink $reporttarball\n";
+
+ `rm -r $workdir/report`;
+ unlink $reporttarball;
+}
+
+### PURGE of the lock file. To remove after the agent migration
+
+my @lockfile;
+
+foreach (split / /,$config->report_sourcedir()) {
+ unlink if (-f && /lock$/);
+}
Deleted: svnbuildstat/trunk/script/svnbuildstat_update-db.pl
===================================================================
--- svnbuildstat/script/svnbuildstat_update-db.pl 2007-08-30 13:11:13 UTC (rev 395)
+++ svnbuildstat/trunk/script/svnbuildstat_update-db.pl 2007-09-29 23:13:59 UTC (rev 465)
@@ -1,394 +0,0 @@
-#!/usr/bin/perl -w
-use File::Temp qw/ tempfile /;
-
-use strict;
-
-use LWP::UserAgent;
-use Data::Dumper;
-use File::Basename;
-use Time::Local;
-
-use threads;
-use threads::shared;
-use Thread::Pool::Simple;
-
-use Thread::Pool::Simple;
-use lib '/home/sites/svnbuildstat.debian.net/svnbuildstat/lib';
-use SvnBuildStat::Schema;
-use SvnBuildStat::Config;
-
-my $config;
-my $schema;
-
-my $poolImportPkg;
-
-sub getRev {
- my $uri = shift;
-
- foreach (`LC_ALL=C svn info $uri`) {
- return $1 if /Last Changed Rev:\ (\d+)/;
- }
-
- return;
-}
-sub mkTarballFromPackage {
- my $package = shift;
-
- my $majorrelease = $$package->svndebrelease;
- $majorrelease =~ s/^\d+://;
- $majorrelease =~ s/-[+0-9A-Za-z\.~]*$//;
-
- $$package->name.'_'.$majorrelease.".orig.tar.gz";
-}
-
-sub testUrl {
- my $url = shift;
- return unless $url;
-
- my $req = HTTP::Request->new(HEAD => $url);
- my $ua = LWP::UserAgent->new;
- $ua->agent("SvnBuildStat/0.1 ");
- my $res = $ua->request($req);
- $res->is_success;
-
-}
-
-sub createTarballUrlFromTarballlayout {
- my ($repository, $package) = @_;
-
- return unless $$repository->tarballlayout;
- my $packagename = $$package->name;
- my $tarball = mkTarballFromPackage($package);
- my $tarballuri = $$repository->tarballlayout;
- $tarballuri =~ s/\@TARBALL@/$tarball/;
- $tarballuri =~ s/\@PACKAGE@/$packagename/;
-# print "\n--->".$tarballuri."\n";
-
- return $tarballuri;
-}
-
-sub getOnDebianData {
- my $package = shift;
- return unless $$package->name;
- return unless $$package->svndebrelease;
- my $svndebrelease = $$package->svndebrelease;
- $svndebrelease =~ s/^\d+://; # remove the EPOCH
-
- my $isindebian = 'f';
- my $tarballuri;
- my $isnative = 'f';
-
- my $ua = LWP::UserAgent->new;
- $ua->agent("SvnBuildStat/0.1 ");
-
- if ($$package->svndebrelease !~ /-[\d+\.]+$/) {
- $isnative = 't';
- } else {
- my $debmirror = 'http://ftp.debian.org/debian';
- my $debdiff .= $$package->name."_".$svndebrelease.".diff.gz";
- my $tarball = mkTarballFromPackage($package);
-
- if ($tarball) {
- foreach my $section (qw/main contrib non-free/) {
- my $tmp = "$1/".$$package->name if $$package->name =~ /^(lib.|.)/;
- my $debdiffuri = $debmirror.'/pool/'.$section.'/'.$tmp.'/'.$debdiff;
- my $tmp_tarballuri = $debmirror.'/pool/'.$section.'/'.$tmp.'/'.$tarball;
- if (testUrl($debdiffuri)) {
- $isindebian = 't';
- }
- if (testUrl($tmp_tarballuri)) {
- $tarballuri = $tmp_tarballuri;
- $tarballuri =~ s/^$debmirror/\@DEBMIRROR@/;
- }
- }
- }
- }
- return { tarballuri => $tarballuri, isindebian => $isindebian, isnative => $isnative };
-}
-
-sub getUscanData {
- my $package = shift;
- my $cmd;
-
- return unless $$package->svndebrelease;
- return unless $$package->uri;
-
- $cmd = "svn cat ".$$package->uri."/debian/watch";
- my $watch = `$cmd`;
-
- return unless $watch;
-
- my ($fh, $watchfile) = tempfile(SUFFIX => '.uscan');
- print $fh $watch;
- close ($fh);
-
- my $majorrelease = $$package->svndebrelease;
- $majorrelease =~ s/^\d+://;
- $majorrelease =~ s/-[0-9A-Za-z\.~]*$//;
- $majorrelease =~ s/dfsg.*//;
- $majorrelease =~ s/\d+://;
- $cmd = "uscan --package ".$$package->name." --dehs --upstream-version ".$majorrelease." --watchfile ".$watchfile;
-# print $cmd."\n";
- my @uscan = `$cmd`;
- unlink $watchfile or warn;
- return unless @uscan > 2; # empty output
-
- my $tarballuri;
- my $isuptodate = 'f';
- my $iswatchfilebroken = 'f';
- my $upstreamrelease;
- foreach (@uscan) {
-# print;
- $tarballuri = $1 if (/^<upstream-url>(.+tar\.gz)<\/upstream-url>$/i);
- $isuptodate = 't' if (/^<status>up to date<\/status>$/);
- $upstreamrelease = $1 if (/^<upstream-version>(.+)<\/upstream-version>$/);
- $iswatchfilebroken = 't' if (/^<errors>/);
- }
- $iswatchfilebroken = 't' unless $upstreamrelease;
- $tarballuri = '' unless $isuptodate eq 't';
-
- return {tarballuri => $tarballuri, isuptodate => $isuptodate, upstreamrelease => $upstreamrelease, iswatchfilebroken => $iswatchfilebroken};
-}
-
-
-sub importPkg {
- print "ImportPkg\n";
- my( $repository, $uri, $tarballonrepository) = @_;
-
- my @maintainer;
- my $packagesrc;
- my $svndebrelease;
- my $tarballuri;
- my $rev = getRev($uri);
- my $todo;
- my $currentpendingbug;
- my $currentchangelogentry;
-# arch
- my $i386;
- my $powerpc;
- my $sparc;
- my $amd64;
-
-
- return unless $rev;
-
- my @control = `svn cat $uri/debian/control`;
- return unless @control;
- foreach (@control) {
- $packagesrc = $1 if /^Source:\ *(.*)/;
- if (/^(Maintainer|Uploaders):\ *(.*)/) {
- my $tmp = $2;
- foreach (split /,/, $tmp) {
- if (/(.+)<(.+)>/) {
- my $name = $1;
- my $email = $2;
- $name =~ s/^\ *//;
- $name =~ s/\ $//;
- my $maintainer = $schema->resultset('Maintainer')->find_or_create({email=>$email});
- $maintainer->name($name);
- $maintainer->update();
- push @maintainer, $maintainer;
- }
-
- }
- } elsif (/^Architecture: (.*)/) {
- my $arch = $1;
- $i386 = 1 if $arch =~ /(any|all|i386)/;
- $powerpc = 1 if $arch =~ /(any|all|powerpc)/;
- $sparc = 1 if $arch =~ /(any|all|sparc)/;
- $amd64 = 1 if $arch =~ /(any|all|amd64)/;
- }
- }
- if (!$packagesrc) {
-
- print "Parse error: $uri/debian/control";
- return;
-
- }
- my $package = $schema->resultset('Package')->find_or_create({name => $packagesrc});
- return unless $rev > $$package->rev; # do not continue unless needed
- $package->issrcinmypool (0);
-
- my @changelog = `svn cat $uri/debian/changelog`;
- if (@changelog) {
-
-
- foreach (@changelog) {
- if (/^\S/ && $currentchangelogentry) {
- # I ignore svn-bp empty template entry
- if ($currentchangelogentry =~ /^.*\n\s\s\*\sNOT RELEASED YET\n\n\s--.*/m) {
- $currentchangelogentry = '';
- } else {
- last;
- }
- }
- $currentchangelogentry .= $_;
- }
-
- if ($currentchangelogentry =~ /^.*\ \((.*)\)/) {
- $svndebrelease = $1;
- print "OK\n";
- } else {
- print "PAS OK\n";
- }
- # looks for bug closed in the changelog entry
- # the regex come from the BTS documentation
- foreach ($currentchangelogentry =~ /closes:\s*(?:bug)?\#\s*\d+(?:,\s*(?:bug)?\#\s*\d+)*/ig) {
- s/([A-Za-z]|#|:|\s)//g;
- $currentpendingbug .= $_.',' if $_;
- }
-
- } else {
-
- print "Parse error: $uri/debian/changelog\n";
- return;
-
- }
-
- my @todo = `svn cat $uri/debian/TODO`;
- @todo = `svn cat $uri/debian/TODO.Debian` unless @todo;
- @todo = `svn cat $uri/debian/todo` unless @todo;
- if (@todo) {
- $todo .= $_ foreach @todo;
- }
-
- $package->update_from_related('repository_id',$$repository);
-
- $package->svndebrelease ($svndebrelease);
- $package->uri($uri);
- $package->repository_id($$repository);
- foreach my $maintainer (@maintainer) {
- my $package_maintainer =
- $package->find_or_create_related('package_maintainers', {
- 'maintainer_id' => $maintainer->id});
- }
-
-
- # Search for the tarball
- my $tarball = mkTarballFromPackage(\$package);
- my $uscandata = getUscanData(\$package);
- my $ondebiandata = getOnDebianData(\$package);
- my $tarballurlfromtarballlayout = createTarballUrlFromTarballlayout($repository,\$package);
- $package->iswatchfilebroken($uscandata->{iswatchfilebroken});
- # Is the tarball on a Debian mirror?
- if ($ondebiandata->{isnative} eq 't') {
- $package->isnative(1);
- $package->tarballuri('');
- $package->istarballpresent(0);
- } else {
- $package->isnative(0);
- if ($ondebiandata->{tarballuri}) {
- $package->tarballuri($ondebiandata->{tarballuri});
- $package->istarballpresent(1);
- # Or on upstream repository (using uscan)
- } elsif($uscandata->{tarballuri}) {
- $package->tarballuri($uscandata->{tarballuri});
- $package->istarballpresent(1);
- # Or on a HTTP/FTP space is a tarball layout exists
- } elsif (testUrl($tarballurlfromtarballlayout)) {
- $package->tarballuri($tarballurlfromtarballlayout);
- $package->istarballpresent(1);
- # Or on the same repository
- } elsif(exists $tarballonrepository->{$tarball}) {
- my $t = $tarballonrepository->{$tarball};
- $t =~ s!svn://svn.debian.org/svn/(.*)!http://svn.debian.org/wsvn/$1?op=file&rev=0&sc=0!;
- } else {
- $package->tarballuri('');
- $package->istarballpresent(0);
- }
- }
-
- #
- $package->isuptodate($uscandata->{isuptodate});
- $package->upstreamrelease($uscandata->{upstreamrelease});
- $package->isindebian($ondebiandata->{isindebian});
-
- $package->i386($i386);
- $package->powerpc($powerpc);
- $package->sparc($sparc);
- $package->amd64($amd64);
- $package->todo($todo);
- $package->currentchangelogentry($currentchangelogentry);
- $package->currentpendingbug($currentpendingbug);
- print "->".$package->name."\n";
- $package->lastcheck('now');
- $package->rev($rev); # at the end since it marks in the new status of the package ins the DB
- $package->update();
-}
-
-
-$config = new SvnBuildStat::Config();
-$schema = SvnBuildStat::Schema->connect(
- $config->db_dsn,
- $config->db_user,
- $config->db_password,
- {AutoCommit => 1, debug => 1}
-);
-
-sub importRepository {
- my $repository = shift;
-
-
- my $tarballonrepository;
- print "Repository: ".$$repository->name."\n";
- my $t = 'svn ls -R '.$$repository->uri;
- my $rev = getRev($$repository->uri);
- if(! $rev) {
- print "Failed to get the current revision of ".$$repository->name."\n";
- return;
- }
-
- if ($$repository->rev eq $rev && $$repository->lastcheck) {
- # If he repository is up to date, a still do a refresh every 48h
- # this because of the tarball check
- my ($year, $mon, $day, $hour, $min, $sec) = ($$repository->lastcheck =~ /(\d{4})-(\d{2})-(\d{2})\ (\d{1,2}):(\d{2}):(\d{2})/);
- my $lastbuild = timelocal($sec, $min, $hour, $day, $mon, $year);
- if ($lastbuild > time - 3600*48) {
- print "No need to refresh ".$$repository->name."\n";
- return;
- }
- }
-
- my @uri;
-
- foreach (`$t`) {
- chomp;
- my $uri = $$repository->uri.'/'.$_;
- $tarballonrepository->{basename($_)}=$uri if /\.tar\.gz$/;
- $uri =~ s/\/$//;
- next if /\/(tags|branches|attic)\//; # I want trunk!
- next if /\/(sarge|etch)\//; # Try to avoid sarge and etch backport
- next unless /debian\/control$/; # I want trunk!
- $uri =~ s/(|\/)debian\/control$//;
- push @uri, $uri;
- }
-
- foreach my $uri (@uri) {
- # look for packages
- $poolImportPkg->add($repository,$uri,$tarballonrepository) or die "Fucked\n";
- }
-
- $$repository->rev($rev);
- $$repository->lastcheck('now');
- $$repository->update();
-
- print "end import Repo\n";
-}
-
-########## THREAD POOLS #####
-$poolImportPkg = Thread::Pool::Simple->new(
- min => 5,
- max => 5,
- load => 3,
- do => [\&importPkg],
- lifespan => 1
- );
-
-########
-
-# Import packages
-my $repository_rs = $schema->resultset('Repository')->search({enabled => 'true'});
-while (my $repository = $repository_rs->next) {
- importRepository(\$repository) or warn "importRepository failed for ".$repository->name."\n";
-}
-$poolImportPkg->join;
Copied: svnbuildstat/trunk/script/svnbuildstat_update-db.pl (from rev 464, svnbuildstat/script/svnbuildstat_update-db.pl)
===================================================================
--- svnbuildstat/trunk/script/svnbuildstat_update-db.pl (rev 0)
+++ svnbuildstat/trunk/script/svnbuildstat_update-db.pl 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,467 @@
+#!/usr/bin/perl -w
+use File::Temp qw/ tempfile /;
+
+use strict;
+
+use LWP::UserAgent;
+use Data::Dumper;
+use File::Basename;
+use Time::Local 'timelocal_nocheck';
+
+use threads;
+use threads::shared;
+use Thread::Pool::Simple;
+
+use Thread::Pool::Simple;
+use lib '/home/sites/svnbuildstat.debian.net/svnbuildstat/lib';
+use SvnBuildStat::Schema;
+use SvnBuildStat::Config;
+
+my $config;
+my $schema;
+
+my $poolImportPkg;
+
+sub getRev {
+ my $uri = shift;
+
+ foreach (`LC_ALL=C svn info $uri`) {
+ return $1 if /Last Changed Rev:\ (\d+)/;
+ }
+
+ return;
+}
+sub mkTarballFromPackage {
+ my $package = shift;
+
+ my $majorrelease = $$package->svndebrelease;
+ $majorrelease =~ s/^\d+://;
+ $majorrelease =~ s/-[+0-9A-Za-z\.~]*$//;
+
+ $$package->name.'_'.$majorrelease.".orig.tar.gz";
+}
+
+sub testUrl {
+ my $url = shift;
+ return unless $url;
+
+ my $req = HTTP::Request->new(HEAD => $url);
+ my $ua = LWP::UserAgent->new;
+ $ua->agent("SvnBuildStat/0.1 ");
+ my $res = $ua->request($req);
+ $res->is_success;
+
+}
+
+sub createTarballUrlFromTarballlayout {
+ my ($repository, $package) = @_;
+
+ return unless $$repository->tarballlayout;
+ my $packagename = $$package->name;
+ my $tarball = mkTarballFromPackage($package);
+ my $tarballuri = $$repository->tarballlayout;
+ $tarballuri =~ s/\@TARBALL@/$tarball/;
+ $tarballuri =~ s/\@PACKAGE@/$packagename/;
+# print "\n--->".$tarballuri."\n";
+
+ return $tarballuri;
+}
+
+sub getOnDebianData {
+ my $package = shift;
+ return unless $$package->name;
+ return unless $$package->svndebrelease;
+ my $svndebrelease = $$package->svndebrelease;
+ $svndebrelease =~ s/^\d+://; # remove the EPOCH
+
+ my $isindebian = 'f';
+ my $tarballuri;
+ my $isnative = 'f';
+
+ my $ua = LWP::UserAgent->new;
+ $ua->agent("SvnBuildStat/0.1 ");
+
+ if ($$package->svndebrelease !~ /-[\d+\.]+$/) {
+ $isnative = 't';
+ } else {
+ my $debmirror = 'http://ftp.debian.org/debian';
+ my $debdiff .= $$package->name."_".$svndebrelease.".diff.gz";
+ my $tarball = mkTarballFromPackage($package);
+
+ if ($tarball) {
+ foreach my $section (qw/main contrib non-free/) {
+ my $tmp = "$1/".$$package->name if $$package->name =~ /^(lib.|.)/;
+ my $debdiffuri = $debmirror.'/pool/'.$section.'/'.$tmp.'/'.$debdiff;
+ my $tmp_tarballuri = $debmirror.'/pool/'.$section.'/'.$tmp.'/'.$tarball;
+ if (testUrl($debdiffuri)) {
+ $isindebian = 't';
+ }
+ if (testUrl($tmp_tarballuri)) {
+ $tarballuri = $tmp_tarballuri;
+ $tarballuri =~ s/^$debmirror/\@DEBMIRROR@/;
+ }
+ }
+ }
+ }
+ return { tarballuri => $tarballuri, isindebian => $isindebian, isnative => $isnative };
+}
+
+sub getUscanData {
+ my $package = shift;
+ my $cmd;
+
+ return unless $$package->svndebrelease;
+ return unless $$package->uri;
+
+ $cmd = "svn cat ".$$package->uri."/debian/watch";
+ my $watch = `$cmd`;
+
+ return unless $watch;
+
+ my ($fh, $watchfile) = tempfile(SUFFIX => '.uscan');
+ print $fh $watch;
+ close ($fh);
+
+ my $majorrelease = $$package->svndebrelease;
+ $majorrelease =~ s/^\d+://;
+ $majorrelease =~ s/-[0-9A-Za-z\.~]*$//;
+ $majorrelease =~ s/dfsg.*//;
+ $majorrelease =~ s/\d+://;
+ $cmd = "uscan --package ".$$package->name." --dehs --upstream-version ".$majorrelease." --watchfile ".$watchfile;
+# print $cmd."\n";
+ my @uscan = `$cmd`;
+ unlink $watchfile or warn;
+ return unless @uscan > 2; # empty output
+
+ my $tarballuri;
+ my $isuptodate = 'f';
+ my $iswatchfilebroken = 'f';
+ my $upstreamrelease;
+ foreach (@uscan) {
+# print;
+ $tarballuri = $1 if (/^<upstream-url>(.+tar\.gz)<\/upstream-url>$/i);
+ $isuptodate = 't' if (/^<status>up to date<\/status>$/);
+ $upstreamrelease = $1 if (/^<upstream-version>(.+)<\/upstream-version>$/);
+ $iswatchfilebroken = 't' if (/^<errors>/);
+ }
+ $iswatchfilebroken = 't' unless $upstreamrelease;
+ $tarballuri = '' unless $isuptodate eq 't';
+
+ return {tarballuri => $tarballuri, isuptodate => $isuptodate, upstreamrelease => $upstreamrelease, iswatchfilebroken => $iswatchfilebroken};
+}
+
+sub updateChangelog {
+ my $package = shift;
+
+ print "UPDATE CHANGELOG\n";
+
+ my $last_rev;
+ my $vcschangelog_rs = $schema->resultset('Vcschangelog')->search({
+ package_id => $$package->id,
+ }, {order_by => "rev DESC"});
+ $last_rev = $vcschangelog_rs->first->rev if ($vcschangelog_rs->first);
+ if (!$last_rev) {
+ my $build_rs = $schema->resultset('Build')->search({
+ package_id => $$package->id,
+ }, {order_by => "rev"});
+ $last_rev = $build_rs->first->rev if ($build_rs->first);
+ }
+
+ return unless $last_rev;
+ print "LAST REV:". $last_rev."\n";
+
+ my $cmd = "LC_ALL=C svn log -r ".$last_rev.":".$$package->rev." ".$$package->uri;
+ my $begin;
+ my $entry;
+ foreach (`$cmd`) {
+ if (/^------------------------------------------------------------------------/) {
+ $begin = 1;
+ $entry->update if $entry;
+ $entry = undef;
+ } elsif ($begin) {
+ if (/r(\d+)\s\|\s(\S+)\s\|\s(20\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d)/) {
+ my $rev = $1;
+ my $login = $2;
+ my $date = $3;
+ my $aliothlogin = $schema->resultset('Aliothlogin')->find_or_create({name=>$login});
+ $entry = $schema->resultset('Vcschangelog')->create({
+ aliothlogin_id =>$aliothlogin->id,
+ package_id => $$package->id,
+ date => $date,
+ rev => $rev,
+ });
+
+ $begin = 0;
+ }
+
+ } elsif ($entry) {
+ $entry->log($entry->log.$_);
+ }
+
+ }
+ $entry->update if $entry;
+}
+
+sub importPkg {
+ my( $repository, $uri, $tarballonrepository) = @_;
+
+ my @maintainer;
+ my $packagesrc;
+ my $svndebrelease;
+ my $tarballuri;
+ my $rev = getRev($uri);
+ my $todo;
+ my $currentpendingbug;
+ my $currentchangelogentry;
+# arch
+ my $i386 = 'f';
+ my $powerpc = 'f';
+ my $sparc = 'f';
+ my $amd64 = 'f';
+
+
+ return unless $rev;
+
+ my @control = `svn cat $uri/debian/control`;
+ return unless @control;
+ foreach (@control) {
+ $packagesrc = $1 if /^Source:\ *(.*)/;
+ if (/^(Maintainer|Uploaders):\ *(.*)/) {
+ my $tmp = $2;
+ foreach (split /,/, $tmp) {
+ if (/(.+)<(.+)>/) {
+ my $name = $1;
+ my $email = $2;
+ $name =~ s/^\ *//;
+ $name =~ s/\ $//;
+ my $maintainer = $schema->resultset('Maintainer')->find_or_create({email=>$email});
+ $maintainer->name($name);
+ $maintainer->update();
+ push @maintainer, $maintainer;
+ }
+
+ }
+ } elsif (/^Architecture: (.*)/) {
+ my $arch = $1;
+ $i386 = 't' if $arch =~ /(any|all|i386)/;
+ $powerpc = 't' if $arch =~ /(any|all|powerpc)/;
+ $sparc = 't' if $arch =~ /(any|all|sparc)/;
+ $amd64 = 't' if $arch =~ /(any|all|amd64)/;
+ }
+ }
+ if (!$packagesrc) {
+
+ print "Parse error: $uri/debian/control";
+ return;
+
+ }
+ my $package = $schema->resultset('Package')->find_or_create({name => $packagesrc});
+
+ # if the source is not in the pool I can suppose the tarball was missing for the last
+ # check and so I need to check periodicly to see if the status has changed
+ if (defined($rev) && defined ($package->rev) && $rev > $package->rev) {
+ if (!$package->issrcinmypool) {
+ my ($year, $mon, $day, $hour, $min, $sec) = ($package->lastcheck =~ /(\d{4})-(\d+)-(\d+)\ (\d+):(\d+):(\d+)/);
+ my $lastcheck = timelocal_nocheck($sec, $min, $hour, $day, $mon, $year);
+ if ($lastcheck > time - 3600*24) {
+ print "No need to refresh ".$package->name."\n";
+ return;
+ }
+ }
+ return;
+ }
+ print "GO ".$package->name."\n";
+
+ $package->issrcinmypool (0);
+
+ my @changelog = `svn cat $uri/debian/changelog`;
+ if (@changelog) {
+ if ($changelog[0] =~ /^.*\ \((.*)\)/) {
+$package->realsvndebrelease($1)
+ }
+
+ foreach (@changelog) {
+ if (/^\S/ && $currentchangelogentry) {
+ # I ignore svn-bp empty template entry
+ if ($currentchangelogentry =~ /^.*\n\s\s\*\sNOT RELEASED YET\n\n\s--.*/m) {
+ $currentchangelogentry = '';
+ } else {
+ last;
+ }
+ }
+ $currentchangelogentry .= $_;
+ }
+
+ if ($currentchangelogentry =~ /^.*\ \((.*)\)/) {
+ $svndebrelease = $1;
+ }
+ # looks for bug closed in the changelog entry
+ # the regex come from the BTS documentation
+ # TODO dpkg-parsechangelog is probably more suitable for the job :D
+ foreach ($currentchangelogentry =~ /closes:\s*(?:bug)?\#\s*\d+(?:,\s*(?:bug)?\#\s*\d+)*/ig) {
+ s/([A-Za-z]|#|:|\s)//g;
+ $currentpendingbug .= $_.',' if $_;
+ }
+
+ } else {
+
+ print "Parse error: $uri/debian/changelog\n";
+ return;
+
+ }
+
+ my @todo = `svn cat $uri/debian/TODO`;
+ @todo = `svn cat $uri/debian/TODO.Debian` unless @todo;
+ @todo = `svn cat $uri/debian/todo` unless @todo;
+ if (@todo) {
+ $todo .= $_ foreach @todo;
+ }
+ $package->update_from_related('repository_id',$$repository);
+
+ $package->svndebrelease ($svndebrelease);
+ $package->uri($uri);
+ $package->repository_id($$repository);
+ foreach my $maintainer (@maintainer) {
+ my $package_maintainer =
+ $package->find_or_create_related('package_maintainers', {
+ 'maintainer_id' => $maintainer->id});
+ }
+
+
+# updateChangelog(\$package);
+ # Search for the tarball
+ my $tarball = mkTarballFromPackage(\$package);
+ my $uscandata = getUscanData(\$package);
+ my $ondebiandata = getOnDebianData(\$package);
+ my $tarballurlfromtarballlayout = createTarballUrlFromTarballlayout($repository,\$package);
+ $package->iswatchfilebroken($uscandata->{iswatchfilebroken});
+ # Is the tarball on a Debian mirror?
+ if ($ondebiandata->{isnative} eq 't') {
+ $package->isnative(1);
+ $package->tarballuri('');
+ $package->istarballpresent(0);
+ } else {
+ $package->isnative(0);
+ if ($ondebiandata->{tarballuri}) {
+ $package->tarballuri($ondebiandata->{tarballuri});
+ $package->istarballpresent(1);
+ # Or on upstream repository (using uscan)
+ } elsif($uscandata->{tarballuri}) {
+ $package->tarballuri($uscandata->{tarballuri});
+ $package->istarballpresent(1);
+ # Or on a HTTP/FTP space is a tarball layout exists
+ } elsif (testUrl($tarballurlfromtarballlayout)) {
+ $package->tarballuri($tarballurlfromtarballlayout);
+ $package->istarballpresent(1);
+ # Or on the same repository
+ } elsif(exists $tarballonrepository->{$tarball}) {
+ my $t = $tarballonrepository->{$tarball};
+ $t =~ s!svn://svn.debian.org/svn/(.*)!http://svn.debian.org/wsvn/$1?op=file&rev=0&sc=0!;
+ } else {
+ $package->tarballuri('');
+ $package->istarballpresent(0);
+ }
+ }
+
+ #
+ $package->isuptodate($uscandata->{isuptodate});
+ $package->upstreamrelease($uscandata->{upstreamrelease});
+ $package->isindebian($ondebiandata->{isindebian});
+
+ $package->i386($i386);
+ $package->powerpc($powerpc);
+ $package->sparc($sparc);
+ $package->amd64($amd64);
+ $package->todo($todo);
+ $package->currentchangelogentry($currentchangelogentry);
+ $package->currentpendingbug($currentpendingbug);
+ print "->".$package->name."\n";
+ $package->lastcheck('now');
+ $package->rev($rev); # at the end since it marks in the new status of the package ins the DB
+ $package->update();
+}
+
+
+$config = new SvnBuildStat::Config();
+$schema = SvnBuildStat::Schema->connect(
+ $config->db_dsn,
+ $config->db_user,
+ $config->db_password,
+ {AutoCommit => 1, debug => 1}
+);
+
+sub importRepository {
+ my $repository = shift;
+
+
+ my $tarballonrepository;
+ print "Repository: ".$$repository->name."\n";
+ my $t = 'svn ls -R '.$$repository->uri;
+ my $rev = getRev($$repository->uri);
+ if(! $rev) {
+ print "Failed to get the current revision of ".$$repository->name."\n";
+ return;
+ }
+
+ if ($$repository->rev eq $rev && $$repository->lastcheck) {
+ # If he repository is up to date, a still do a refresh every 48h
+ # this because of the tarball check
+ #
+ my ($year, $mon, $day, $hour, $min, $sec) = ($$repository->lastcheck =~ /(\d{4})-(\d+)-(\d+)\ (\d+):(\d+):(\d+)/);
+ my $lastcheck = timelocal_nocheck($sec, $min, $hour, $day, $mon, $year);
+ if ($lastcheck > time - 3600*48) {
+ print "No need to refresh ".$$repository->name."\n";
+ return;
+ }
+ }
+
+ my @uri;
+
+ foreach (`$t`) {
+ chomp;
+ my $uri = $$repository->uri.'/'.$_;
+ $tarballonrepository->{basename($_)}=$uri if /\.tar\.gz$/;
+ $uri =~ s/\/$//;
+ next if /\/(tags|branches|attic)\//; # I want trunk!
+ next if /\/(sarge|etch)\//; # Try to avoid sarge and etch backport
+ next unless /debian\/control$/; # I want trunk!
+ $uri =~ s/(|\/)debian\/control$//;
+ push @uri, $uri;
+ }
+
+ foreach my $uri (@uri) {
+ # look for packages
+ $poolImportPkg->add($repository,$uri,$tarballonrepository) or die "Fucked\n";
+ }
+
+ $$repository->rev($rev);
+ $$repository->lastcheck('now');
+ $$repository->update();
+
+ print "end import Repo\n";
+}
+
+########## THREAD POOLS #####
+$poolImportPkg = Thread::Pool::Simple->new(
+ min => 5,
+ max => 5,
+ load => 3,
+ do => [\&importPkg],
+ lifespan => 1
+ );
+
+########
+
+# Import packages
+my $repository_rs = $schema->resultset('Repository')->search({enabled => 'true'});
+while (my $repository = $repository_rs->next) {
+ importRepository(\$repository) or warn "importRepository failed for ".$repository->name."\n";
+}
+$poolImportPkg->join;
+
+# Purge the removed packages
+my $interval = "< repository_id.lastcheck - interval '1 day'";
+my $package_rs = $schema->resultset('Package')->search({'me.lastcheck' => \$interval} , {join => => 'repository_id'});
+$package_rs->delete_all;
+
+
Copied: svnbuildstat/trunk/script/svnbuildstat_update-repository.pl (from rev 464, svnbuildstat/script/svnbuildstat_update-repository.pl)
===================================================================
--- svnbuildstat/trunk/script/svnbuildstat_update-repository.pl (rev 0)
+++ svnbuildstat/trunk/script/svnbuildstat_update-repository.pl 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,221 @@
+#!/usr/bin/perl -w
+
+use strict;
+print STDERR "WARNING: this script \"purge\" the working directory!!! Be careful\n";
+sleep 2;
+# TODO: purge the directory
+chdir "/home/sites/nana.rulezlan.org/debian/" or die;
+#use lib ".";
+
+use LWP::Simple;
+use File::Basename;
+use File::Glob qw/:globally/;
+use File::Find;
+use File::Touch;
+
+use lib '/home/sites/svnbuildstat.debian.net/svnbuildstat/lib';
+
+foreach (<lock.*>) {
+ /lock.(\d+)/;
+ my $pid = $1;
+ if (open (CMDLINE, "/proc/$pid/cmdline")) {
+ my $content = <CMDLINE>;
+ if ($content =~ /svnbuildstat_update-repository\.pl/) {
+ die "an instance is already running (pid $pid)";
+ }
+ }
+ unlink 'lock.'.$pid;
+}
+touch "lock.$$";
+use SvnBuildStat::Schema;
+use SvnBuildStat::Config;
+
+my $debmirror = "http://ftp.debian.org";
+my $config;
+my $schema;
+
+sub purge {
+ opendir(DIR, '.') || die "can't opendir .: $!";
+ while (my $entry = readdir(DIR)) {
+ if( -d $entry ) {
+ next if $entry =~ /^\.{1,2}/;
+ } elsif ( -f $entry ) {
+ next unless $entry =~ /.*\diff\.gz\.new\..*/;
+ }
+ print "remove: $entry\n";
+ `rm -Rf $entry`;
+ }
+ closedir DIR;
+}
+
+sub purgeOutDated {
+ my $package_rs = $schema->resultset('Package');
+ while (my $package = $package_rs->next) {
+ next unless $package->name;
+ next unless $package->svndebrelease;
+
+ my $svndebrelease = $package->realsvndebrelease;
+ $svndebrelease =~ s/^\d+://;
+
+ if (open REV, "<".$package->name."_".$svndebrelease.".rev") {
+ my $revInRepo = <REV>;
+ close REV;
+ next if $revInRepo eq $package->rev;
+ }
+
+ $package->issrcinmypool('false');
+ my $t = $package->name."_*";
+ unlink foreach (CORE::glob($t));
+ }
+}
+
+sub updateIsSrcInMyPoolFromFiles {
+ my $package_rs = $schema->resultset('Package');
+ while (my $package = $package_rs->next) {
+ next unless $package->realsvndebrelease;
+
+ my $svndebrelease = $package->realsvndebrelease;
+ $svndebrelease =~ s/^\d+://;
+
+ if ( -f $package->name."_".$svndebrelease.".dsc") {
+ $package->issrcinmypool('true');
+ } else {
+ $package->issrcinmypool('false');
+ }
+ $package->update;
+ }
+}
+
+sub updateSources {
+ my $package_rs = $schema->resultset('Package')->search({issrcinmypool => 'false'});
+ while (my $package = $package_rs->next) {
+ next unless $package->realsvndebrelease;
+
+ my $svndebrelease = $package->realsvndebrelease;
+ $svndebrelease =~ s/^\d+://;
+ my $failedNotifFile = $package->name."_".$svndebrelease.".dsc.failed";
+
+ next if -f $failedNotifFile;
+ next unless ($package->isnative or $package->istarballpresent);
+ purge();
+ my $log = [];
+ if (!prepare(\$package, $log)) {
+ if (open LOG, ">".$failedNotifFile) {
+ print LOG $_ foreach (@$log);
+ } else { warn "Can't write log file\n" }
+ }
+ }
+}
+
+sub mkTarballFromPackage {
+ my $package = shift;
+
+ my $majorrelease = $$package->svndebrelease;
+ $majorrelease =~ s/^\d+://;
+ $majorrelease =~ s/-[+0-9A-Za-z\.~]*$//;
+
+ $$package->name.'_'.$majorrelease.".orig.tar.gz";
+}
+
+sub getRev {
+ my $uri = shift;
+
+ foreach (`LC_ALL=C svn info $uri`) {
+ return $1 if /Last Changed Rev:\ (\d+)/;
+ }
+
+ return;
+}
+
+sub prepare {
+ my ($package, $log) = @_;
+
+ my $directory = $$package->name."-".$$package->svndebrelease;
+ my $tarball = "";
+ if (!$$package->isnative) {
+ $tarball = mkTarballFromPackage($package);
+
+ if (!-f $tarball) {
+ my $tarballuri = $$package->tarballuri;
+ $tarballuri =~ s/\@DEBMIRROR@/$debmirror/;
+
+ if (is_error(getstore($tarballuri,$tarball))) {
+ push @$log, "[".$$package->name."]failed to download ".$tarballuri."\n";
+ unlink $tarball;
+ return;
+ }
+ }
+
+ foreach (`tar xfv $tarball 2>&1`) {
+ push @$log, $_;
+ $directory = $2 if /^(.\/|)(.*?)\//;
+ }
+ if (($? >> 8)!=0) {
+ push @$log, "[".$$package->name."]failed to untar\n";
+ `rm -rf $directory $tarball`;
+ return;
+ }
+ }
+
+ my $revBefore = getRev($$package->uri);
+ my $cmd = "svn export ".$$package->uri." $directory --force 2>&1";
+ push @$log, $_ foreach (`$cmd`);
+ if (($? >> 8)!=0) {
+ push @$log, "[".$$package->name."]failed to export ".$$package->uri."\n";
+ `rm -rf $directory $tarball`;
+ return;
+ }
+ my $revAfter = getRev($$package->uri);
+ # I record the revision so I will be able to write it in the DB
+ # with the build log
+ if ($revBefore ne $revAfter) {
+ push @$log, "svn revision changed during the svn export\n";
+ return;
+ }
+ #### to remove
+ if (open TMP, ">$directory/debian/rev") {
+ print TMP $revBefore;
+ close TMP;
+ } else {
+ push @$log, "failed to open $directory/debian/rev\n";
+ }
+ ################
+ if (open REV, ">".$$package->name."_".$$package->svndebrelease.".rev") {
+ print REV $revBefore;
+ close REV;
+ } else {
+ my $svndebrelease = $$package->realsvndebrelease;
+ $svndebrelease =~ s/^\d+://;
+
+ push @$log, "failed to open ".$$package->name."_".$svndebrelease.".rev\n";
+ }
+
+
+ push @$log, $_ foreach (`dpkg-source -b $directory 2>&1`);
+ if (($? >> 8)!=0) {
+ push @$log, "[".$$package->name."]failed to create .dsc\n";
+ `rm -rf $directory $tarball`;
+ return;
+ }
+
+ $$package->issrcinmypool(1);
+ $$package->update;
+
+ `rm -rf $directory`;
+ 1;
+}
+
+$config = new SvnBuildStat::Config();
+$schema = SvnBuildStat::Schema->connect(
+ $config->db_dsn,
+ $config->db_user,
+ $config->db_password,
+ {AutoCommit => 1, debug => 1}
+);
+
+purgeOutDated();
+updateIsSrcInMyPoolFromFiles();
+updateSources();
+
+unlink "lock.".$$;
+sleep 60;
Copied: svnbuildstat/trunk/svnbuildstat.conf (from rev 395, svnbuildstat/svnbuildstat.conf)
===================================================================
--- svnbuildstat/trunk/svnbuildstat.conf (rev 0)
+++ svnbuildstat/trunk/svnbuildstat.conf 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,18 @@
+[agent]
+ftphost = 127.0.0.1
+ftplogin = svnbuildstat
+ftppassword = svnbuildstat
+source = http://88.191.19.81:3000/packages/tobuild
+buildadminaddr = goneri at rulezlan.org
+vardir = /home/goneri/tmp/debpkgstatus
+debmirror = http://ftp.fr.debian.org/debian/
+
+[report]
+sourcedir = /home/svnbuildstat
+workdir = /tmp
+rejecteddir = /home/svnbuildstat/rejected
+
+[db]
+dsn = DBI:Pg:database=svnbuildstat;host=127.0.0.1
+user = svnbuildstat
+password = 'xxxxxx'
Copied: svnbuildstat/trunk/svnbuildstat_www.yml (from rev 395, svnbuildstat/svnbuildstat_www.yml)
===================================================================
--- svnbuildstat/trunk/svnbuildstat_www.yml (rev 0)
+++ svnbuildstat/trunk/svnbuildstat_www.yml 2007-09-29 23:13:59 UTC (rev 465)
@@ -0,0 +1,2 @@
+---
+name: SvnBuildStat::WWW
Copied: svnbuildstat/trunk/t (from rev 395, svnbuildstat/t)
More information about the Collab-qa-commits
mailing list