예제 #1
0
    def setupVars(self):
        # expects to be run from the Builder folder
        self.BUILDER_TOP_DIR = os.path.abspath('..')

        import brand_version
        vi = brand_version.VersionInfo(self.BUILDER_TOP_DIR, log.info)
        vi.parseVersionInfo(
            os.path.join(self.BUILDER_TOP_DIR, 'Builder/version_info.txt'))

        self.version = '%s.%s.%s' % (vi.get('major'), vi.get('minor'),
                                     vi.get('patch'))

        if self.copr_repo:
            self.MOCK_COPR_REPO_FILENAME = '/etc/yum.repos.d/_copr:copr.fedorainfracloud.org:barryascott:%s.repo' % (
                self.copr_repo, )

        if self.opt_mock_target is None:
            self.opt_mock_target = 'fedora-%d-%s' % (self.fedoraVersion(),
                                                     platform.machine())
            log.info('Defaulting --mock-target=%s' % (self.opt_mock_target, ))

        if self.copr_repo:
            self.COPR_REPO_URL = 'https://copr-be.cloud.fedoraproject.org/results/barryascott/%s/%s' % (
                self.copr_repo, self.opt_mock_target)
        if self.copr_repo_other:
            self.COPR_REPO_OTHER_URL = 'https://copr-be.cloud.fedoraproject.org/results/barryascott/%s/%s' % (
                self.copr_repo_other, self.opt_mock_target)

        if self.opt_release == 'auto':
            all_packages = package_list_repo.listRepo(self.COPR_REPO_URL)
            all_other_packages = package_list_repo.listRepo(
                self.COPR_REPO_OTHER_URL)

            package_ver = 0
            other_package_ver = 0

            if self.KITNAME in all_packages:
                ver, rel, build_time = all_packages[self.KITNAME]
                if ver == self.version:
                    package_ver = int(rel.split('.')[0])
                    log.info('Release %d found in %s' %
                             (package_ver, self.copr_repo))

            if self.KITNAME in all_other_packages:
                ver, rel, build_time = all_other_packages[self.KITNAME]
                if ver == self.version:
                    other_package_ver = int(rel.split('.')[0])
                    log.info('Release %d found in %s' %
                             (package_ver, self.copr_repo_other))

            self.opt_release = 1 + max(package_ver, other_package_ver)

            log.info('Release set to %d' % (self.opt_release, ))
