Changeset 416 in ProjectBuilder for devel/pb/bin
- Timestamp:
- Apr 27, 2008, 12:05:30 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r415 r416 25 25 use ProjectBuilder::Distribution; 26 26 use ProjectBuilder::CMS; 27 use ProjectBuilder::Env; 27 28 use ProjectBuilder::Filter; 28 29 … … 1643 1644 } 1644 1645 1645 sub pb_env_init {1646 1647 my $proj=shift || undef;1648 my $pbinit=shift || undef;1649 my $action=shift;1650 my $ver;1651 my $tag;1652 1653 $ENV{'PBETC'} = "$ENV{'HOME'}/.pbrc";1654 1655 # We only have one configuration file for now.1656 pb_conf_init("$ENV{'PBETC'}");1657 1658 #1659 # Check project name1660 # Could be with env var PBPROJ1661 # or option -p1662 # if not define take the first in conf file1663 #1664 if ((defined $ENV{'PBPROJ'}) &&1665 (not (defined $proj))) {1666 $proj = $ENV{'PBPROJ'};1667 }1668 1669 #1670 # We get the pbconf file for that project1671 # and use its content1672 #1673 my ($pbconf) = pb_conf_get("pbconfurl");1674 pb_log(2,"DEBUG pbconfurl: ".Dumper($pbconf)."\n");1675 1676 my %pbconf = %$pbconf;1677 if (not defined $proj) {1678 # Take the first as the default project1679 $proj = (keys %pbconf)[0];1680 if (defined $proj) {1681 pb_log(1,"WARNING: using $proj as default project as none has been specified\n");1682 pb_log(1," Please either create a pbconfurl reference for project $proj in $ENV{'PBETC'}\n");1683 pb_log(1," or call pb with the -p project option or use the env var PBPROJ\n");1684 pb_log(1," if you want to use another project\n");1685 }1686 }1687 die "No project defined - use env var PBPROJ or -p proj or a pbconfurl entry in $ENV{'PBETC'}" if (not (defined $proj));1688 1689 # That's always the environment variable that will be used1690 $ENV{'PBPROJ'} = $proj;1691 pb_log(2,"PBPROJ: $ENV{'PBPROJ'}\n");1692 1693 if (not defined ($pbconf{$ENV{'PBPROJ'}})) {1694 die "Please create a pbconfurl reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n";1695 }1696 1697 # Adds a potential conf file now as it's more1698 # important than the project conf file1699 my ($vmpath,$vepath) = pb_conf_get("vmpath","vepath");1700 pb_conf_add("$vmpath->{$ENV{'PBPROJ'}}/.pbrc") if (-f "$vmpath->{$ENV{'PBPROJ'}}/.pbrc");1701 pb_conf_add("$vepath->{$ENV{'PBPROJ'}}/.pbrc") if (-f "$vepath->{$ENV{'PBPROJ'}}/.pbrc");1702 1703 #1704 # Detect the root dir for hosting all the content generated with pb1705 #1706 # Tree will look like this:1707 #1708 # maint pbdefdir PBDEFDIR dev dir (optional)1709 # | |1710 # ------------------------ --------------------1711 # | | | |1712 # pbproj1 pbproj2 PBPROJ pbproj1 pbproj2 PBPROJDIR1713 # | |1714 # --------------------------------------------- ----------1715 # * * * | | | * *1716 # tag dev pbconf ... build delivery PBCONFDIR dev tag1717 # | | | PBDESTDIR |1718 # --- ------ pbrc PBBUILDDIR -------1719 # | | | | |1720 # 1.1 dev tag 1.0 1.1 PBDIR1721 # |1722 # -------1723 # | |1724 # 1.0 1.1 PBROOTDIR1725 # |1726 # ----------------------------------1727 # | | | |1728 # pkg1 pbproj1.pb pbfilter pbcl1729 # |1730 # -----------------1731 # | | |1732 # rpm deb pbfilter1733 #1734 #1735 # (*) By default, if no relocation in .pbrc, dev dir is taken in the maint pbdefdir (when appropriate)1736 # Names under a pbproj and the corresponding pbconf should be similar1737 #1738 1739 my ($pbdefdir) = pb_conf_get_if("pbdefdir");1740 1741 if (not defined $ENV{'PBDEFDIR'}) {1742 if ((not defined $pbdefdir) || (not defined $pbdefdir->{$ENV{'PBPROJ'}})) {1743 pb_log(1,"WARNING: no pbdefdir defined, using /var/cache\n");1744 pb_log(1," Please create a pbdefdir reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n");1745 pb_log(1," if you want to use another directory\n");1746 $ENV{'PBDEFDIR'} = "/var/cache";1747 } else {1748 # That's always the environment variable that will be used1749 $ENV{'PBDEFDIR'} = $pbdefdir->{$ENV{'PBPROJ'}};1750 }1751 }1752 # Expand potential env variable in it1753 eval { $ENV{'PBDEFDIR'} =~ s/(\$ENV.+\})/$1/eeg };1754 1755 pb_log(2,"PBDEFDIR: $ENV{'PBDEFDIR'}\n");1756 #1757 # Set delivery directory1758 #1759 $ENV{'PBDESTDIR'}="$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/delivery";1760 1761 pb_log(2,"PBDESTDIR: $ENV{'PBDESTDIR'}\n");1762 #1763 # Removes all directory existing below the delivery dir1764 # as they are temp dir only1765 # Files stay and have to be cleaned up manually if needed1766 # those files serves as communication channels between pb phases1767 # Removing them prevents a following phase to detect what has been done before1768 #1769 if (-d $ENV{'PBDESTDIR'}) {1770 opendir(DIR,$ENV{'PBDESTDIR'}) || die "Unable to open directory $ENV{'PBDESTDIR'}: $!";1771 foreach my $d (readdir(DIR)) {1772 next if ($d =~ /^\./);1773 next if (-f "$ENV{'PBDESTDIR'}/$d");1774 pb_rm_rf("$ENV{'PBDESTDIR'}/$d") if (-d "$ENV{'PBDESTDIR'}/$d");1775 }1776 closedir(DIR);1777 }1778 if (! -d "$ENV{'PBDESTDIR'}") {1779 pb_mkdir_p($ENV{'PBDESTDIR'}) || die "Unable to recursively create $ENV{'PBDESTDIR'}";1780 }1781 1782 #1783 # Set build directory1784 #1785 $ENV{'PBBUILDDIR'}="$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/build";1786 if (! -d "$ENV{'PBBUILDDIR'}") {1787 pb_mkdir_p($ENV{'PBBUILDDIR'}) || die "Unable to recursively create $ENV{'PBBUILDDIR'}";1788 }1789 1790 pb_log(2,"PBBUILDDIR: $ENV{'PBBUILDDIR'}\n");1791 1792 pb_temp_init();1793 pb_log(2,"PBTMP: $ENV{'PBTMP'}\n");1794 1795 #1796 # The following part is only useful when in cms2something of newver1797 # In VMs/VEs we want to skip that by providing good env vars.1798 # return values in that case are useless1799 #1800 if (($action =~ /^cms2/) || ($action =~ /^newver$/)) {1801 1802 #1803 # Check pbconf cms compliance1804 #1805 pb_cms_compliant("pbconfdir",'PBCONFDIR',"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/pbconf",$pbconf{$ENV{'PBPROJ'}},$pbinit);1806 1807 # Check where is our PBROOTDIR (release tag name can't be guessed the first time)1808 #1809 if (not defined $ENV{'PBROOTDIR'}) {1810 if (! -f ("$ENV{'PBDESTDIR'}/pbrc")) {1811 opendir(DIR,$ENV{'PBCONFDIR'}) || die "Unable to open directory $ENV{'PBCONFDIR'}: $!";1812 my $maxmtime = 0;1813 foreach my $d (readdir(DIR)) {1814 pb_log(3,"Looking at \'$d\'...");1815 next if ($d =~ /^\./);1816 next if (! -d "$ENV{'PBCONFDIR'}/$d");1817 my $s = stat("$ENV{'PBCONFDIR'}/$d");1818 next if (not defined $s);1819 pb_log(3,"KEEP\n");1820 # Keep the most recent1821 pb_log(2," $s->mtime\n");1822 if ($s->mtime > $maxmtime) {1823 $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$d";1824 $maxmtime = $s->mtime;1825 }1826 }1827 closedir(DIR);1828 die "No directory found under $ENV{'PBCONFDIR'}" if (not defined $ENV{'PBROOTDIR'});1829 pb_log(1,"WARNING: no pbroot defined, using $ENV{'PBROOTDIR'}\n");1830 pb_log(1," Please use -r release if you want to use another release\n");1831 } else {1832 my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot");1833 # That's always the environment variable that will be used1834 die "Please remove inconsistent $ENV{'PBDESTDIR'}/pbrc" if ((not defined $pbroot) || (not defined $pbroot->{$ENV{'PBPROJ'}}));1835 $ENV{'PBROOTDIR'} = $pbroot->{$ENV{'PBPROJ'}};1836 }1837 } else {1838 # transform in full path if relative1839 $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$ENV{'PBROOTDIR'}" if ($ENV{'PBROOTDIR'} !~ /^\//);1840 pb_mkdir_p($ENV{'PBROOTDIR'}) if (defined $pbinit);1841 die "$ENV{'PBROOTDIR'} is not a directory" if (not -d $ENV{'PBROOTDIR'});1842 }1843 1844 # Adds that conf file to the list to consider1845 pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") if (-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb");1846 1847 return if ($action =~ /^newver$/);1848 1849 my %version = ();1850 my %defpkgdir = ();1851 my %extpkgdir = ();1852 my %filteredfiles = ();1853 my %supfiles = ();1854 1855 if ((-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") and (not defined $pbinit)) {1856 1857 # List of pkg to build by default (mandatory)1858 my ($defpkgdir,$pbpackager, $pkgv, $pkgt) = pb_conf_get("defpkgdir","pbpackager","projver","projtag");1859 # List of additional pkg to build when all is called (optional)1860 # Valid version names (optional)1861 # List of files to filter (optional)1862 # Project version and tag (optional)1863 my ($extpkgdir, $version, $filteredfiles, $supfiles) = pb_conf_get_if("extpkgdir","version","filteredfiles","supfiles");1864 pb_log(2,"DEBUG: defpkgdir: ".Dumper($defpkgdir)."\n");1865 pb_log(2,"DEBUG: extpkgdir: ".Dumper($extpkgdir)."\n");1866 pb_log(2,"DEBUG: version: ".Dumper($version)."\n");1867 pb_log(2,"DEBUG: filteredfiles: ".Dumper($filteredfiles)."\n");1868 pb_log(2,"DEBUG: supfiles: ".Dumper($supfiles)."\n");1869 # Global1870 %defpkgdir = %$defpkgdir;1871 %extpkgdir = %$extpkgdir if (defined $extpkgdir);1872 %version = %$version if (defined $version);1873 %filteredfiles = %$filteredfiles if (defined $filteredfiles);1874 %supfiles = %$supfiles if (defined $supfiles);1875 #1876 # Get global Version/Tag1877 #1878 if (not defined $ENV{'PBPROJVER'}) {1879 if ((defined $pkgv) && (defined $pkgv->{$ENV{'PBPROJ'}})) {1880 $ENV{'PBPROJVER'}=$pkgv->{$ENV{'PBPROJ'}};1881 } else {1882 die "No projver found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";1883 }1884 }1885 die "Invalid version name $ENV{'PBPROJVER'} in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb" if (($ENV{'PBPROJVER'} !~ /[0-9.]+/) && (not defined $version) && ($ENV{'PBPROJVER'} =~ /$version{$ENV{'PBPROJ'}}/));1886 1887 if (not defined $ENV{'PBPROJTAG'}) {1888 if ((defined $pkgt) && (defined $pkgt->{$ENV{'PBPROJ'}})) {1889 $ENV{'PBPROJTAG'}=$pkgt->{$ENV{'PBPROJ'}};1890 } else {1891 die "No projtag found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";1892 }1893 }1894 die "Invalid tag name $ENV{'PBPROJTAG'} in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb" if ($ENV{'PBPROJTAG'} !~ /[0-9.]+/);1895 1896 1897 if (not defined $ENV{'PBPACKAGER'}) {1898 if ((defined $pbpackager) && (defined $pbpackager->{$ENV{'PBPROJ'}})) {1899 $ENV{'PBPACKAGER'}=$pbpackager->{$ENV{'PBPROJ'}};1900 } else {1901 die "No pbpackager found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";1902 }1903 }1904 } else {1905 if (defined $pbinit) {1906 my $ptr = pb_get_pkg();1907 my @pkgs = @$ptr;1908 @pkgs = ("pkg1") if (not @pkgs);1909 1910 open(CONF,"> $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";1911 print CONF << "EOF";1912 #1913 # Project Builder configuration file1914 # For project $ENV{'PBPROJ'}1915 #1916 # \$Id\$1917 #1918 1919 #1920 # What is the project URL1921 #1922 #pburl $ENV{'PBPROJ'} = svn://svn.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel1923 #pburl $ENV{'PBPROJ'} = svn://svn+ssh.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel1924 #pburl $ENV{'PBPROJ'} = cvs://cvs.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel1925 #pburl $ENV{'PBPROJ'} = http://www.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz1926 #pburl $ENV{'PBPROJ'} = ftp://ftp.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz1927 #pburl $ENV{'PBPROJ'} = file:///src/$ENV{'PBPROJ'}-devel.tar.gz1928 #pburl $ENV{'PBPROJ'} = dir:///src/$ENV{'PBPROJ'}-devel1929 1930 # Check whether project is well formed1931 # (containing already a directory with the project-version name)1932 #pbwf $ENV{'PBPROJ'} = 11933 1934 #1935 # Packager label1936 #1937 #pbpackager $ENV{'PBPROJ'} = William Porte <bill\@$ENV{'PBPROJ'}.org>1938 #1939 1940 # For delivery to a machine by SSH (potentially the FTP server)1941 # Needs hostname, account and directory1942 #1943 #sshhost $ENV{'PBPROJ'} = www.$ENV{'PBPROJ'}.org1944 #sshlogin $ENV{'PBPROJ'} = bill1945 #sshdir $ENV{'PBPROJ'} = /$ENV{'PBPROJ'}/ftp1946 #sshport $ENV{'PBPROJ'} = 221947 1948 #1949 # For Virtual machines management1950 # Naming convention to follow: distribution name (as per ProjectBuilder::Distribution)1951 # followed by '-' and by release number1952 # followed by '-' and by architecture1953 # a .vmtype extension will be added to the resulting string1954 # a QEMU rhel-3-i286 here means that the VM will be named rhel-3-i386.qemu1955 #1956 #vmlist $ENV{'PBPROJ'} = mandrake-10.1-i386,mandrake-10.2-i386,mandriva-2006.0-i386,mandriva-2007.0-i386,mandriva-2007.1-i386,mandriva-2008.0-i386,redhat-7.3-i386,redhat-9-i386,fedora-4-i386,fedora-5-i386,fedora-6-i386,fedora-7-i386,fedora-8-i386,rhel-3-i386,rhel-4-i386,rhel-5-i386,suse-10.0-i386,suse-10.1-i386,suse-10.2-i386,suse-10.3-i386,sles-9-i386,sles-10-i386,gentoo-nover-i386,debian-3.1-i386,debian-4.0-i386,ubuntu-6.06-i386,ubuntu-7.04-i386,ubuntu-7.10-i386,mandriva-2007.0-x86_64,mandriva-2007.1-x86_64,mandriva-2008.0-x86_64,fedora-6-x86_64,fedora-7-x86_64,fedora-8-x86_64,rhel-4-x86_64,rhel-5-x86_64,suse-10.2-x86_64,suse-10.3-x86_64,sles-10-x86_64,gentoo-nover-x86_64,debian-4.0-x86_64,ubuntu-7.04-x86_64,ubuntu-7.10-x86_641957 1958 #1959 # Valid values for vmtype are1960 # qemu, (vmware, xen, ... TBD)1961 #vmtype $ENV{'PBPROJ'} = qemu1962 1963 # Hash for VM stuff on vmtype1964 #vmntp default = pool.ntp.org1965 1966 # We suppose we can commmunicate with the VM through SSH1967 #vmhost $ENV{'PBPROJ'} = localhost1968 #vmlogin $ENV{'PBPROJ'} = pb1969 #vmport $ENV{'PBPROJ'} = 22221970 1971 # Timeout to wait when VM is launched/stopped1972 #vmtmout default = 1201973 1974 # per VMs needed paramaters1975 #vmopt $ENV{'PBPROJ'} = -m 384 -daemonize1976 #vmpath $ENV{'PBPROJ'} = /home/qemu1977 #vmsize $ENV{'PBPROJ'} = 5G1978 1979 #1980 # For Virtual environment management1981 # Naming convention to follow: distribution name (as per ProjectBuilder::Distribution)1982 # followed by '-' and by release number1983 # followed by '-' and by architecture1984 # a .vetype extension will be added to the resulting string1985 # a chroot rhel-3-i286 here means that the VE will be named rhel-3-i386.chroot1986 #1987 #velist $ENV{'PBPROJ'} = fedora-7-i3861988 1989 # VE params1990 #vetype $ENV{'PBPROJ'} = chroot1991 #ventp default = pool.ntp.org1992 #velogin $ENV{'PBPROJ'} = pb1993 #vepath $ENV{'PBPROJ'} = /var/lib/mock1994 #veconf $ENV{'PBPROJ'} = /etc/mock1995 #verebuild $ENV{'PBPROJ'} = false1996 1997 #1998 # Global version/tag for the project1999 #2000 #projver $ENV{'PBPROJ'} = devel2001 #projtag $ENV{'PBPROJ'} = 12002 2003 # Hash of valid version names2004 #version $ENV{'PBPROJ'} = devel,stable2005 2006 # Adapt to your needs:2007 # Optional if you need to overwrite the global values above2008 #2009 EOF2010 2011 foreach my $pp (@pkgs) {2012 print CONF << "EOF";2013 #pkgver $pp = stable2014 #pkgtag $pp = 32015 EOF2016 }2017 foreach my $pp (@pkgs) {2018 print CONF << "EOF";2019 # Hash of default package/package directory2020 #defpkgdir $pp = dir-$pp2021 EOF2022 }2023 2024 print CONF << "EOF";2025 # Hash of additional package/package directory2026 #extpkgdir minor-pkg = dir-minor-pkg2027 2028 # List of files per pkg on which to apply filters2029 # Files are mentioned relatively to pbroot/defpkgdir2030 EOF2031 foreach my $pp (@pkgs) {2032 print CONF << "EOF";2033 #filteredfiles $pp = Makefile.PL,configure.in,install.sh,$pp.82034 #supfiles $pp = $pp.init2035 EOF2036 }2037 close(CONF);2038 pb_mkdir_p("$ENV{'PBROOTDIR'}/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter";2039 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/all.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/all.pbf";2040 print CONF << "EOF";2041 #2042 # \$Id\$2043 #2044 # Filter for all files2045 #2046 # PBSRC is replaced by the source package format2047 #filter PBSRC = ftp://ftp.$ENV{'PBPROJ'}.org/src/%{name}-%{version}.tar.gz2048 2049 # PBVER is replaced by the version (\$pbver in code)2050 filter PBVER = \$pbver2051 2052 # PBDATE is replaced by the date (\$pbdate in code)2053 filter PBDATE = \$pbdate2054 2055 # PBLOG is replaced by the changelog if value is yes2056 #filter PBLOG = yes2057 2058 # PBTAG is replaced by the tag (\$pbtag in code)2059 filter PBTAG = \$pbtag2060 2061 # PBREV is replaced by the revision (\$pbrev in code)2062 filter PBREV = \$pbrev2063 2064 # PBPKG is replaced by the package name (\$pbpkg in code)2065 filter PBPKG = \$pbpkg2066 2067 # PBPACKAGER is replaced by the packager name (\$pbpackager in code)2068 filter PBPACKAGER = \$pbpackager2069 2070 # PBDESC contains the description of the package2071 #filter PBDESC = "Bla-Bla"2072 2073 # PBURL contains the URL of the Web site of the project2074 #filter PBURL = http://www.$ENV{'PBPROJ'}.org2075 EOF2076 close(CONF);2077 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf";2078 print CONF << "EOF";2079 #2080 # \$Id\$2081 #2082 # Filter for rpm build2083 #2084 2085 # PBGRP is replaced by the RPM group of apps2086 # Cf: http://fedoraproject.org/wiki/RPMGroups2087 #filter PBGRP = Applications/Archiving2088 2089 # PBLIC is replaced by the license of the application2090 # Cf: http://fedoraproject.org/wiki/Licensing2091 #filter PBLIC = GPL2092 2093 # PBDEP is replaced by the list of dependencies2094 #filter PBDEP =2095 2096 # PBSUF is replaced by the package suffix (\$pbsuf in code)2097 filter PBSUF = \$pbsuf2098 2099 # PBOBS is replaced by the Obsolete line2100 #filter PBOBS =2101 2102 EOF2103 close(CONF);2104 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/deb.pbf";2105 print CONF << "EOF";2106 #2107 # \$Id\$2108 #2109 # Filter for debian build2110 #2111 # PBGRP is replaced by the group of apps2112 filter PBGRP = utils2113 2114 # PBLIC is replaced by the license of the application2115 # Cf:2116 #filter PBLIC = GPL2117 2118 # PBDEP is replaced by the list of dependencies2119 #filter PBDEP =2120 2121 # PBSUG is replaced by the list of suggestions2122 #filter PBSUG =2123 2124 # PBREC is replaced by the list of recommandations2125 #filter PBREC =2126 2127 EOF2128 close(CONF);2129 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/md.pbf";2130 print CONF << "EOF";2131 # Specific group for Mandriva for $ENV{'PBPROJ'}2132 # Cf: http://wiki.mandriva.com/en/Development/Packaging/Groups2133 #filter PBGRP = Archiving/Backup2134 2135 # PBLIC is replaced by the license of the application2136 # Cf: http://wiki.mandriva.com/en/Development/Packaging/Licenses2137 #filter PBLIC = GPL2138 2139 EOF2140 close(CONF);2141 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/novell.pbf";2142 print CONF << "EOF";2143 # Specific group for SuSE for $ENV{'PBPROJ'}2144 # Cf: http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups2145 #filter PBGRP = Productivity/Archiving/Backup2146 2147 # PBLIC is replaced by the license of the application2148 # Cf: http://en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.6._License_Tag2149 #filter PBLIC = GPL2150 2151 EOF2152 close(CONF);2153 foreach my $pp (@pkgs) {2154 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/deb") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb";2155 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/control") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/control";2156 print CONF << "EOF";2157 Source: PBPKG2158 Section: PBGRP2159 Priority: optional2160 Maintainer: PBPACKAGER2161 Build-Depends: debhelper (>= 4.2.20), PBDEP2162 Standards-Version: 3.6.12163 2164 Package: PBPKG2165 Architecture: amd64 i386 ia642166 Section: PBGRP2167 Priority: optional2168 Depends: \${shlibs:Depends}, \${misc:Depends}, PBDEP2169 Recommends: PBREC2170 Suggests: PBSUG2171 Description:2172 PBDESC2173 .2174 Homepage: PBURL2175 2176 EOF2177 close(CONF);2178 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/copyright") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/copyright";2179 print CONF << "EOF";2180 This package is debianized by PBPACKAGER2181 `date`2182 2183 The current upstream source was downloaded from2184 ftp://ftp.$ENV{'PBPROJ'}.org/src/.2185 2186 Upstream Authors: Put their name here2187 2188 Copyright:2189 2190 This package is free software; you can redistribute it and/or modify2191 it under the terms of the GNU General Public License as published by2192 the Free Software Foundation; version 2 dated June, 1991.2193 2194 This package is distributed in the hope that it will be useful,2195 but WITHOUT ANY WARRANTY; without even the implied warranty of2196 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2197 GNU General Public License for more details.2198 2199 You should have received a copy of the GNU General Public License2200 along with this package; if not, write to the Free Software2201 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,2202 MA 02110-1301, USA.2203 2204 On Debian systems, the complete text of the GNU General2205 Public License can be found in /usr/share/common-licenses/GPL.2206 2207 EOF2208 close(CONF);2209 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/changelog") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/changelog";2210 print CONF << "EOF";2211 PBLOG2212 EOF2213 close(CONF);2214 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/compat") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/compat";2215 print CONF << "EOF";2216 42217 EOF2218 close(CONF);2219 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs";2220 print CONF << "EOF";2221 EOF2222 close(CONF);2223 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs";2224 print CONF << "EOF";2225 INSTALL2226 COPYING2227 AUTHORS2228 NEWS2229 README2230 EOF2231 close(CONF);2232 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/rules") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/rules";2233 print CONF << 'EOF';2234 #!/usr/bin/make -f2235 # -*- makefile -*-2236 # Sample debian/rules that uses debhelper.2237 # GNU copyright 1997 to 1999 by Joey Hess.2238 #2239 # $Id$2240 #2241 2242 # Uncomment this to turn on verbose mode.2243 #export DH_VERBOSE=12244 2245 # Define package name variable for a one-stop change.2246 PACKAGE_NAME = PBPKG2247 2248 # These are used for cross-compiling and for saving the configure script2249 # from having to guess our platform (since we know it already)2250 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)2251 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)2252 2253 CFLAGS = -Wall -g2254 2255 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))2256 CFLAGS += -O02257 else2258 CFLAGS += -O22259 endif2260 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))2261 INSTALL_PROGRAM += -s2262 endif2263 config.status: configure2264 dh_testdir2265 2266 # Configure the package.2267 CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr2268 --mandir=\$${prefix}/share/man2269 2270 # Build both architecture dependent and independent2271 build: build-arch build-indep2272 2273 # Build architecture dependent2274 build-arch: build-arch-stamp2275 2276 build-arch-stamp: config.status2277 dh_testdir2278 2279 # Compile the package.2280 $(MAKE)2281 2282 touch build-stamp2283 2284 # Build architecture independent2285 build-indep: build-indep-stamp2286 2287 build-indep-stamp: config.status2288 # Nothing to do, the only indep item is the manual which is available as html in original source2289 touch build-indep-stamp2290 2291 # Clean up2292 clean:2293 dh_testdir2294 dh_testroot2295 rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#2296 # Clean temporary document directory2297 rm -rf debian/doc-temp2298 # Clean up.2299 -$(MAKE) distclean2300 rm -f config.log2301 ifneq "$(wildcard /usr/share/misc/config.sub)" ""2302 cp -f /usr/share/misc/config.sub config.sub2303 endif2304 ifneq "$(wildcard /usr/share/misc/config.guess)" ""2305 cp -f /usr/share/misc/config.guess config.guess2306 endif2307 2308 dh_clean2309 2310 # Install architecture dependent and independent2311 install: install-arch install-indep2312 2313 # Install architecture dependent2314 install-arch: build-arch2315 dh_testdir2316 dh_testroot2317 dh_clean -k -s2318 dh_installdirs -s2319 2320 # Install the package files into build directory:2321 # - start with upstream make install2322 $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE_NAME)/usr mandir=$(CURDIR)/debian/$(PACKAGE_NAME)/us2323 r/share/man2324 # - copy html manual to temporary location for renaming2325 mkdir -p debian/doc-temp2326 dh_install -s2327 2328 # Install architecture independent2329 install-indep: build-indep2330 dh_testdir2331 dh_testroot2332 dh_clean -k -i2333 dh_installdirs -i2334 dh_install -i2335 2336 # Must not depend on anything. This is to be called by2337 # binary-arch/binary-indep2338 # in another 'make' thread.2339 binary-common:2340 dh_testdir2341 dh_testroot2342 dh_installchangelogs ChangeLog2343 dh_installdocs2344 dh_installman2345 dh_link2346 dh_strip2347 dh_compress2348 dh_fixperms2349 dh_installdeb2350 dh_shlibdeps2351 dh_gencontrol2352 dh_md5sums2353 dh_builddeb2354 2355 # Build architecture independant packages using the common target.2356 binary-indep: build-indep install-indep2357 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common2358 2359 # Build architecture dependant packages using the common target.2360 binary-arch: build-arch install-arch2361 $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common2362 2363 # Build architecture depdendent and independent packages2364 binary: binary-arch binary-indep2365 .PHONY: clean binary2366 2367 EOF2368 close(CONF);2369 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/rpm") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm";2370 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec";2371 print CONF << 'EOF';2372 #2373 # $Id$2374 #2375 2376 Summary: bla-bla2377 Summary(fr): french bla-bla2378 2379 Name: PBPKG2380 Version: PBVER2381 Release: PBTAGPBSUF2382 License: PBLIC2383 Group: PBGRP2384 Url: PBURL2385 Source: PBSRC2386 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)2387 #Requires: PBDEP2388 2389 %description2390 PBDESC2391 2392 %description -l fr2393 french desc2394 2395 %prep2396 %setup -q2397 2398 %build2399 %configure2400 make %{?_smp_mflags}2401 2402 %install2403 %{__rm} -rf $RPM_BUILD_ROOT2404 make DESTDIR=$RPM_BUILD_ROOT install2405 2406 %clean2407 %{__rm} -rf $RPM_BUILD_ROOT2408 2409 %files2410 %defattr(-,root,root)2411 %doc ChangeLog2412 %doc INSTALL COPYING README AUTHORS NEWS2413 2414 %changelog2415 PBLOG2416 2417 EOF2418 close(CONF);2419 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pbfilter";2420 2421 pb_log(0,"\nDo not to forget to commit the pbconf directory in your CMS if needed\n");2422 }2423 } else {2424 die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";2425 }2426 }2427 umask 0022;2428 return(\%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);2429 } else {2430 # Setup the variables from what has been stored at the end of cms2build2431 my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbroot");2432 $ENV{'PBROOTDIR'} = $var->{$ENV{'PBPROJ'}};2433 2434 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projver");2435 $ENV{'PBPROJVER'} = $var->{$ENV{'PBPROJ'}};2436 2437 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projtag");2438 $ENV{'PBPROJTAG'} = $var->{$ENV{'PBPROJ'}};2439 2440 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbpackager");2441 $ENV{'PBPACKAGER'} = $var->{$ENV{'PBPROJ'}};2442 2443 return;2444 }2445 }2446 1646 2447 1647 #
Note:
See TracChangeset
for help on using the changeset viewer.