Changeset 273


Ignore:
Timestamp:
11/08/07 23:57:12 (6 years ago)
Author:
bruno
Message:

pb_env_init now creates a pbconf template dir if asked for (newproj option)

Location:
devel/pb
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r272 r273  
    101101 
    102102my ($pbrc, $filteredfiles, $defpkgdir, $extpkgdir); 
     103my $pbinit = undef; 
     104$pbinit = 1 if ($action =~ /^newproj$/); 
    103105 
    104106# Handles project name if any 
     
    106108if (defined $opts{'p'}) { 
    107109    ($ENV{'PBPROJ'},$debug,$LOG, $pbrc, $filteredfiles, $defpkgdir, $extpkgdir)  
    108     = pb_env_init($opts{'p'}); 
     110    = pb_env_init($opts{'p'},$pbinit); 
    109111} else { 
    110112    ($ENV{'PBPROJ'},$debug,$LOG, $pbrc, $filteredfiles, $defpkgdir, $extpkgdir)  
    111     = pb_env_init(); 
     113    = pb_env_init(undef,$pbinit); 
    112114} 
    113115 
     
    147149} elsif ($action =~ /^newvm$/) { 
    148150    pb_launchvm($ENV{'PBVM'},1); 
     151} elsif ($action =~ /^newproj$/) { 
     152    # Nothing to do - already done in pb_env_init 
    149153} elsif ($action =~ /^clean$/) { 
    150154} else { 
     
    910914    print "\t           from the current one                        \n"; 
    911915    print "\n"; 
    912 } 
     916    print "\tnewproj:   Create a new project and a template set of  \n"; 
     917    print "\t           configuration files under pbconf            \n"; 
     918    print "\n"; 
     919} 
  • devel/pb/lib/ProjectBuilder/Base.pm

    r265 r273  
    2020sub pb_env_init { 
    2121 
    22 my $proj=shift; 
     22my $proj=shift || undef; 
     23my $pbinit=shift || undef; 
    2324my $ver; 
    2425my $tag; 
     
    5758# Set delivery directory 
    5859# 
     60if (not defined ($pbrc{$proj})) { 
     61    die "Please create a pbrc reference for project $proj in $ENV{'PBETC'}\n"; 
     62} 
     63 
    5964my $topdir=dirname($pbrc{$proj}); 
    6065# Expand potential env variable in it 
     
    8287# 
    8388$ENV{'PBCONF'} = "$ENV{'PBROOT'}/pbconf"; 
     89if (defined $pbinit) { 
     90    print $LOG "Creating $ENV{'PBCONF'} directory\n"; 
     91    pb_mkdir_p("$ENV{'PBCONF'}"); 
     92    } 
    8493die "Project $proj not Project-Builder compliant. Please populate $ENV{'PBCONF'}" if ( not -d "$ENV{'PBCONF'}"); 
    8594 
     
    8998my %filteredfiles = (); 
    9099 
    91 if (-f "$ENV{'PBCONF'}/$proj.pb") { 
     100if ((-f "$ENV{'PBCONF'}/$proj.pb") and (not defined $pbinit)) { 
    92101    # List of pkg to build by default (mandatory) 
    93102    # List of additional pkg to build when all is called (optional) 
     
    129138    die "Invalid tag name $ENV{'PBTAG'} in $ENV{'PBCONF'}/$proj.pb" if ($ENV{'PBTAG'} !~ /[0-9.]+/); 
    130139} else { 
    131     die "Unable to open $ENV{'PBCONF'}/$proj.pb"; 
     140    if (defined $pbinit) { 
     141        open(CONF,"> $ENV{'PBCONF'}/$proj.pb") || die "Unable to create $ENV{'PBCONF'}/$proj.pb"; 
     142        print CONF << "EOF"; 
     143# 
     144# Project Builder configuration file 
     145# For project $proj 
     146# 
     147# \$Id\$ 
     148# 
     149 
     150# 
     151# Which CMS system is used (Subversion, CVS or tar file content extracted) 
     152# 
     153#cms $proj = svn 
     154#cms $proj = cvs 
     155#cms $proj = flat 
     156 
     157# 
     158# Packager label 
     159# 
     160#packager $proj = "William Porte <bill\@$proj.org>" 
     161# 
     162 
     163# For delivery to a machine by SSH (potentially the FTP server) 
     164# Needs hostname, account and directory 
     165# 
     166#sshhost $proj = www.$proj.org 
     167#sshlogin $proj = bill 
     168#sshdir $proj = /$proj/ftp 
     169#sshport $proj = 22 
     170 
     171# 
     172# For Virtual machines management 
     173# Naming convention to follow: distribution name (as per ProjectBuilder::Distribution) 
     174# followed by '_' and by release number 
     175# a .vmtype extension will be added to the resulting string 
     176# a QEMU rhel_3 here means that the VM will be named rhel_3.qemu 
     177# 
     178#vmlist pb = mandrake_10.1,mandrake_10.2,mandriva_2006.0,mandriva_2007.0,mandriva_2007.1,mandriva_2008.0,redhat_7.3,redhat_9,fedora_4,fedora_5,fedora_6,fedora_7,rhel_3,rhel_4,rhel_5,suse_10.0,suse_10.1,suse_10.2,suse_10.3,sles_9,sles_10,gentoo_nover,debian_3.1,debian_4.0,ubuntu_6.06,ubuntu_7.04,ubuntu_7.10 
     179 
     180# 
     181# Valid values for vmtype are 
     182# qemu, (vmware, xen, ... TBD) 
     183#vmtype $proj = qemu 
     184 
     185# Hash for VM stuff on vmtype 
     186#vmntp default = pool.ntp.org 
     187 
     188# We suppose we can commmunicate with the VM through SSH 
     189#vmhost pb = localhost 
     190#vmlogin pb = pb 
     191#vmport pb = 2222 
     192 
     193# Timeout to wait when VM is launched/stopped 
     194#vmtmout default = 120 
     195 
     196# per VMs needed paramaters 
     197#vmopt pb = -m 384 -daemonize 
     198#vmpath pb = /home/qemu 
     199#vmsize pb = 5G 
     200 
     201# 
     202# Global version/tag for the project 
     203# 
     204#projver $proj = devel 
     205#projtag $proj = 1 
     206 
     207# Adapt to your needs: 
     208# Optional if you need to overwrite the global values above 
     209# 
     210#pkgver pkg1 = stable 
     211#pkgtag pkg1 = 3 
     212#pkgver nil 
     213#pkgtag nil 
     214 
     215# Hash of default package/package directory 
     216#defpkgdir pkg1 = pkg1dir 
     217 
     218# Hash of additional package/package directory 
     219#extpkgdir pkg1-doc = pkg1-docdir 
     220 
     221# Hash of valid version names 
     222#version devel 
     223#version stable 
     224 
     225# List of files per pkg on which to apply filters 
     226# Files are mentioned relatively to pbroot/defpkgdir 
     227#filteredfiles pkg1 = Makefile.PL 
     228#filteredfiles pkg1-doc = configure.in 
     229EOF 
     230        close(CONF); 
     231        pb_mkdir_p("$ENV{'PBCONF'}/pbfilter") || die "Unable to create $ENV{'PBCONF'}/pbfilter"; 
     232        open(CONF,"> $ENV{'PBCONF'}/pbfilter/all.pbf") || die "Unable to create $ENV{'PBCONF'}/pbfilter/all.pbf"; 
     233        print CONF << "EOF"; 
     234# 
     235# \$Id\$ 
     236# 
     237# Filter for all files 
     238# 
     239# PBSRC is replaced by the source package format 
     240#filter PBSRC = ftp://ftp.$proj.org/src/%{name}-%{version}.tar.gz 
     241 
     242# PBVER is replaced by the version (\$pbver in code) 
     243#filter PBVER = \$pbver 
     244 
     245# PBDATE is replaced by the date (\$pbdate in code) 
     246#filter PBDATE = \$pbdate 
     247 
     248# PBLOG is replaced by the changelog if value is yes 
     249#filter PBLOG = yes 
     250 
     251# PBTAG is replaced by the tag (\$pbtag in code) 
     252#filter PBTAG = \$pbtag 
     253 
     254# PBREV is replaced by the revision (\$pbrev in code) 
     255#filter PBREV = \$pbrev 
     256 
     257# PBPKG is replaced by the package name (\$pbpkg in code) 
     258#filter PBPKG = \$pbpkg 
     259 
     260# PBPACKAGER is replaced by the packager name (\$pbpackager in code) 
     261#filter PBPACKAGER = \$pbpackager 
     262 
     263# PBDESC contains the description of the package 
     264#filter PBDESC = "Bla-Bla" 
     265 
     266# PBURL contains the URL of the Web site of the project 
     267#filter PBURL = http://www.$proj.org 
     268EOF 
     269        close(CONF); 
     270        open(CONF,"> $ENV{'PBCONF'}/pbfilter/rpm.pbf") || die "Unable to create $ENV{'PBCONF'}/pbfilter/rpm.pbf"; 
     271        print CONF << "EOF"; 
     272# 
     273# \$Id\$ 
     274# 
     275# Filter for rpm build 
     276# 
     277 
     278# PBGRP is replaced by the RPM group of apps 
     279#filter PBGRP = Applications/Archiving 
     280 
     281# PBDEP is replaced by the list of dependencies 
     282#filter PBDEP = 
     283 
     284# PBSUF is replaced by the package name (\$pbpkg in code) 
     285#filter PBSUF = \$pbsuf 
     286 
     287# PBOBS is replaced by the Obsolete line 
     288#filter PBOBS = 
     289 
     290EOF 
     291        close(CONF); 
     292        open(CONF,"> $ENV{'PBCONF'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBCONF'}/pbfilter/deb.pbf"; 
     293        print CONF << "EOF"; 
     294# 
     295# \$Id\$ 
     296# 
     297# Filter for debian build 
     298# 
     299# PBGRP is replaced by the group of apps 
     300#filter PBGRP = utils 
     301 
     302# PBVER is replaced by the version (\$pbver in code) 
     303#filter PBVER = \$pbver 
     304 
     305# PBDEP is replaced by the list of dependencies 
     306#filter PBDEP = 
     307 
     308# PBSUG is replaced by the list of suggestions 
     309#filter PBSUG = 
     310 
     311# PBREC is replaced by the list of recommandations 
     312#filter PBREC = 
     313 
     314# PBLOG is replaced by the changelog if value is yes 
     315#filter PBLOG = yes 
     316 
     317# PBPKG is replaced by the package name (\$pbpkg in code) 
     318#filter PBPKG = \$pbpkg 
     319 
     320# PBPACKAGER is replaced by the packager name (\$pbpackager in code) 
     321#filter PBPACKAGER = \$pbpackager 
     322 
     323EOF 
     324        close(CONF); 
     325        open(CONF,"> $ENV{'PBCONF'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBCONF'}/pbfilter/md.pbf"; 
     326        print CONF << "EOF"; 
     327# Specific group for Mandriva for $proj 
     328filter PBGRP = Archiving/Backup 
     329EOF 
     330        close(CONF); 
     331        open(CONF,"> $ENV{'PBCONF'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBCONF'}/pbfilter/novell.pbf"; 
     332        print CONF << "EOF"; 
     333# Specific group for SuSE for $proj 
     334filter PBGRP = Productivity/Archiving/Backup 
     335EOF 
     336        close(CONF); 
     337        pb_mkdir_p("$ENV{'PBCONF'}/pkg1/deb") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb"; 
     338        open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/control") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/control"; 
     339        print CONF << "EOF"; 
     340Source: PBPKG 
     341Section: PBGRP 
     342Priority: optional 
     343Maintainer: PBPACKAGER 
     344Build-Depends: debhelper (>= 4.2.20), PBDEP 
     345Standards-Version: 3.6.1 
     346 
     347Package: PBPKG 
     348Architecture: amd64 i386 ia64 
     349Section: PBGRP 
     350Priority: optional 
     351Depends: \${shlibs:Depends}, \${misc:Depends}, PBDEP 
     352Recommends: PBREC 
     353Suggests: PBSUG 
     354Description:  
     355 PBDESC 
     356 . 
     357 Homepage: PBURL 
     358 
     359EOF 
     360        close(CONF); 
     361        open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/copyright") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/copyright"; 
     362        print CONF << "EOF"; 
     363This package is debianized by PBPACKAGER 
     364`date` 
     365 
     366The current upstream source was downloaded from 
     367ftp://ftp.$proj.org/src/. 
     368 
     369Upstream Authors: Put their name here 
     370 
     371Copyright: 
     372 
     373   This package is free software; you can redistribute it and/or modify 
     374   it under the terms of the GNU General Public License as published by 
     375   the Free Software Foundation; version 2 dated June, 1991. 
     376 
     377   This package is distributed in the hope that it will be useful, 
     378   but WITHOUT ANY WARRANTY; without even the implied warranty of 
     379   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     380   GNU General Public License for more details. 
     381 
     382   You should have received a copy of the GNU General Public License 
     383   along with this package; if not, write to the Free Software 
     384   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 
     385   MA 02110-1301, USA. 
     386 
     387On Debian systems, the complete text of the GNU General 
     388Public License can be found in /usr/share/common-licenses/GPL. 
     389 
     390EOF 
     391        close(CONF); 
     392        open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/changelog") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/changelog"; 
     393        print CONF << "EOF"; 
     394PBLOG 
     395EOF 
     396        close(CONF); 
     397        open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/compat") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/compat"; 
     398        print CONF << "EOF"; 
     3994 
     400EOF 
     401        close(CONF); 
     402        open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/pkg1.dirs") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/pkg1.dirs"; 
     403        print CONF << "EOF"; 
     404EOF 
     405        close(CONF); 
     406        open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/pkg1.docs") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/pkg1.docs"; 
     407        print CONF << "EOF"; 
     408INSTALL 
     409COPYING 
     410AUTHORS 
     411NEWS 
     412README 
     413EOF 
     414        close(CONF); 
     415        open(CONF,"> $ENV{'PBCONF'}/pkg1/deb/rules") || die "Unable to create $ENV{'PBCONF'}/pkg1/deb/rules"; 
     416        print CONF << 'EOF'; 
     417#!/usr/bin/make -f 
     418# -*- makefile -*- 
     419# Sample debian/rules that uses debhelper. 
     420# GNU copyright 1997 to 1999 by Joey Hess. 
     421# 
     422# $Id$ 
     423# 
     424 
     425# Uncomment this to turn on verbose mode. 
     426#export DH_VERBOSE=1 
     427 
     428# Define package name variable for a one-stop change. 
     429PACKAGE_NAME = PBPKG 
     430 
     431# These are used for cross-compiling and for saving the configure script 
     432# from having to guess our platform (since we know it already) 
     433DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) 
     434DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) 
     435 
     436CFLAGS = -Wall -g 
     437 
     438ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) 
     439        CFLAGS += -O0 
     440else 
     441        CFLAGS += -O2 
     442endif 
     443ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) 
     444        INSTALL_PROGRAM += -s 
     445endif 
     446config.status: configure 
     447        dh_testdir 
     448 
     449        # Configure the package. 
     450        CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr 
     451 --mandir=\$${prefix}/share/man 
     452 
     453# Build both architecture dependent and independent 
     454build: build-arch build-indep 
     455 
     456# Build architecture dependent 
     457build-arch: build-arch-stamp 
     458 
     459build-arch-stamp:  config.status 
     460        dh_testdir 
     461 
     462        # Compile the package. 
     463        $(MAKE) 
     464 
     465        touch build-stamp 
     466 
     467# Build architecture independent 
     468build-indep: build-indep-stamp 
     469 
     470build-indep-stamp:  config.status 
     471        # Nothing to do, the only indep item is the manual which is available as html in original source 
     472        touch build-indep-stamp 
     473 
     474# Clean up 
     475clean: 
     476        dh_testdir 
     477        dh_testroot 
     478        rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP# 
     479        # Clean temporary document directory 
     480        rm -rf debian/doc-temp 
     481        # Clean up. 
     482        -$(MAKE) distclean 
     483        rm -f config.log 
     484ifneq "$(wildcard /usr/share/misc/config.sub)" "" 
     485        cp -f /usr/share/misc/config.sub config.sub 
     486endif 
     487ifneq "$(wildcard /usr/share/misc/config.guess)" "" 
     488        cp -f /usr/share/misc/config.guess config.guess 
     489endif 
     490 
     491        dh_clean 
     492 
     493# Install architecture dependent and independent 
     494install: install-arch install-indep 
     495 
     496# Install architecture dependent 
     497install-arch: build-arch 
     498        dh_testdir 
     499        dh_testroot 
     500        dh_clean -k -s 
     501        dh_installdirs -s 
     502 
     503        # Install the package files into build directory: 
     504        # - start with upstream make install 
     505        $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE_NAME)/usr mandir=$(CURDIR)/debian/$(PACKAGE_NAME)/us 
     506r/share/man 
     507        # - copy html manual to temporary location for renaming 
     508        mkdir -p debian/doc-temp 
     509        dh_install -s 
     510 
     511# Install architecture independent 
     512install-indep: build-indep 
     513        dh_testdir 
     514        dh_testroot 
     515        dh_clean -k -i 
     516        dh_installdirs -i 
     517        dh_install -i 
     518 
     519# Must not depend on anything. This is to be called by 
     520# binary-arch/binary-indep 
     521# in another 'make' thread. 
     522binary-common: 
     523        dh_testdir 
     524        dh_testroot 
     525        dh_installchangelogs ChangeLog 
     526        dh_installdocs 
     527        dh_installman 
     528        dh_link 
     529        dh_strip 
     530        dh_compress 
     531        dh_fixperms 
     532        dh_installdeb 
     533        dh_shlibdeps 
     534        dh_gencontrol 
     535        dh_md5sums 
     536        dh_builddeb 
     537 
     538# Build architecture independant packages using the common target. 
     539binary-indep: build-indep install-indep 
     540        $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common 
     541 
     542# Build architecture dependant packages using the common target. 
     543binary-arch: build-arch install-arch 
     544        $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common 
     545 
     546# Build architecture depdendent and independent packages 
     547binary: binary-arch binary-indep 
     548.PHONY: clean binary 
     549 
     550EOF 
     551        close(CONF); 
     552        pb_mkdir_p("$ENV{'PBCONF'}/pkg1/rpm") || die "Unable to create $ENV{'PBCONF'}/pkg1/rpm"; 
     553        open(CONF,"> $ENV{'PBCONF'}/pkg1/rpm/pkg1.spec") || die "Unable to create $ENV{'PBCONF'}/pkg1/rpm/pkg1.spec"; 
     554        print CONF << 'EOF'; 
     555# 
     556# $Id$ 
     557# 
     558 
     559Summary:        bla-bla 
     560Summary(fr):    french bla-bla 
     561 
     562Name:           PBPKG 
     563Version:        PBVER 
     564Release:        PBTAGPBSUF 
     565License:        GPL 
     566Group:          PBGRP 
     567Url:            PBURL 
     568Source:         PBSRC 
     569BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n) 
     570Requires:       PBDEP 
     571 
     572%description 
     573PBDESC 
     574 
     575%description -l fr 
     576french desc 
     577 
     578%prep 
     579%setup -q 
     580 
     581%build 
     582%configure 
     583make %{?_smp_mflags} VERSION=%{version} 
     584 
     585%install 
     586%{__rm} -rf $RPM_BUILD_ROOT 
     587make DESTDIR=$RPM_BUILD_ROOT install 
     588 
     589%clean 
     590%{__rm} -rf $RPM_BUILD_ROOT 
     591 
     592%files 
     593%defattr(-,root,root) 
     594%doc ChangeLog 
     595%doc INSTALL COPYING README AUTHORS NEWS 
     596 
     597%changelog 
     598PBLOG 
     599 
     600EOF 
     601        close(CONF); 
     602        pb_mkdir_p("$ENV{'PBCONF'}/pkg1/pbfilter") || die "Unable to create $ENV{'PBCONF'}/pkg1/pbfilter"; 
     603 
     604        print "\nDo not to forget to commit the pbconf directory in your CMS if needed\n"; 
     605        print "After having renamed the pkg1 directory to your package's name      \n\n"; 
     606    } else { 
     607        die "Unable to open $ENV{'PBCONF'}/$proj.pb"; 
     608    } 
    132609} 
    133610 
  • devel/pb/lib/ProjectBuilder/Changelog.pm

    r255 r273  
    11#!/usr/bin/perl -w 
    22# 
    3 # Creates changelog for packages from Changelog files in the apps 
     3# Creates all changelog for packages from a single Changelog files in pbconf 
    44# 
    55# $Id$ 
Note: See TracChangeset for help on using the changeset viewer.