예제 #2
0
    def ruleBrand(self):
        log.info('Running ruleBrand')
        import brand_version

        try:
            if self.opt_verbose:
                log_info = log.info
            else:
                log_info = logNothing

            self.bemacs_version_info = brand_version.VersionInfo(
                self.BUILDER_TOP_DIR, log_info)
            self.bemacs_version_info.parseVersionInfo('version_info.txt')
            finder = brand_version.FileFinder(self.bemacs_version_info)
            finder.findAndBrandFiles(self.BUILDER_TOP_DIR)

        except brand_version.Error as e:
            raise BuildError(str(e))
    def setupInnoItems(self):
        log.info('Create info_before.txt')

        BUILDER_TOP_DIR = os.environ['BUILDER_TOP_DIR']
        vi = brand_version.VersionInfo(BUILDER_TOP_DIR, print)
        vi.parseVersionInfo(
            os.path.join(BUILDER_TOP_DIR, 'Builder/version_info.txt'))

        version = vi.get('version')

        f = open(r'tmp\info_before.txt', 'w')
        f.write('''Barry's Emacs %(version)s for %(arch)s

After the installation is completed please
see the readme.txt file for changes new in
this kit.

    Barry Scott

    %(date)s
''' % {
            'version': version,
            'arch': self.arch,
            'date': self.build_time_str
        })
        f.close()

        self.all_setup_items.extend([
            r'''AppName=%(app_name)s''' % self.__dict__,
            r'''AppVerName=Barry's Emacs %s''' % (version, ),
            r'''AppCopyright=Copyright (C) 1980-%s Barry A. Scott''' %
            (self.year, ),
            r'''DefaultDirName={pf}\Barry Scott\%(app_name)s''' %
            self.__dict__,
            r'''DefaultGroupName=%(app_name)s''' % self.__dict__,
            r'''UninstallDisplayIcon={app}\bemacs.exe''',
            r'''ChangesAssociations=yes''',
            r'''DisableStartupPrompt=yes''',
            r'''InfoBeforeFile=info_before.txt''',
            r'''Compression=bzip/9''',
        ])

        self.all_task_items.extend([
            r'''Name: "option_register_emacs_open_ml"; Description: "%(app_name)s will open .ML and .MLP files"'''
            % self.__dict__,
            r'''Name: "option_register_emacs_open_c_dont"; Description: "No association"; GroupDescription: "How should %(app_name)s be associated with Cand C++ Source Files"; Flags: exclusive'''
            % self.__dict__,
            r'''Name: "option_register_emacs_open_c_one_type"; Description: "Associate using one file type"; GroupDescription: "How should %(app_name)s be associated with Cand C++ Source Files"; Flags: exclusive'''
            % self.__dict__,
            r'''Name: "option_register_emacs_open_c_many_types"; Description: "Associate using multiple file types"; GroupDescription: "How should %(app_name)s be associated with Cand C++ Source Files"; Flags: exclusive'''
            % self.__dict__,
            r'''Name: "option_desktop_icon"; Flags: unchecked; Description: "Place %(app_name)s icon on the Desktop"'''
            % self.__dict__,
            r'''Name: "option_start_menu_icon"; Description: "Place %(app_name)s on the Start menu"'''
            % self.__dict__,
            r'''Name: "option_edit_with_bemacs"; Description: "Place Edit with %(app_name)s on the Context menu"'''
            % self.__dict__,
        ])

        self.all_icon_items.extend([
            r'''Name: "{group}\Barry's Emacs"; Filename: "{app}\bemacs.exe"''',
            r'''Name: "{group}\Barry's Emacs Server"; Filename: "{app}\BEmacs_Server.exe"''',
            r'''Name: "{group}\Documentation"; Filename: "{app}\Documentation\emacs-documentation.html"''',
            r'''Name: "{group}\FAQ"; Filename: "{app}\documentation\bemacs-faq.html"''',
            r'''Name: "{group}\Readme"; Filename: "{app}\bemacs.exe"; Parameters: """{app}\readme.txt"""''',
            r'''Name: "{group}\Barry's Emacs Web Site"; Filename: "http://www.barrys-emacs.org";''',
            #
            #    Add an Emacs icon to the Desktop
            #
            r'''Name: "{commondesktop}\%(app_name)s"; Filename: "{app}\bemacs.exe"; Tasks: "option_desktop_icon"'''
            % self.__dict__,

            #
            #    Add an Emacs icon to the Start menu
            #
            r'''Name: "{commonstartmenu}\%(app_name)s"; Filename: "{app}\bemacs.exe"; Tasks: "option_start_menu_icon"'''
            % self.__dict__,
        ])

        self.all_registry_items.extend([
            r'''Root: HKCR; Subkey: "BarrysEmacs8Command"; ValueType: string; ValueData: "BEmacs Command"; Flags: uninsdeletekey''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8Command\Shell\open\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" /package=""%1"""''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8Command\DefaultIcon"; ValueType: string; ValueData: "{app}\bemacs.exe"''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8MLisp"; ValueType: string; ValueData: "BEmacs MLisp"; Flags: uninsdeletekey''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8MLisp\Shell\open\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" ""%1"""''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8MLisp\DefaultIcon"; ValueType: string; ValueData: "{app}\bemacs.exe"''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8Document"; ValueType: string; ValueData: "BEmacs"; Flags: uninsdeletekey''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8Document\Shell\open\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" ""%1"""''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8Document\DefaultIcon"; ValueType: string; ValueData: "{app}\bemacs.exe"''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentII"; ValueType: string; ValueData: "BEmacs II"; Flags: uninsdeletekey''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentII\Shell\open\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" ""%1"""''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentII\DefaultIcon"; ValueType: string; ValueData: "{app}\bemacs.exe"''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentIII"; ValueType: string; ValueData: "BEmacs III"; Flags: uninsdeletekey''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentIII\Shell\open\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" ""%1"""''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentIII\DefaultIcon"; ValueType: string; ValueData: "{app}\bemacs.exe"''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentIV"; ValueType: string; ValueData: "BEmacs IV"; Flags: uninsdeletekey''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentIV\Shell\open\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" ""%1"""''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentIV\DefaultIcon"; ValueType: string; ValueData: "{app}\bemacs.exe"''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentV"; ValueType: string; ValueData: "BEmacs V"; Flags: uninsdeletekey''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentV\Shell\open\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" ""%1"""''',
            r'''Root: HKCR; Subkey: "BarrysEmacs8DocumentV\DefaultIcon"; ValueType: string; ValueData: "{app}\bemacs.exe"''',

            #
            #    Add the Edit with Barry's Emacs to the context menu
            #

            # option_edit_with_bemacs
            r'''Root: HKCR; Subkey: "*\shell\Edit with %(app_name)s"; ValueType: string; ValueData: "Edit with &%(app_name)s"; Flags: uninsdeletekey'''
            % self.__dict__,
            r'''Root: HKCR; Subkey: "*\shell\Edit with %(app_name)s\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" ""%%1"""'''
            % self.__dict__,
            r'''Root: HKCR; Subkey: "Drive\shell\%(app_name)s Here"; ValueType: string; ValueData: "%(app_name)s &Here"; Flags: uninsdeletekey'''
            % self.__dict__,
            r'''Root: HKCR; Subkey: "Drive\shell\%(app_name)s Here\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" /package=cd-here ""%%1\.."""'''
            % self.__dict__,
            r'''Root: HKCR; Subkey: "Directory\shell\%(app_name)s Here"; ValueType: string; ValueData: "%(app_name)s &Here"; Flags: uninsdeletekey'''
            % self.__dict__,
            r'''Root: HKCR; Subkey: "Directory\shell\%(app_name)s Here\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" /package=cd-here ""%%1"""'''
            % self.__dict__,
            r'''Root: HKCR; Subkey: "Directory\Background\shell\%(app_name)s Here"; ValueType: string; ValueData: "%(app_name)s &Here"; Flags: uninsdeletekey'''
            % self.__dict__,
            r'''Root: HKCR; Subkey: "Directory\Background\shell\%(app_name)s Here\command"; ValueType: string; ValueData: """{app}\bemacs.exe"" /package=cd-here ""%%v"""'''
            % self.__dict__,

            #
            # have emacs open .ML files and .MLP files
            #
            r'''Root: HKCR; SubKey: ".ml";  ValueType: string; ValueData: "BarrysEmacs8MLisp"; Tasks: "option_register_emacs_open_ml"; Flags: uninsdeletekey''',
            r'''Root: HKCR; SubKey: ".mlp"; ValueType: string; ValueData: "BarrysEmacs8Command"; Tasks: "option_register_emacs_open_ml"; Flags: uninsdeletekey''',

            #
            # register all the C and C++ file types for emacs to open
            # either using one type or multiple
            #
            r'''Root: HKCR; Subkey: ".h";   ValueType: string; ValueData: "BarrysEmacs8Document"; Tasks: "option_register_emacs_open_c_one_type"''',
            r'''Root: HKCR; Subkey: ".hh";  ValueType: string; ValueData: "BarrysEmacs8Document"; Tasks: "option_register_emacs_open_c_one_type"''',
            r'''Root: HKCR; Subkey: ".hpp"; ValueType: string; ValueData: "BarrysEmacs8Document"; Tasks: "option_register_emacs_open_c_one_type"''',
            r'''Root: HKCR; Subkey: ".hxx"; ValueType: string; ValueData: "BarrysEmacs8Document"; Tasks: "option_register_emacs_open_c_one_type"''',
            r'''Root: HKCR; Subkey: ".c";   ValueType: string; ValueData: "BarrysEmacs8Document"; Tasks: "option_register_emacs_open_c_one_type"''',
            r'''Root: HKCR; Subkey: ".cc";  ValueType: string; ValueData: "BarrysEmacs8Document"; Tasks: "option_register_emacs_open_c_one_type"''',
            r'''Root: HKCR; Subkey: ".cpp"; ValueType: string; ValueData: "BarrysEmacs8Document"; Tasks: "option_register_emacs_open_c_one_type"''',
            r'''Root: HKCR; Subkey: ".cxx"; ValueType: string; ValueData: "BarrysEmacs8Document"; Tasks: "option_register_emacs_open_c_one_type"''',
            r'''Root: HKCR; Subkey: ".h";   ValueType: string; ValueData: "BarrysEmacs8DocumentII"; Tasks: "option_register_emacs_open_c_many_types"''',
            r'''Root: HKCR; Subkey: ".hh";  ValueType: string; ValueData: "BarrysEmacs8DocumentII"; Tasks: "option_register_emacs_open_c_many_types"''',
            r'''Root: HKCR; Subkey: ".hpp"; ValueType: string; ValueData: "BarrysEmacs8DocumentII"; Tasks: "option_register_emacs_open_c_many_types"''',
            r'''Root: HKCR; Subkey: ".hxx"; ValueType: string; ValueData: "BarrysEmacs8DocumentII"; Tasks: "option_register_emacs_open_c_many_types"''',
            r'''Root: HKCR; Subkey: ".c";   ValueType: string; ValueData: "BarrysEmacs8DocumentIII"; Tasks: "option_register_emacs_open_c_many_types"''',
            r'''Root: HKCR; Subkey: ".cc";  ValueType: string; ValueData: "BarrysEmacs8DocumentIII"; Tasks: "option_register_emacs_open_c_many_types"''',
            r'''Root: HKCR; Subkey: ".cpp"; ValueType: string; ValueData: "BarrysEmacs8DocumentIII"; Tasks: "option_register_emacs_open_c_many_types"''',
            r'''Root: HKCR; Subkey: ".cxx"; ValueType: string; ValueData: "BarrysEmacs8DocumentIII"; Tasks: "option_register_emacs_open_c_many_types"''',
        ])

        self.all_file_items.extend([
            r'''Source: "%s\Kits\Readme.txt"; DestDir: "{app}";''' %
            (BUILDER_TOP_DIR, ),
            r'''Source: "%s\Editor\PyQtBEmacs\bemacs.png";  DestDir: "{app}\Documentation";'''
            % (BUILDER_TOP_DIR, ),
            r'''Source: "%s\HTML\*.css";  DestDir: "{app}\Documentation";''' %
            (BUILDER_TOP_DIR, ),
            r'''Source: "%s\HTML\*.html"; DestDir: "{app}\Documentation";''' %
            (BUILDER_TOP_DIR, ),
            r'''Source: "%s\HTML\*.gif";  DestDir: "{app}\Documentation";''' %
            (BUILDER_TOP_DIR, ),
            r'''Source: "%s\HTML\*.js";   DestDir: "{app}\Documentation";''' %
            (BUILDER_TOP_DIR, ),
        ])

        self.addAllKitFiles()

        #for dll in [dll for dll in os.listdir( 'tmp' ) if dll.lower().endswith( '.dll' )]:
        #    self.all_file_items.append( 'Source: "%s"; DestDir: "{app}"; Flags: ignoreversion' % (dll,) )

        if self.vc_ver == '14.0':
            redist_year = '2015'

        else:
            print('Error: Unsupported VC_VER of %s' % (self.vc_ver, ))
            return 1

        if self.arch == 'win64':
            redist_arch = 'x64'
            code_file = os.path.join(BUILDER_TOP_DIR,
                                     'Kits/Windows/bemacs_win64_code.iss')
            self.all_setup_items.append('ArchitecturesAllowed=x64')
            self.all_setup_items.append('ArchitecturesInstallIn64BitMode=x64')

        else:
            print('Error: Unsupported ARCH of %s' % (self.arch, ))
            return 1

        f = open(code_file, 'r')
        self.all_code_items.append(f.read() % self.__dict__)
        f.close()

        redist_file = 'vcredist_%s_%s.exe' % (redist_arch, redist_year)

        log.info(r'QQQ assuming K:\subversion is a thing')
        os.system(r'copy k:\subversion\%s tmp' % (redist_file, ))

        self.all_file_items.append(
            'Source: "%s"; DestDir: {tmp}; Flags: deleteafterinstall' %
            (redist_file, ))
        self.all_run_items.append(
            r'Filename: {tmp}\%s; Parameters: "/q"; StatusMsg: Installing VC++ %s %s Redistributables...'
            % (redist_file, redist_year, self.arch))

        # finally show the readme.txt
        self.all_run_items.append(
            r'Filename: "{app}\bemacs.exe"; Parameters: """{app}\readme.txt"""; '
            r'Flags: nowait postinstall skipifsilent; Description: "View README.TXT"'
        )