Changes to 'refs/tags/spacewalk-backend-0.8.2-1'
by Miroslav Suchý
Tag 'spacewalk-backend-0.8.2-1' created by Miroslav Suchý <msuchy(a)redhat.com> at 2009-12-04 15:32 +0000
Tagging package [spacewalk-backend] version [0.8.2-1] in directory [backend/].
Changes since spacewalk-java-0.8.1-1:
Miroslav Suchý (1):
Automatic commit of package [spacewalk-backend] release [0.8.2-1].
---
backend/spacewalk-backend.spec | 5 ++++-
rel-eng/packages/spacewalk-backend | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
---
14 years, 4 months
backend/spacewalk-backend.spec rel-eng/packages
by Miroslav Suchý
backend/spacewalk-backend.spec | 5 ++++-
rel-eng/packages/spacewalk-backend | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit bb9a9af00f67752d1f5e5a65ad19dd05da573c3b
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Dec 4 16:32:59 2009 +0100
Automatic commit of package [spacewalk-backend] release [0.8.2-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index f0ca787..0fbf099 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -7,7 +7,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 0.8.1
+Version: 0.8.2
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -578,6 +578,9 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Fri Dec 4 2009 Miroslav Suchý <msuchy(a)redhat.com> 0.8.2-1
+- sha256 support
+
* Fri Dec 04 2009 Michael Mraka <michael.mraka(a)redhat.com> 0.8.1-1
- rhn_rpm/rhn_mpm moved to rhnlib
- bumping Version to 0.8.0
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 42d30cc..ce9e292 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-0.8.1-1 backend/
+0.8.2-1 backend/
14 years, 4 months
Changes to 'refs/tags/spacewalk-java-0.8.1-1'
by Miroslav Suchý
Tag 'spacewalk-java-0.8.1-1' created by Miroslav Suchý <msuchy(a)redhat.com> at 2009-12-04 15:26 +0000
Tagging package [spacewalk-java] version [0.8.1-1] in directory [java/].
Changes since spacewalk-web-0.8.1-1:
Miroslav Suchý (1):
Automatic commit of package [spacewalk-java] release [0.8.1-1].
---
java/spacewalk-java.spec | 5 ++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
---
14 years, 4 months
java/spacewalk-java.spec rel-eng/packages
by Miroslav Suchý
java/spacewalk-java.spec | 5 ++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit e4615be93e4079cd34297f893bcd338591cc88dc
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Dec 4 16:26:31 2009 +0100
Automatic commit of package [spacewalk-java] release [0.8.1-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index fa047d6..d475807 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -12,7 +12,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 0.8.0
+Version: 0.8.1
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -283,6 +283,9 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Fri Dec 4 2009 Miroslav Suchý <msuchy(a)redhat.com> 0.8.1-1
+- sha256 support
+
* Wed Dec 02 2009 Tomas Lestach <tlestach(a)redhat.com> 0.7.24-1
- 537094 - yum list-sec CVE's on cloned channels doesn't work
(tlestach(a)redhat.com)
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 66cdb71..13b540c 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-0.7.24-1 java/
+0.8.1-1 java/
14 years, 4 months
Changes to 'refs/tags/spacewalk-web-0.8.1-1'
by Miroslav Suchý
Tag 'spacewalk-web-0.8.1-1' created by Miroslav Suchý <msuchy(a)redhat.com> at 2009-12-04 15:24 +0000
Tagging package [spacewalk-web] version [0.8.1-1] in directory [web/].
Changes since spacewalk-certs-tools-0.8.1-1:
Michael Mraka (117):
fixed md5 checksum upgrade sql script
don't create index separately
fixed table reference (removed test schema)
renamed rhnPackageChecksum to generic rhnChecksum
moved checksum from rhnFile to rhnChecksum
moved checksum from rhnPackage to rhnChecksum
moved checksum from rhnPackageFile to rhnChecksum
moved checksum from rhnErrataFile to rhnChecksum
moved checksum from rhnErrataFileTmp to rhnChecksum
moved checksum from rhnKSTreeFile to rhnChecksum
moved checksum from rhnConfigContent to rhnChecksum
removed index on md5
moved checksum from rhnPackageSource to rhnChecksum
moved checksum from rhnAppInstallSession to rhnChecksum
renamed md5 to checksum
upgrade script for rhnChecksum
fixed syntax (ORA-00907: missing right parenthesis)
added upgrade script for rhnChecksumType
renamed primary key to ID
fixed rhnChecksumType data
added index on rhnChecksum(checksum)
upgrade scripts for rhnPackage
upgrade script for rhnFile
upgrade script for rhnPackageFile
upgrade script for rhnErrataFile
upgrade script for rhnErrataFileTmp
upgrade script for rhnKSTreeFile
upgrade script for rhnConfigContent
upgrade script for rhnAppInstallSession
upgrade script for rhnPackageSource
upgrade script for rhnServerActionVerifyResult
added table dependencies (rhnChecksum/rhnChecksumType)
fixed syntax error
Merge branch 'master' into sha256-support2
changed queries in dumper.py to new rhnChecksum table
changed queries in exportLib.py to new rhnChecksum table
changed queries in disk_dumper/dumper.py to new rhnChecksum table
changed queries in disk_dumper/iss.py to new rhnChecksum table
changed queries in exporter/exportLib.py to new rhnChecksum table
changed queries in satsync.py to new rhnChecksum table
changed queries in updatePackages.py to new rhnChecksum table
changed queries in server/action/configfiles.py to new rhnChecksum table
changed queries in server/action_extra_data/packages.py to new rhnChecksum table
changed queries in server/configFilesHandler.py to new rhnChecksum table
changed queries in server/handlers/app/packages.py to new rhnChecksum table
changed queries in server/handlers/config/rhn_config_management.py to new rhnChecksum table
changed queries in server/handlers/config_mgmt/rhn_config_management.py to new rhnChecksum table
changed queries in server/handlers/xp/rhnlint.py to new rhnChecksum table
changed queries in server/importlib/backend.py[D to new rhnChecksum table
changes in server/repomd/mapper.py to reflect new rhnChecksum table
changes in server/rhnKickstart.py to reflect new rhnChecksum table
changes in server/rhnPackage.py to reflect new rhnChecksum table
changes in server/rhnPackage.py to reflect new rhnChecksum table
changes in server/rhnServer/server_packages.py to reflect new rhnChecksum table
fixed list of yum repo checksums in Create Software Channel
new lookup_checksum function
fixed inserts in server/configFilesHandler.py to reflect new rhnChecksum table
fixed inserts in server/rhnKickstart.py to reflect new rhnChecksum table
fixed typo
fixing rhnpush error: ORA-00904: "MD5SUM": invalid identifier
fixing rhnpush error: ORA-00904: "MD5SUM": invalid identifier
fixing rhnpush error: ORA-00904: "MD5SUM": invalid identifier
fixing rhnpush error: ORA-00904: "MD5SUM": invalid identifier
fixed ORA-00904: "P"."CHECKSUM_ID": invalid identifier
changed checksum code for rhnPackageFile
checksum_id can be NULL in rhnPackageFile
Merge branch 'master' into sha256-support3
fixed error message #501
fixed indentation
moved checksum code from PackageImport to ChannelPackageSubscription
added checksum support to spacewalk-repo-sync
fixed satellite-sync (reverted checksum changes in blacklistImport)
Merge branch 'master' into sha256-support3
fixed errata sync part of satellite-sync
_postprocessPackage packages in errata (e.g lookup checksum_ids)
Merge branch 'master' into sha256-support3
checksum changes for rhnErrataFile
more checksum changes for rhnErrataFile
comment out dead SRPM import code for now
Merge branch 'master' into sha256-support3
these really have to be instance rather than class variables
let spacewalk-repo-sync be sha256 aware - store whatever checksum comes directly from repo
moved getFileMD5 outside of rhnPackageUpload.load_package
remove rest of md5sum references
determine checksum type used by rpm
pass whole checksum struct to path functions
removed unused imports
make get_package_path more readable
cleaned up commented code
merge two similar queries
implement various checksums
removed hexify_string(); not needed on python > 2.3
rhnPackageUpload.push_package and all the stuff it uses modified to use checksum
switched checksum back from usage of repo metadata to compute on our own
made get_package_for_checksum consistent with other functions
let repomd generator be sha256'ish
let repomd.xml reflect channel checksum type
Merge branch 'master' into sha256-support3
fixed perl queries for sha256 schema
fixed another bunch of perl queries for sha256 schema
fixed ORA-00904: "P"."MD5SUM": invalid identifier
added checksum type to filelist page
added rhnChecksumView
fixed typo
Merge branch 'master' into sha256-support3
replaced rhnChecksum and rhnChecksumType join with rhnChecksumView
fixed checksum on config.pxt page
checksum type looks better in upper case
Merge branch 'master' into sha256-support3
fixed comment
removed commented out code
fixed checksum type of files inside rpm package
added forgotten rhnLib to imports
fixed lookup_checksum not to ignore checksum type
Merge branch 'master' into sha256-support3
Merge branch 'master' into sha256-support3
Merge branch sha256 to master
Miroslav Suchý (30):
Create table rhnPackageChecksum which will be store checksums for rhnPackage table
require rhnpush to use its uploadLib.py
merget uploadLib.py - from client/tools/rhnpush to proxy/proxy/pm
merge uploadLib.py - from proxy/proxy/pm to client/tools/rhnpush
base UploadClass on uploadLib.UploadClass from rhnpush
whitespace cleanup
more agressive merge uploadLib.py - from client/tools/rhnpush to proxy/proxy/pm
Merge branch 'master' into s3
Creating new domain class for table rhnChecksum
replace md5sum with generic checksum in Package and Errata classes
code cleanup - query selected_configfiles is not used anywhere in code
code clenup - query package_files is defined in Package_queries.xml and code use query from that file
allow Checksum to be created and saved
create ChecksumFactory class
remove saveChecksum from CommonFactory, it is in new class ChecksumFactory
fix build and checkstyle errors in Checksums classes
let repomd use new Checksum class
let Config clasess use new Checksum class
let use jsp pages new Checksum attributes
removing bogus column from definition
fixing typo in method name
sigchecksum is not property, it is relation
fix typo in column name
fix typo in column name
return hash and type of has as string as representation of the class
rpmlint - add defattr
allow configuration file to create new checksum
add docstring
no need to count lenght, it is saved in returnedChunksize already
Automatic commit of package [spacewalk-web] release [0.8.1-1].
Tomas Lestach (1):
making java changes compilable and checkstyle compliant
---
backend/common/rhnException.py | 3
backend/common/rhnLib.py | 43
backend/po/server.pot | 2
backend/satellite_exporter/exporter/dumper.py | 20
backend/satellite_tools/disk_dumper/dumper.py | 18
backend/satellite_tools/disk_dumper/iss.py | 22
backend/satellite_tools/exporter/exportLib.py | 54 -
backend/satellite_tools/reposync.py | 61 -
backend/satellite_tools/satsync.py | 16
backend/satellite_tools/updatePackages.py | 12
backend/server/action/configfiles.py | 4
backend/server/action_extra_data/packages.py | 2
backend/server/basePackageUpload.py | 9
backend/server/configFilesHandler.py | 19
backend/server/handlers/app/packages.py | 30
backend/server/handlers/config/rhn_config_management.py | 4
backend/server/handlers/config_mgmt/rhn_config_management.py | 8
backend/server/handlers/xp/rhnlint.py | 7
backend/server/importlib/backend.py | 32
backend/server/importlib/backendOracle.py | 19
backend/server/importlib/errataImport.py | 22
backend/server/importlib/headerSource.py | 27
backend/server/importlib/importLib.py | 30
backend/server/importlib/mpmSource.py | 10
backend/server/importlib/packageImport.py | 32
backend/server/importlib/packageUpload.py | 3
backend/server/importlib/test/test_solaris.py | 8
backend/server/repomd/domain.py | 3
backend/server/repomd/mapper.py | 23
backend/server/repomd/repository.py | 13
backend/server/repomd/view.py | 28
backend/server/rhnKickstart.py | 11
backend/server/rhnLib.py | 23
backend/server/rhnPackage.py | 12
backend/server/rhnPackageUpload.py | 63 -
backend/server/rhnServer/server_packages.py | 13
backend/upload_server/handlers/package_push/package_push.py | 24
backend/upload_server/handlers/package_upload/package_upload.py | 5
client/rhel/rhnlib/rhn/common/rhn_rpm.py | 34
client/tools/rhnpush/uploadLib.py | 74 +
java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml | 23
java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml | 7
java/code/src/com/redhat/rhn/common/db/datasource/xml/General_queries.xml | 14
java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml | 7
java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml | 9
java/code/src/com/redhat/rhn/common/db/datasource/xml/checksum_queries.xml | 10
java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml | 32
java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml | 1
java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml | 26
java/code/src/com/redhat/rhn/domain/common/Checksum.java | 99 +
java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java | 165 +++
java/code/src/com/redhat/rhn/domain/common/ChecksumType.hbm.xml | 2
java/code/src/com/redhat/rhn/domain/common/ChecksumType.java | 9
java/code/src/com/redhat/rhn/domain/common/ChecksumTypeException.java | 54 +
java/code/src/com/redhat/rhn/domain/config/ConfigContent.hbm.xml | 3
java/code/src/com/redhat/rhn/domain/config/ConfigContent.java | 17
java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java | 5
java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java | 2
java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrataFile.hbm.xml | 3
java/code/src/com/redhat/rhn/domain/errata/impl/UnpublishedErrataFile.hbm.xml | 3
java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java | 15
java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml | 7
java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.java | 29
java/code/src/com/redhat/rhn/domain/rhnpackage/Package_satellite.hbm.xml | 5
java/code/src/com/redhat/rhn/domain/rhnpackage/test/PackageTest.java | 8
java/code/src/com/redhat/rhn/frontend/dto/ErrataPackageFile.java | 34
java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java | 31
java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java | 2
java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackageHelper.java | 7
java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackagesHandler.java | 12
java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/test/PackageHelperTest.java | 3
java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java | 2
java/code/src/com/redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java | 2
java/code/src/com/redhat/rhn/taskomatic/task/repomd/RepomdWriter.java | 2
java/code/src/com/redhat/rhn/taskomatic/task/repomd/UpdateInfoWriter.java | 2
java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java | 5
java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/add_details.jspf | 2
java/code/webapp/WEB-INF/pages/errata/erratapackages.jsp | 2
java/code/webapp/WEB-INF/pages/rhnpackage/packagedetail.jsp | 2
java/spacewalk-java.spec | 7
proxy/proxy/pm/uploadLib.py | 511 ----------
proxy/proxy/spacewalk-proxy.spec | 1
rel-eng/packages/spacewalk-web | 2
schema/spacewalk/common/data/rhnChecksumType.sql | 14
schema/spacewalk/common/tables/rhnAppInstallSession.sql | 4
schema/spacewalk/common/tables/rhnChecksum.sql | 33
schema/spacewalk/common/tables/rhnChecksumType.sql | 6
schema/spacewalk/common/tables/rhnConfigContent.sql | 8
schema/spacewalk/common/tables/rhnErrataFile.sql | 4
schema/spacewalk/common/tables/rhnErrataFileTmp.sql | 4
schema/spacewalk/common/tables/rhnFile.sql | 4
schema/spacewalk/common/tables/rhnKSTreeFile.sql | 4
schema/spacewalk/common/tables/rhnPackage.sql | 8
schema/spacewalk/common/tables/rhnPackageFile.sql | 4
schema/spacewalk/common/tables/rhnPackageSource.sql | 8
schema/spacewalk/common/tables/rhnServerActionVerifyResult.sql | 6
schema/spacewalk/common/tables/tables.deps | 25
schema/spacewalk/common/views/rhnChecksumView.sql | 24
schema/spacewalk/common/views/views.deps | 1
schema/spacewalk/oracle/procs/lookup_checksum.sql | 49
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/004-rhnChecksumType-table.sql | 37
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql | 33
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql | 14
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/007-rhnChecksumView.sql | 24
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/008-lookup_checksum.sql | 49
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-1-rhnFile-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-2-rhnFile-data.sql | 10
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-3-rhnFile-md5.sql | 2
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-4-rhnFile-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-1-rhnPackage-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-2-rhnPackage-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-3-rhnPackage-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-4-rhnPackage-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-1-rhnPackageFile-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-2-rhnPackageFile-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-3-rhnPackageFile-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-1-rhnErrataFile-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-2-rhnErrataFile-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-3-rhnErrataFile-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-4-rhnErrataFile-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-1-rhnErrataFileTmp-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-2-rhnErrataFileTmp-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-3-rhnErrataFileTmp-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-4-rhnErrataFileTmp-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-1-rhnKSTreeFile-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-2-rhnKSTreeFile-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-3-rhnKSTreeFile-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-4-rhnKSTreeFile-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-1-rhnConfigContent-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-2-rhnConfigContent-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-3-rhnConfigContent-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-4-rhnConfigContent-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-1-rhnPackageSource-checksum.sql | 6
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-2-rhnPackageSource-data.sql | 21
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-3-rhnPackageSource-md5.sql | 2
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-4-rhnPackageSource-checksum.sql | 2
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-1-rhnAppInstallSession-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-2-rhnAppInstallSession-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-3-rhnAppInstallSession-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-4-rhnAppInstallSession-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/019-1-rhnServerActionVerifyResult-checksum.sql | 7
web/html/network/software/packages/file_list.pxt | 2
web/html/network/systems/details/history/snapshots/config.pxt | 2
web/modules/rhn/RHN/DB/Channel.pm | 6
web/modules/rhn/RHN/DB/ConfigRevision.pm | 10
web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml | 7
web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml | 4
web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml | 36
web/modules/rhn/RHN/DB/Errata.pm | 39
web/modules/rhn/RHN/DB/ErrataEditor.pm | 4
web/modules/rhn/RHN/DB/KSTree.pm | 6
web/modules/rhn/RHN/DB/Package.pm | 14
web/modules/sniglets/Sniglets/ListView/FileList.pm | 8
web/modules/sniglets/Sniglets/Packages.pm | 3
web/spacewalk-web.spec | 5
155 files changed, 1648 insertions(+), 1053 deletions(-)
---
14 years, 4 months
rel-eng/packages web/spacewalk-web.spec
by Miroslav Suchý
rel-eng/packages/spacewalk-web | 2 +-
web/spacewalk-web.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 749c6980a546454a508bebcd448c47d40cce0438
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Dec 4 16:24:31 2009 +0100
Automatic commit of package [spacewalk-web] release [0.8.1-1].
diff --git a/rel-eng/packages/spacewalk-web b/rel-eng/packages/spacewalk-web
index cef8719..82080ff 100644
--- a/rel-eng/packages/spacewalk-web
+++ b/rel-eng/packages/spacewalk-web
@@ -1 +1 @@
-0.7.8-1 web/
+0.8.1-1 web/
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 89becbf..7fc11e3 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -2,7 +2,7 @@ Name: spacewalk-web
Summary: Spacewalk Web site packages
Group: Applications/Internet
License: GPLv2
-Version: 0.8.0
+Version: 0.8.1
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -317,6 +317,9 @@ rm -rf $RPM_BUILD_ROOT
# $Id$
%changelog
+* Fri Dec 4 2009 Miroslav Suchý <msuchy(a)redhat.com> 0.8.1-1
+- sha256 support
+
* Wed Dec 02 2009 Tomas Lestach <tlestach(a)redhat.com> 0.7.8-1
- 537094 - yum list-sec CVE's on cloned channels doesn't work
(tlestach(a)redhat.com)
14 years, 4 months
backend/satellite_tools
by Miroslav Suchý
backend/satellite_tools/satsync.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit 5aa78baa082ab3def11b11c85db2617b25823603
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Dec 3 16:39:38 2009 +0100
no need to count lenght, it is saved in returnedChunksize already
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index 298cef8..106468d 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -1648,7 +1648,6 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
ss = SequenceServer(packages[:], nevermorethan=self._batch_size)
while not ss.doneYN():
chunk = ss.getChunk()
- item_count = len(chunk)
batch = self._get_cached_package_batch(chunk)
# check to make sure the orgs exported are valid
_validate_package_org(batch)
@@ -1664,7 +1663,7 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# an SQL error is fatal... crash and burn
sys.exit(13)
ss.clearChunk()
- pb.addTo(item_count)
+ pb.addTo(ss.returnedChunksize)
pb.printIncrement()
pb.printComplete()
# Populate the package key info
14 years, 4 months
Branch 'sha256-support3' - 27 commits - backend/common backend/satellite_tools backend/server backend/spacewalk-backend.spec branding/spacewalk-branding.spec client/rhel client/tools java/spacewalk-java.spec monitoring/spacewalk-monitoring monitoring/spacewalk-proxy-monitoring proxy/installer proxy/proxy proxy/proxy-docs proxy/proxy-html rel-eng/build-missing-builds-in-koji.sh rel-eng/packages satellite/install schema/spacewalk search-server/spacewalk-doc-indexes search-server/spacewalk-search.spec selinux/
by Michael Mraka
backend/common/Makefile | 2
backend/common/rhnRepository.py | 2
backend/common/rhn_mpm.py | 278 ------
backend/common/rhn_rpm.py | 463 ----------
backend/satellite_tools/reposync.py | 5
backend/satellite_tools/satCerts.py | 2
backend/satellite_tools/satComputePkgHeaders.py | 2
backend/satellite_tools/satsync.py | 3
backend/satellite_tools/updatePackages.py | 3
backend/server/handlers/app/rhn_mpm.py | 2
backend/server/handlers/applet/applet.py | 4
backend/server/handlers/xmlrpc/up2date.py | 3
backend/server/handlers/xp/rhnlint.py | 3
backend/server/importlib/backend.py | 3
backend/server/importlib/packageUpload.py | 3
backend/server/rhnChannel.py | 3
backend/server/rhnPackageUpload.py | 2
backend/server/rhnServer/server_class.py | 3
backend/server/rhnServer/server_packages.py | 3
backend/spacewalk-backend.spec | 10
branding/spacewalk-branding.spec | 2
client/rhel/rhn-client-tools/man/en/spacewalk-channel.8 | 22
client/rhel/rhn-client-tools/rhn-client-tools.spec | 2
client/rhel/rhn-client-tools/src/bin/rhnreg_ks.py | 2
client/rhel/rhn-client-tools/src/bin/spacewalk-channel.py | 7
client/rhel/rhnlib/rhn/common/rhn_mpm.py | 283 ++++++
client/rhel/rhnlib/rhn/common/rhn_rpm.py | 462 +++++++++
client/rhel/rhnlib/rhnlib.spec | 5
client/rhel/rhnlib/setup.py.in | 2
client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec | 2
client/tools/rhnpush/Makefile.rhnpush | 2
client/tools/rhnpush/connection.py | 2
client/tools/rhnpush/rhn_mpm.py | 289 ------
client/tools/rhnpush/rhn_rpm.py | 370 -------
client/tools/rhnpush/rhnpush.py | 2
client/tools/rhnpush/rhnpush.spec | 7
client/tools/rhnpush/rpm2mpm.py | 3
client/tools/rhnpush/solaris2mpm.py | 2
client/tools/rhnpush/uploadLib.py | 4
java/spacewalk-java.spec | 2
monitoring/spacewalk-monitoring/spacewalk-monitoring.spec | 2
monitoring/spacewalk-proxy-monitoring/spacewalk-proxy-monitoring.spec | 2
proxy/installer/spacewalk-proxy-installer.spec | 2
proxy/proxy-docs/spacewalk-proxy-docs.spec | 2
proxy/proxy-html/spacewalk-proxy-html.spec | 2
proxy/proxy/spacewalk-proxy.spec | 2
rel-eng/build-missing-builds-in-koji.sh | 2
rel-eng/packages/rhnlib | 2
rel-eng/packages/rhnpush | 2
rel-eng/packages/spacewalk-backend | 2
rel-eng/packages/spacewalk-certs-tools | 2
satellite/install/install.pl | 13
satellite/install/installPackages.py | 234 -----
satellite/install/rhn_rpm.py | 364 -------
satellite/install/satErrors.py | 380 --------
satellite/install/satLog.py | 116 --
satellite/install/translate.py | 112 --
schema/spacewalk/spacewalk-schema.spec | 2
search-server/spacewalk-doc-indexes/spacewalk-doc-indexes.spec | 2
search-server/spacewalk-search.spec | 2
selinux/spacewalk-monitoring-selinux/spacewalk-monitoring-selinux.spec | 2
selinux/spacewalk-proxy-selinux/spacewalk-proxy-selinux.spec | 2
selinux/spacewalk-selinux/spacewalk-selinux.spec | 2
spacewalk/admin/spacewalk-admin.spec | 2
spacewalk/certs-tools/Makefile.certs | 2
spacewalk/certs-tools/rhn_bootstrap.py | 2
spacewalk/certs-tools/rhn_rpm.py | 375 --------
spacewalk/certs-tools/rhn_ssl_tool.py | 2
spacewalk/certs-tools/spacewalk-certs-tools.spec | 9
spacewalk/config/spacewalk-config.spec | 2
spacewalk/package/spacewalk.spec | 2
spacewalk/setup/spacewalk-setup.spec | 2
utils/Makefile | 2
utils/apply_errata | 287 ++++++
utils/spacewalk-utils.spec | 2
web/modules/pxt/PXT/ApacheHandler.pm | 11
web/spacewalk-web.spec | 2
77 files changed, 1164 insertions(+), 3062 deletions(-)
New commits:
commit 067ecedbb7de27514d07c625e8cacd34967541e3
Merge: e7a1d61... 8cba619...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 13:52:11 2009 +0100
Merge branch 'master' into sha256-support3
Conflicts:
backend/server/basePackageUpload.py
client/tools/rhnpush/uploadLib.py
diff --cc client/rhel/rhnlib/rhn/common/rhn_rpm.py
index 0000000,66a46e1..349388a
mode 000000,100644..100644
--- a/client/rhel/rhnlib/rhn/common/rhn_rpm.py
+++ b/client/rhel/rhnlib/rhn/common/rhn_rpm.py
@@@ -1,0 -1,428 +1,462 @@@
+ #
+ # Copyright (c) 2008 Red Hat, Inc.
+ #
+ # This software is licensed to you under the GNU General Public License,
+ # version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ # implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ # along with this software; if not, see
+ # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ #
+ # Red Hat trademarks are not licensed under GPLv2. No permission is
+ # granted to use or replicate Red Hat trademarks that are incorporated
+ # in this software or its documentation.
+ #
+
+ import os
+ import sys
+ import rpm
+ import struct
+
+ import exceptions
+ if not hasattr(exceptions, 'StopIteration'):
+ # Presumably python 1.5.2
+ class StopIteration(Exception):
+ pass
+
+ # Expose a bunch of useful constants from rpm
+ error = rpm.error
+ for sym, val in rpm.__dict__.items():
+ if sym[:3] == 'RPM':
+ # A constant, probably - import it into our namespace
+ globals()[sym] = val
+ del sym, val
+
++# need this for rpm-pyhon < 4.6 (e.g. on RHEL5)
++rpm.RPMTAG_FILEDIGESTALGO = 5011
++
++# these values are taken from /usr/include/rpm/rpmpgp.h
++# PGPHASHALGO_MD5 = 1, /*!< MD5 */
++# PGPHASHALGO_SHA1 = 2, /*!< SHA1 */
++# PGPHASHALGO_RIPEMD160 = 3, /*!< RIPEMD160 */
++# PGPHASHALGO_MD2 = 5, /*!< MD2 */
++# PGPHASHALGO_TIGER192 = 6, /*!< TIGER192 */
++# PGPHASHALGO_HAVAL_5_160 = 7, /*!< HAVAL-5-160 */
++# PGPHASHALGO_SHA256 = 8, /*!< SHA256 */
++# PGPHASHALGO_SHA384 = 9, /*!< SHA384 */
++# PGPHASHALGO_SHA512 = 10, /*!< SHA512 */
++PGPHASHALGO = {
++ 1: 'md5',
++ 2: 'sha1',
++ 3: 'ripemd160',
++ 5: 'md2',
++ 6: 'tiger192',
++ 7: 'haval-5-160',
++ 8: 'sha256',
++ 9: 'sha384',
++ 10: 'sha512',
++}
++
++
+ class InvalidPackageError(Exception):
+ pass
+
+ # wrapper/proxy class for rpm.Transaction so we can
+ # instrument it, etc easily
+ class RPMTransaction:
+ read_only = 0
+ def __init__(self):
+ if hasattr(rpm, 'opendb'):
+ db = getattr(rpm, 'opendb')(not self.read_only)
+ self.ts = rpm.TransactionSet('/', db)
+ else:
+ self.ts = rpm.TransactionSet()
+ self.tsflags = []
+ # For rpm 4.0.4
+ self._flags = 0
+ self._prob_filter = 0
+
+ def __getattr__(self, attr):
+ return getattr(self.ts, attr)
+
+ def getMethod(self, method):
+ # in theory, we can override this with
+ # profile/etc info
+ return getattr(self.ts, method)
+
+ # push/pop methods so we don't lose the previous
+ # set value, and we can potentially debug a bit
+ # easier
+ def pushVSFlags(self, flags):
+ self.tsflags.append(flags)
+ if hasattr(self.ts, 'setVSFlags'):
+ f = getattr(self.ts, 'setVSFlags')
+ f(self.tsflags[-1])
+
+ def popVSFlags(self):
+ del self.tsflags[-1]
+ if hasattr(self.ts, 'setVSFlags'):
+ f = getattr(self.ts, 'setVSFlags')
+ f(self.tsflags[-1])
+
+ def addInstall(self, arg1, arg2, mode):
+ """Install a package"""
+ hdr = arg1.hdr
+ if hasattr(self.ts, 'addInstall'):
+ f = getattr(self.ts, 'addInstall')
+ return f(hdr, arg2, mode)
+ return self.ts.add(hdr, arg2, mode)
+
+ def addErase(self, arg1):
+ """Erase a package"""
+ hdr = arg1.hdr
+ if hasattr(self.ts, 'addErase'):
+ f = getattr(self.ts, 'addErase')
+ return f(hdr)
+ return self.ts.add(hdr, hdr, "e")
+
+ def check(self):
+ """Check dependencies"""
+ if hasattr(self.ts, 'check'):
+ f = getattr(self.ts, 'check')
+ else:
+ f = getattr(self.ts, 'depcheck')
+ return f()
+
+ def setFlags(self, flag):
+ """Set transaction flags"""
+ if hasattr(rpm, 'headerFromPackage'):
+ # Old style rpm
+ old_flags = self._flags
+ self._flags = flag
+ return old_flags
+ return self.ts.setFlags(flag)
+
+ def setProbFilter(self, flag):
+ """Set problem flags"""
+ if hasattr(rpm, 'headerFromPackage'):
+ # Old style rpm
+ old_flags = self._prob_filter
+ self._prob_filter = flag
+ return old_flags
+ return self.ts.setProbFilter(flag)
+
+ def run(self, callback, user_data):
+ if hasattr(rpm, 'headerFromPackage'):
+ # Old style rpm
+ return self.ts.run(self._flags, self._prob_filter, callback,
+ user_data)
+ return self.ts.run(callback, user_data)
+
+
+
+
+ class SharedStateTransaction:
+ _shared_state = {}
+
+ def __init__(self):
+ self.__dict__ = self._shared_state
+
+ class RPMReadOnlyTransaction(SharedStateTransaction, RPMTransaction):
+ read_only = 1
+ def __init__(self):
+ SharedStateTransaction.__init__(self)
+ if not hasattr(self, 'ts'):
+ RPMTransaction.__init__(self)
+ # FIXME: replace with macro defination
+ self.pushVSFlags(8)
+
+ class RPM_Header:
+ "Wrapper class for an rpm header - we need to store a flag is_source"
+ def __init__(self, hdr, is_source=None):
+ self.hdr = hdr
+ self.is_source = is_source
+ self.packaging = 'rpm'
+ self.signatures = []
+ self._extract_signatures()
+
+ def __getitem__(self, name):
+ return self.hdr[name]
+
+ def __getattr__(self, name):
+ return getattr(self.hdr, name)
+
++ def checksum_type(self):
++ if self.hdr[rpm.RPMTAG_FILEDIGESTALGO] \
++ and PGPHASHALGO.has_key(self.hdr[rpm.RPMTAG_FILEDIGESTALGO]):
++ checksum_type = PGPHASHALGO[self.hdr[rpm.RPMTAG_FILEDIGESTALGO]]
++ else:
++ checksum_type = 'md5'
++ return checksum_type
++
+ def is_signed(self):
+ if hasattr(rpm, "RPMTAG_DSAHEADER"):
+ dsaheader = self.hdr["dsaheader"]
+ else:
+ dsaheader = 0
+ if self.hdr["siggpg"] or self.hdr["sigpgp"] or dsaheader:
+ return 1
+ return 0
+
+ def _extract_signatures(self):
+ header_tags = [
+ [rpm.RPMTAG_DSAHEADER, "dsa"],
+ [rpm.RPMTAG_RSAHEADER, "rsa"],
+ [rpm.RPMTAG_SIGGPG, "gpg"],
+ [rpm.RPMTAG_SIGPGP, 'pgp'],
+ ]
+ for ht, sig_type in header_tags:
+ ret = self.hdr[ht]
+ if not ret or len(ret) < 17:
+ continue
+ # Get the key id - hopefully we get it right
+ key_id = ret[9:17]
+ key_id_len = len(key_id)
+ format = "%dB" % key_id_len
+ t = struct.unpack(format, key_id)
+ format = "%02x" * key_id_len
+ key_id = format % t
+ self.signatures.append({
+ 'signature_type' : sig_type,
+ 'key_id' : key_id,
+ 'signature' : ret,
+ })
+
+ def get_header_byte_range(package_file):
+ """
+ Return the start and end bytes of the rpm header object.
+
+ For details of the rpm file format, see:
+ http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html
+ """
+
+ lead_size = 96
+
+ # Move past the rpm lead
+ package_file.seek(lead_size)
+
+ sig_size = get_header_struct_size(package_file)
+
+ # Now we can find the start of the actual header.
+ header_start = lead_size + sig_size
+
+ package_file.seek(header_start)
+
+ header_size = get_header_struct_size(package_file)
+
+ header_end = header_start + header_size
+
+ return (header_start, header_end)
+
+ def get_header_struct_size(package_file):
+ """
+ Compute the size in bytes of the rpm header struct starting at the current
+ position in package_file.
+ """
+ # Move past the header preamble
+ package_file.seek(8, 1)
+
+ # Read the number of index entries
+ header_index = package_file.read(4)
+ (header_index_value, ) = struct.unpack('>I', header_index)
+
+ # Read the the size of the header data store
+ header_store = package_file.read(4)
+ (header_store_value, ) = struct.unpack('>I', header_store)
+
+ # The total size of the header. Each index entry is 16 bytes long.
+ header_size = 8 + 4 + 4 + header_index_value * 16 + header_store_value
+
+ # Headers end on an 8-byte boundary. Round out the extra data.
+ round_out = header_size % 8
+ if round_out != 0:
+ header_size = header_size + (8 - round_out)
+
+ return header_size
+
+ # Loads the package header from a file / stream / file descriptor
+ # Raises rpm.error if an error is found, or InvalidPacageError if package is
+ # busted
+ # XXX Deal with exceptions better
+ def get_package_header(filename=None, file=None, fd=None):
+ if (filename is None and file is None and fd is None):
+ raise ValueError, "No parameters passed"
+
+ if filename is not None:
+ f = open(filename)
+ elif file is not None:
+ f = file
+ f.seek(0, 0)
+ else: # fd is not None
+ f = None
+
+ if f is None:
+ os.lseek(fd, 0, 0)
+ file_desc = fd
+ else:
+ file_desc = f.fileno()
+
+ if hasattr(rpm, 'headerFromPackage'):
+ hdr, is_source = rpm.headerFromPackage(file_desc)
+ if hdr is None:
+ raise InvalidPackageError
+ else:
+ if hasattr(rpm, 'readHeaderFromFD'):
+ header_start, header_end = \
+ get_header_byte_range(os.fdopen(os.dup(file_desc)))
+ os.lseek(file_desc, header_start, 0)
+ hdr, offset = rpm.readHeaderFromFD(file_desc)
+ else:
+ # RHEL-4 and older, do the old way
+ ts = RPMReadOnlyTransaction()
+ nomd5 = getattr(rpm, 'RPMVSF_NOMD5')
+ needpayload = getattr(rpm, 'RPMVSF_NEEDPAYLOAD')
+ ts.pushVSFlags(~(nomd5 | needpayload))
+ hdr = RPMReadOnlyTransaction().hdrFromFdno(file_desc)
+ ts.popVSFlags()
+ if hdr is None:
+ raise InvalidPackageError
+ is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
+
+ return RPM_Header(hdr, is_source)
+
+ class MatchIterator:
+ def __init__(self, tag_name=None, value=None):
+ # Query by name, by default
+ if not tag_name:
+ tag_name = "name"
+
+ if hasattr(rpm, "headerFromPackage"):
+ # rpm 4.0.4 or earlier
+ self.db = rpm.opendb()
+ method = self.db.match
+ else:
+ # rpm 4.1 or later
+ self.ts = rpm.TransactionSet()
+ self.ts.setVSFlags(8)
+ method = self.ts.dbMatch
+
+ if value:
+ self.mi = method(tag_name, value)
+ else:
+ self.mi = method(tag_name)
+
+ def pattern(self, tag_name, mode, pattern):
+ self.mi.pattern(tag_name, mode, pattern)
+
+ def next(self):
+ try:
+ hdr = self.mi.next()
+ except StopIteration:
+ hdr = None
+
+ if hdr is None:
+ return None
+ if hasattr(rpm, "headerFromPackage"):
+ is_source = not hdr[rpm.RPMTAG_SOURCERPM]
+ else:
+ is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
+ return RPM_Header(hdr, is_source)
+
+
+ def headerLoad(data):
+ hdr = rpm.headerLoad(data)
+ if hasattr(rpm, "headerFromPackage"):
+ is_source = not hdr[rpm.RPMTAG_SOURCERPM]
+ else:
+ is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
+ return RPM_Header(hdr, is_source)
+
+ def labelCompare(t1, t2):
+ return rpm.labelCompare(t1, t2)
+
+ def nvre_compare(t1, t2):
+ def build_evr(p):
+ evr = [p[3], p[1], p[2]]
+ evr = map(str, evr)
+ if evr[0] == "":
+ evr[0] = None
+ return evr
+ if t1[0] != t2[0]:
+ raise ValueError("You should only compare packages with the same name")
+ evr1, evr2 = (build_evr(t1), build_evr(t2))
+ return rpm.labelCompare(evr1, evr2)
+
+
+ def hdrLabelCompare(hdr1, hdr2):
+ """ take two RPMs or headers and compare them for order """
+
+ if hdr1['name'] == hdr2['name']:
+ hdr1 = [hdr1['epoch'] or None, hdr1['version'], hdr1['release']]
+ hdr2 = [hdr2['epoch'] or None, hdr2['version'], hdr2['release']]
+ if hdr1[0]:
+ hdr1[0] = str(hdr1[0])
+ if hdr2[0]:
+ hdr2[0] = str(hdr2[0])
+ return rpm.labelCompare(hdr1, hdr2)
+ elif hdr1['name'] < hdr2['name']:
+ return -1
+ return 1
+
+
+ def rpmLabelCompare(rpmFilename1, rpmFilename2):
+ """ take two RPMs and compare them for order """
+ return hdrLabelCompare(get_package_header(rpmFilename1),
+ get_package_header(rpmFilename2))
+
+
+ def sortHeaders(hdrs):
+ """ Sorts a list of RPM headers (or RPMs).
+ Assertion: they *must* exist.
+ """
+
+ assert isinstance(hdrs, type([]))
+
+ sorted = hdrs[:]
+ sorted.sort(hdrLabelCompare)
+ return sorted
+
+
+ def sortRPMs(rpms):
+ """ Sorts a list of RPM files. They *must* exist. """
+
+ assert isinstance(rpms, type([]))
+
+ # We don't want to use rpmLabelCompare as a sorting mechanism, it would
+ # extract the rpm header for each comparison.
+ # Build a list of (header, rpm)
+ helper = map(lambda x: (get_package_header(x), x), rpms)
+
+ # Sort the list using the headers as a comparison
+ helper.sort(lambda x, y: hdrLabelCompare(x[0], y[0]))
+
+ # Extract the rpm names now
+ return map(lambda x: x[1], helper)
+
+
+ def getInstalledHeader(rpmName):
+ """ quieries the RPM DB for a header matching rpmName. """
+
+ mi = MatchIterator("name")
+ mi.pattern("name", rpm.RPMMIRE_STRCMP, rpmName)
+ return mi.next()
+
+
+ if __name__ == '__main__':
+ mi = MatchIterator("name")
+ mi.pattern("name", rpm.RPMMIRE_GLOB, "*ker*")
+ while 1:
+ h = mi.next()
+ if not h:
+ break
+ print h['name']
+ sys.exit(1)
+ hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.i386.rpm")
+ print dir(hdr)
+ # Sources
+ hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.src.rpm")
+ hdr2 = headerLoad(hdr.unload())
+ print hdr2
+ print len(hdr2.keys())
+
+
diff --cc client/tools/rhnpush/uploadLib.py
index fbcf63b,ffdcc63..52b3215
--- a/client/tools/rhnpush/uploadLib.py
+++ b/client/tools/rhnpush/uploadLib.py
@@@ -21,7 -20,7 +20,8 @@@ import strin
import fnmatch
import getpass
import rhnpush_cache
+import struct
+ from rhn.common import rhn_mpm
try:
import hashlib
commit 8cba6199ddf9aa5a966570aa7c66e90acec44caf
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:39:50 2009 +0100
Automatic commit of package [spacewalk-certs-tools] release [0.8.1-1].
diff --git a/rel-eng/packages/spacewalk-certs-tools b/rel-eng/packages/spacewalk-certs-tools
index cb1efef..b7c0748 100644
--- a/rel-eng/packages/spacewalk-certs-tools
+++ b/rel-eng/packages/spacewalk-certs-tools
@@ -1 +1 @@
-0.7.2-1 spacewalk/certs-tools/
+0.8.1-1 spacewalk/certs-tools/
diff --git a/spacewalk/certs-tools/spacewalk-certs-tools.spec b/spacewalk/certs-tools/spacewalk-certs-tools.spec
index 385647b..3f882d1 100644
--- a/spacewalk/certs-tools/spacewalk-certs-tools.spec
+++ b/spacewalk/certs-tools/spacewalk-certs-tools.spec
@@ -2,7 +2,7 @@ Name: spacewalk-certs-tools
Summary: Spacewalk SSL Key/Cert Tool
Group: Applications/Internet
License: GPLv2 and Python
-Version: 0.8.0
+Version: 0.8.1
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -56,6 +56,10 @@ rm -rf $RPM_BUILD_ROOT
%{_var}/www/html/pub/bootstrap/client_config_update.py*
%changelog
+* Fri Dec 04 2009 Michael Mraka <michael.mraka(a)redhat.com> 0.8.1-1
+- rhn_rpm/rhn_mpm moved to rhnlib
+- bumping Version to 0.8.0
+
* Wed Nov 18 2009 Miroslav Suchý <msuchy(a)redhat.com> 0.7.2-1
- 538046 - Polish the spec according Fedora Packaging Guidelines
commit 6ac069011e647b8834ca4fe0a94def443bd5572e
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:38:29 2009 +0100
Automatic commit of package [spacewalk-backend] release [0.8.1-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index c841239..f0ca787 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -7,7 +7,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 0.8.0
+Version: 0.8.1
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -578,6 +578,10 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Fri Dec 04 2009 Michael Mraka <michael.mraka(a)redhat.com> 0.8.1-1
+- rhn_rpm/rhn_mpm moved to rhnlib
+- bumping Version to 0.8.0
+
* Tue Dec 1 2009 Miroslav Suchý <msuchy(a)redhat.com> 0.7.18-1
- 449167 - time.strptime can not handle None values
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 456a29d..42d30cc 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-0.7.18-1 backend/
+0.8.1-1 backend/
commit 1e42f80a10cfd3e60f9b1369b7a24a4a71487a74
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:37:39 2009 +0100
Automatic commit of package [rhnpush] release [5.4.3-1].
diff --git a/client/tools/rhnpush/rhnpush.spec b/client/tools/rhnpush/rhnpush.spec
index 64212df..10b8318 100644
--- a/client/tools/rhnpush/rhnpush.spec
+++ b/client/tools/rhnpush/rhnpush.spec
@@ -5,7 +5,7 @@ Summary: Common programs needed to be installed on the RHN servers/proxies
Group: Applications/System
License: GPLv2
URL: http://fedorahosted.org/spacewalk
-Version: 5.4.2
+Version: 5.4.3
Release: 1%{?dist}
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -49,6 +49,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man8/solaris2mpm.8*
%changelog
+* Fri Dec 04 2009 Michael Mraka <michael.mraka(a)redhat.com> 5.4.3-1
+- rhn_rpm/rhn_mpm moved to rhnlib
+
* Thu Jun 25 2009 John Matthews <jmatthew(a)redhat.com> 5.4.2-1
- merging missed chances from previous commit (pkilambi(a)redhat.com)
- removing unused modules and some clean up (pkilambi(a)redhat.com)
diff --git a/rel-eng/packages/rhnpush b/rel-eng/packages/rhnpush
index 48880cc..1f00051 100644
--- a/rel-eng/packages/rhnpush
+++ b/rel-eng/packages/rhnpush
@@ -1 +1 @@
-5.4.2-1 client/tools/rhnpush/
+5.4.3-1 client/tools/rhnpush/
commit 5f6d1d8dab580096e6ef876a47e814010bef612f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:36:24 2009 +0100
rhn_rpm/rhn_mpm merge: fixed minimal version of rhnlib
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 309fddb..c841239 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -16,7 +16,7 @@ BuildArch: noarch
Requires: python, rpm-python
# /etc/rhn is provided by spacewalk-proxy-common or by spacewalk-config
Requires: /etc/rhn
-Requires: rhnlib >= 2.2.16
+Requires: rhnlib >= 2.5.16
BuildRequires: /usr/bin/msgfmt
BuildRequires: /usr/bin/docbook2man
BuildRequires: docbook-utils
diff --git a/client/tools/rhnpush/rhnpush.spec b/client/tools/rhnpush/rhnpush.spec
index 4bcdf37..64212df 100644
--- a/client/tools/rhnpush/rhnpush.spec
+++ b/client/tools/rhnpush/rhnpush.spec
@@ -10,7 +10,7 @@ Release: 1%{?dist}
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
-Requires: rpm-python, rhnlib >= 2.2.16
+Requires: rpm-python, rhnlib >= 2.5.16
BuildRequires: docbook-utils, gettext
Summary: Package uploader for the Red Hat Network Satellite Server
diff --git a/spacewalk/certs-tools/spacewalk-certs-tools.spec b/spacewalk/certs-tools/spacewalk-certs-tools.spec
index 3ac18e5..385647b 100644
--- a/spacewalk/certs-tools/spacewalk-certs-tools.spec
+++ b/spacewalk/certs-tools/spacewalk-certs-tools.spec
@@ -10,7 +10,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: openssl rpm-build
Requires: rhn-client-tools
-Requires: rhnlib >= 2.2.16
+Requires: rhnlib >= 2.5.16
BuildRequires: docbook-utils
BuildRequires: python
Obsoletes: rhns-certs < 5.3.0
commit 20ab17ad8a95b48620da413de06758efe7e745d0
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:33:50 2009 +0100
Automatic commit of package [rhnlib] release [2.5.16-1].
diff --git a/client/rhel/rhnlib/rhnlib.spec b/client/rhel/rhnlib/rhnlib.spec
index a1792a7..3f987f1 100644
--- a/client/rhel/rhnlib/rhnlib.spec
+++ b/client/rhel/rhnlib/rhnlib.spec
@@ -4,7 +4,7 @@ Summary: Python libraries for the RHN project
Name: rhnlib
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 2.5.15
+Version: 2.5.16
Release: 1%{?dist}
Group: Development/Libraries
@@ -54,6 +54,9 @@ rm -rf $RPM_BUILD_ROOT
%{python_sitelib}/*
%changelog
+* Fri Dec 04 2009 Michael Mraka <michael.mraka(a)redhat.com> 2.5.16-1
+- added rhn_rpm and rhn_mpm
+
* Wed Nov 25 2009 Miroslav Suchý <msuchy(a)redhat.com> 2.5.15-1
- aamt is not Null in most cases, move it more to right
- replace len() with ==
diff --git a/rel-eng/packages/rhnlib b/rel-eng/packages/rhnlib
index 66bfa13..543e357 100644
--- a/rel-eng/packages/rhnlib
+++ b/rel-eng/packages/rhnlib
@@ -1 +1 @@
-2.5.15-1 client/rhel/rhnlib/
+2.5.16-1 client/rhel/rhnlib/
commit 52053b203dd566ff7657a0e67a5ac2add8f18b32
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:30:28 2009 +0100
fixed rpmlint error: rhnlib.noarch: E: non-executable-script /usr/lib/python2.6/site-packages/rhn/common/rhn_rpm.py 0644 /usr/bin/python
diff --git a/client/rhel/rhnlib/rhn/common/rhn_mpm.py b/client/rhel/rhnlib/rhn/common/rhn_mpm.py
index 9713867..0d339d8 100644
--- a/client/rhel/rhnlib/rhn/common/rhn_mpm.py
+++ b/client/rhel/rhnlib/rhn/common/rhn_mpm.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
#
# Copyright (c) 2008 Red Hat, Inc.
#
diff --git a/client/rhel/rhnlib/rhn/common/rhn_rpm.py b/client/rhel/rhnlib/rhn/common/rhn_rpm.py
index 0ff9965..66a46e1 100644
--- a/client/rhel/rhnlib/rhn/common/rhn_rpm.py
+++ b/client/rhel/rhnlib/rhn/common/rhn_rpm.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
#
# Copyright (c) 2008 Red Hat, Inc.
#
commit 3954f368a20fe6c579bbcf18c6da881cc2fb046f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:27:53 2009 +0100
rhn_rpm/rhn_mpm merge: fixed spec and Makefile to reflect rhn_rpm move
deleted copy of rhn_rpm/rhn_mpm
diff --git a/client/tools/rhnpush/Makefile.rhnpush b/client/tools/rhnpush/Makefile.rhnpush
index fc80e4c..247aa1e 100644
--- a/client/tools/rhnpush/Makefile.rhnpush
+++ b/client/tools/rhnpush/Makefile.rhnpush
@@ -9,7 +9,7 @@ INSTALL_DATA = $(INSTALL) -m 644
SUBDIR = rhnpush
FILES = rhnpush rhnpush_v2 uploadLib __init__ connection \
- rhn_rpm rhn_mpm rpm2mpm solaris2mpm utils rhnpush_cache \
+ rpm2mpm solaris2mpm utils rhnpush_cache \
rhnpush_config rhnpush_confmanager archive
RHN_CONF_DIR = /etc/sysconfig/rhn
diff --git a/client/tools/rhnpush/rhn_mpm.py b/client/tools/rhnpush/rhn_mpm.py
deleted file mode 100644
index 8d195e6..0000000
--- a/client/tools/rhnpush/rhn_mpm.py
+++ /dev/null
@@ -1,289 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-#
-# Meta-package manager
-#
-# $Id$
-#
-# Author: Mihai Ibanescu <misa(a)redhat.com>
-
-import os
-import gzip
-import cStringIO
-import tempfile
-from rhn.rpclib import xmlrpclib
-
-import struct
-
-from types import ListType, TupleType, DictType
-
-def labelCompare(l1, l2):
- try:
- import rhn_rpm
- except ImportError:
- # rhn_rpm not avalable; return a dummy comparison function
- return -1
- return rhn_rpm.labelCompare(l1, l2)
-
-def get_package_header(filename=None, file=None, fd=None):
- return load(filename=filename, file=file, fd=fd)[0]
-
-# Loads an MPM and returns its header and its payload
-def load(filename=None, file=None, fd=None):
- if (filename is None and file is None and fd is None):
- raise ValueError, "No parameters passed"
-
- if filename is not None:
- f = open(filename)
- elif file is not None:
- f = file
- else: # fd is not None
- f = os.fdopen(os.dup(fd), "r")
-
- f.seek(0, 0)
-
- p = MPM_Package()
- try:
- p.load(f)
- except InvalidPackageError, e:
- try:
- return load_rpm(f)
- except InvalidPackageError:
- raise e
-
- return p.header, p.payload_stream
-
-def load_rpm(stream):
- # Hmm, maybe an rpm
-
- try:
- import rhn_rpm
- except ImportError:
- raise InvalidPackageError
-
- # Dup the file descriptor, we don't want it to get closed before we read
- # the payload
- newfd = os.dup(stream.fileno())
- stream = os.fdopen(newfd, "r")
-
- stream.flush()
- stream.seek(0, 0)
-
- try:
- header = rhn_rpm.get_package_header(file=stream)
- except rhn_rpm.InvalidPackageError, e:
- raise apply(InvalidPackageError, e.args)
- except rhn_rpm.error, e:
- raise InvalidPackageError(e)
- stream.seek(0, 0)
-
- return header, stream
-
-class MPM_Header:
- "Wrapper class for an mpm header - we need to store a flag is_source"
- def __init__(self, hdr):
- self.hdr = hdr
- self.is_source = hdr.get('is_source')
- self.packaging = 'mpm'
- self.signatures = []
-
- def __getitem__(self, name):
- return self.hdr.get(name)
-
- def __setitem__(self, name, item):
- self.hdr[name] = item
-
- def __delitem__(self, name):
- del self.hdr[name]
-
- def __getattr__(self, name):
- return getattr(self.hdr, name)
-
- def is_signed(self):
- return 0
-
-class InvalidPackageError(Exception):
- pass
-
-MPM_HEADER_COMPRESSED_GZIP = 1
-MPM_PAYLOAD_COMPRESSED_GZIP = 1
-
-class MPM_Package:
- _lead_format = '!16sB3s4L92s'
- _magic = 'mpmpackage012345'
- def __init__(self):
- self.header = None
- self.payload_stream = None
- self.header_flags = MPM_HEADER_COMPRESSED_GZIP
- self.payload_flags = 0
- assert(len(self._magic) == 16)
- self._buffer_size = 16384
-
- def _read_lead(self, stream):
- # Lead has the following format:
- # 16 bytes magic
- # 1 bytes version
- # 3 bytes unused
- # 4 bytes header flags
- # 4 bytes payload flags
- # 4 bytes header length
- # 4 bytes payload length
- # 92 bytes padding to 128 bytes
- lead = self._read_bytes(stream, 128)
- if len(lead) != 128:
- raise InvalidPackageError()
-
- arr = struct.unpack(self._lead_format, lead)
- return arr
-
- def load(self, input_stream):
- # Clean up
- self.__init__()
- arr = self._read_lead(input_stream)
- magic = arr[0]
- if magic != self._magic:
- raise InvalidPackageError()
- header_len, payload_len = int(arr[5]), int(arr[6])
- header_flags, payload_flags = arr[3], arr[4]
- file_size = 128 + header_len + payload_len
- input_stream.seek(file_size)
- if file_size != input_stream.tell():
- raise InvalidPackageError()
- # Read the header
- input_stream.seek(128, 0)
- header_data = self._read_bytes(input_stream, header_len)
- payload_stream = tempfile.TemporaryFile()
- self.stream_copy(input_stream, payload_stream)
-
- self._read_header(header_data, header_flags)
- self._read_payload(payload_stream, payload_flags)
-
- def _read_bytes(self, stream, amt):
- ret = ""
- while amt:
- buf = stream.read(min(amt, self._buffer_size))
- if not buf:
- return ret
- ret = ret + buf
- amt = amt - len(buf)
- return ret
-
- def _read_header(self, header_data, header_flags):
- if header_flags & MPM_HEADER_COMPRESSED_GZIP:
- t = cStringIO.StringIO(header_data)
- g = gzip.GzipFile(None, "r", 0, t)
- header_data = g.read()
- g.close()
- t.close()
-
- try:
- params, foo = xmlrpclib.loads(header_data)
- except:
- # XXX
- raise
-
- self.header = MPM_Header(params[0])
-
- def _read_payload(self, payload_stream, payload_flags):
- payload_stream.seek(0, 0)
- if payload_flags & MPM_PAYLOAD_COMPRESSED_GZIP:
- g = gzip.GzipFile(None, "r", 0, payload_stream)
- t = tempfile.TemporaryFile()
- self.stream_copy(g, t)
- g.close()
- payload_stream = t
-
- self.payload_stream = payload_stream
-
- def write(self, output_stream):
- if self.header is None:
- raise Exception()
-
- header_stream, header_size = self._encode_header()
- payload_stream, payload_size = self._encode_payload()
-
- lead_arr = (self._magic, 1, "\0" * 3, self.header_flags,
- self.payload_flags, header_size, payload_size, '\0' * 92)
- # lead
- lead = apply(struct.pack, (self._lead_format, ) + lead_arr)
- output_stream.write(lead)
- self.stream_copy(header_stream, output_stream)
- self.stream_copy(payload_stream, output_stream)
-
- def add_header_flag(self, flag):
- self.header_flags = self.header_flags | flag
-
- def add_payload_flag(self, flag):
- self.payload_flags = self.payload_flags | flag
-
- def reset_header_flags(self):
- self.header_flags = 0
-
- def reset_payload_flags(self):
- self.payload_flags = 0
-
- def _encode_header(self):
- assert(self.header is not None)
- stream = tempfile.TemporaryFile()
- data = xmlrpclib.dumps((_replace_null(self.header), ))
- if self.header_flags & MPM_HEADER_COMPRESSED_GZIP:
- f = gzip.GzipFile(None, "wb", 9, stream)
- f.write(data)
- f.close()
- else:
- stream.write(data)
- stream.flush()
- stream.seek(0, 2)
- size = stream.tell()
- stream.seek(0, 0)
- return stream, size
-
- def _encode_payload(self):
- assert(self.payload_stream is not None)
- stream = tempfile.TemporaryFile()
- if self.payload_flags & MPM_PAYLOAD_COMPRESSED_GZIP:
- f = gzip.GzipFile(None, "wb", 9, stream)
- self.stream_copy(self.payload_stream, f)
- f.close()
- else:
- stream = self.payload_stream
- stream.flush()
- stream.seek(0, 2)
- size = stream.tell()
- stream.seek(0, 0)
- return stream, size
-
- def stream_copy(self, source, dest):
- "Copies data from the source stream to the destination stream"
- while 1:
- buf = source.read(self._buffer_size)
- if not buf:
- break
- dest.write(buf)
-
-
-def _replace_null(obj):
- if obj is None:
- return ''
- if isinstance(obj, ListType):
- return map(_replace_null, obj)
- if isinstance(obj, TupleType):
- return tuple(_replace_null(list(obj)))
- if hasattr(obj, 'items'):
- dict = {}
- for k, v in obj.items():
- dict[_replace_null(k)] = _replace_null(v)
- return dict
- return obj
diff --git a/client/tools/rhnpush/rhn_rpm.py b/client/tools/rhnpush/rhn_rpm.py
deleted file mode 100644
index 5c762a0..0000000
--- a/client/tools/rhnpush/rhn_rpm.py
+++ /dev/null
@@ -1,370 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-import os
-import sys
-import rpm
-import struct
-
-import exceptions
-if not hasattr(exceptions, 'StopIteration'):
- # Presumably python 1.5.2
- class StopIteration(Exception):
- pass
-
-# Expose a bunch of useful constants from rpm
-error = rpm.error
-for sym, val in rpm.__dict__.items():
- if sym[:3] == 'RPM':
- # A constant, probably - import it into our namespace
- globals()[sym] = val
-del sym, val
-
-class InvalidPackageError(Exception):
- pass
-
-# wrapper/proxy class for rpm.Transaction so we can
-# instrument it, etc easily
-class RPMTransaction:
- read_only = 0
- def __init__(self):
- if hasattr(rpm, 'opendb'):
- db = getattr(rpm, 'opendb')(not self.read_only)
- self.ts = rpm.TransactionSet('/', db)
- else:
- self.ts = rpm.TransactionSet()
- self.tsflags = []
- # For rpm 4.0.4
- self._flags = 0
- self._prob_filter = 0
-
- def __getattr__(self, attr):
- return getattr(self.ts, attr)
-
- def getMethod(self, method):
- # in theory, we can override this with
- # profile/etc info
- return getattr(self.ts, method)
-
- # push/pop methods so we don't lose the previous
- # set value, and we can potentially debug a bit
- # easier
- def pushVSFlags(self, flags):
- self.tsflags.append(flags)
- if hasattr(self.ts, 'setVSFlags'):
- f = getattr(self.ts, 'setVSFlags')
- f(self.tsflags[-1])
-
- def popVSFlags(self):
- del self.tsflags[-1]
- if hasattr(self.ts, 'setVSFlags'):
- f = getattr(self.ts, 'setVSFlags')
- f(self.tsflags[-1])
-
- def addInstall(self, arg1, arg2, mode):
- """Install a package"""
- hdr = arg1.hdr
- if hasattr(self.ts, 'addInstall'):
- f = getattr(self.ts, 'addInstall')
- return f(hdr, arg2, mode)
- return self.ts.add(hdr, arg2, mode)
-
- def addErase(self, arg1):
- """Erase a package"""
- hdr = arg1.hdr
- if hasattr(self.ts, 'addErase'):
- f = getattr(self.ts, 'addErase')
- return f(hdr)
- return self.ts.add(hdr, hdr, "e")
-
- def check(self):
- """Check dependencies"""
- if hasattr(self.ts, 'check'):
- f = getattr(self.ts, 'check')
- else:
- f = getattr(self.ts, 'depcheck')
- return f()
-
- def setFlags(self, flag):
- """Set transaction flags"""
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- old_flags = self._flags
- self._flags = flag
- return old_flags
- return self.ts.setFlags(flag)
-
- def setProbFilter(self, flag):
- """Set problem flags"""
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- old_flags = self._prob_filter
- self._prob_filter = flag
- return old_flags
- return self.ts.setProbFilter(flag)
-
- def run(self, callback, user_data):
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- return self.ts.run(self._flags, self._prob_filter, callback,
- user_data)
- return self.ts.run(callback, user_data)
-
-
-
-
-class SharedStateTransaction:
- _shared_state = {}
-
- def __init__(self):
- self.__dict__ = self._shared_state
-
-class RPMReadOnlyTransaction(SharedStateTransaction, RPMTransaction):
- read_only = 1
- def __init__(self):
- SharedStateTransaction.__init__(self)
- if not hasattr(self, 'ts'):
- RPMTransaction.__init__(self)
- # FIXME: replace with macro defination
- self.pushVSFlags(8)
-
-class RPM_Header:
- "Wrapper class for an rpm header - we need to store a flag is_source"
- def __init__(self, hdr, is_source=None):
- self.hdr = hdr
- self.is_source = is_source
- self.packaging = 'rpm'
- self.signatures = []
- self._extract_signatures()
-
- def __getitem__(self, name):
- return self.hdr[name]
-
- def __getattr__(self, name):
- return getattr(self.hdr, name)
-
- def is_signed(self):
- if hasattr(rpm, "RPMTAG_DSAHEADER"):
- dsaheader = self.hdr["dsaheader"]
- else:
- dsaheader = 0
- if self.hdr["siggpg"] or self.hdr["sigpgp"] or dsaheader:
- return 1
- return 0
-
- def _extract_signatures(self):
- header_tags = [
- [rpm.RPMTAG_DSAHEADER, "dsa"],
- [rpm.RPMTAG_RSAHEADER, "rsa"],
- [rpm.RPMTAG_SIGGPG, "gpg"],
- [rpm.RPMTAG_SIGPGP, 'pgp'],
- ]
- for ht, sig_type in header_tags:
- ret = self.hdr[ht]
- if not ret or len(ret) < 17:
- continue
- # Get the key id - hopefully we get it right
- key_id = ret[9:17]
- key_id_len = len(key_id)
- format = "%dB" % key_id_len
- t = struct.unpack(format, key_id)
- format = "%02x" * key_id_len
- key_id = format % t
- self.signatures.append({
- 'signature_type' : sig_type,
- 'key_id' : key_id,
- 'signature' : ret,
- })
-
-
-# Loads the package header from a file / stream / file descriptor
-# Raises rpm.error if an error is found, or InvalidPacageError if package is
-# busted
-# XXX Deal with exceptions better
-def get_package_header(filename=None, file=None, fd=None):
- if (filename is None and file is None and fd is None):
- raise ValueError, "No parameters passed"
-
- if filename is not None:
- f = open(filename)
- elif file is not None:
- f = file
- f.seek(0, 0)
- else: # fd is not None
- f = None
-
- if f is None:
- os.lseek(fd, 0, 0)
- file_desc = fd
- else:
- file_desc = f.fileno()
-
- if hasattr(rpm, 'headerFromPackage'):
- hdr, is_source = rpm.headerFromPackage(file_desc)
- if hdr is None:
- raise InvalidPackageError
- else:
- ts = RPMReadOnlyTransaction()
- nomd5 = getattr(rpm, 'RPMVSF_NOMD5')
- needpayload = getattr(rpm, 'RPMVSF_NEEDPAYLOAD')
- ts.pushVSFlags(~(nomd5 | needpayload))
- hdr = RPMReadOnlyTransaction().hdrFromFdno(file_desc)
- ts.popVSFlags()
- if hdr is None:
- raise InvalidPackageError
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
-
- return RPM_Header(hdr, is_source)
-
-class MatchIterator:
- def __init__(self, tag_name=None, value=None):
- # Query by name, by default
- if not tag_name:
- tag_name = "name"
-
- if hasattr(rpm, "headerFromPackage"):
- # rpm 4.0.4 or earlier
- self.db = rpm.opendb()
- method = self.db.match
- else:
- # rpm 4.1 or later
- self.ts = rpm.TransactionSet()
- self.ts.setVSFlags(8)
- method = self.ts.dbMatch
-
- if value:
- self.mi = method(tag_name, value)
- else:
- self.mi = method(tag_name)
-
- def pattern(self, tag_name, mode, pattern):
- self.mi.pattern(tag_name, mode, pattern)
-
- def next(self):
- try:
- hdr = self.mi.next()
- except StopIteration:
- hdr = None
-
- if hdr is None:
- return None
- if hasattr(rpm, "headerFromPackage"):
- is_source = not hdr[rpm.RPMTAG_SOURCERPM]
- else:
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
- return RPM_Header(hdr, is_source)
-
-
-def headerLoad(data):
- hdr = rpm.headerLoad(data)
- if hasattr(rpm, "headerFromPackage"):
- is_source = not hdr[rpm.RPMTAG_SOURCERPM]
- else:
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
- return RPM_Header(hdr, is_source)
-
-def labelCompare(t1, t2):
- return rpm.labelCompare(t1, t2)
-
-def nvre_compare(t1, t2):
- def build_evr(p):
- evr = [p[3], p[1], p[2]]
- evr = map(str, evr)
- if evr[0] == "":
- evr[0] = None
- return evr
- if t1[0] != t2[0]:
- raise ValueError("You should only compare packages with the same name")
- evr1, evr2 = (build_evr(t1), build_evr(t2))
- return rpm.labelCompare(evr1, evr2)
-
-
-def hdrLabelCompare(hdr1, hdr2):
- """ take two RPMs or headers and compare them for order """
-
- if hdr1['name'] == hdr2['name']:
- hdr1 = [hdr1['epoch'] or None, hdr1['version'], hdr1['release']]
- hdr2 = [hdr2['epoch'] or None, hdr2['version'], hdr2['release']]
- if hdr1[0]:
- hdr1[0] = str(hdr1[0])
- if hdr2[0]:
- hdr2[0] = str(hdr2[0])
- return rpm.labelCompare(hdr1, hdr2)
- elif hdr1['name'] < hdr2['name']:
- return -1
- return 1
-
-
-def rpmLabelCompare(rpmFilename1, rpmFilename2):
- """ take two RPMs and compare them for order """
- return hdrLabelCompare(get_package_header(rpmFilename1),
- get_package_header(rpmFilename2))
-
-
-def sortHeaders(hdrs):
- """ Sorts a list of RPM headers (or RPMs).
- Assertion: they *must* exist.
- """
-
- assert isinstance(hdrs, type([]))
-
- sorted = hdrs[:]
- sorted.sort(hdrLabelCompare)
- return sorted
-
-
-def sortRPMs(rpms):
- """ Sorts a list of RPM files. They *must* exist. """
-
- assert isinstance(rpms, type([]))
-
- # We don't want to use rpmLabelCompare as a sorting mechanism, it would
- # extract the rpm header for each comparison.
- # Build a list of (header, rpm)
- helper = map(lambda x: (get_package_header(x), x), rpms)
-
- # Sort the list using the headers as a comparison
- helper.sort(lambda x, y: hdrLabelCompare(x[0], y[0]))
-
- # Extract the rpm names now
- return map(lambda x: x[1], helper)
-
-
-def getInstalledHeader(rpmName):
- """ quieries the RPM DB for a header matching rpmName. """
-
- mi = MatchIterator("name")
- mi.pattern("name", rpm.RPMMIRE_STRCMP, rpmName)
- return mi.next()
-
-
-if __name__ == '__main__':
- mi = MatchIterator("name")
- mi.pattern("name", rpm.RPMMIRE_GLOB, "*ker*")
- while 1:
- h = mi.next()
- if not h:
- break
- print h['name']
- sys.exit(1)
- hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.i386.rpm")
- print dir(hdr)
- # Sources
- hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.src.rpm")
- hdr2 = headerLoad(hdr.unload())
- print hdr2
- print len(hdr2.keys())
-
-
diff --git a/client/tools/rhnpush/rhnpush.spec b/client/tools/rhnpush/rhnpush.spec
index 9a9f6e9..4bcdf37 100644
--- a/client/tools/rhnpush/rhnpush.spec
+++ b/client/tools/rhnpush/rhnpush.spec
@@ -10,7 +10,7 @@ Release: 1%{?dist}
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
-Requires: rpm-python, rhnlib
+Requires: rpm-python, rhnlib >= 2.2.16
BuildRequires: docbook-utils, gettext
Summary: Package uploader for the Red Hat Network Satellite Server
commit 69a1a99a68f573e6ed74883e81b85098510a1f22
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:25:19 2009 +0100
rhn_rpm/rhn_mpm merge: let rhnpush use rhn_rpm/rhn_mpm from rhnlib
instead of it's own copy
diff --git a/client/tools/rhnpush/connection.py b/client/tools/rhnpush/connection.py
index 8d2e3a6..5a434ad 100644
--- a/client/tools/rhnpush/connection.py
+++ b/client/tools/rhnpush/connection.py
@@ -39,7 +39,7 @@ from types import ListType, TupleType, IntType
from rhn import connections, rpclib
-import rhn_mpm
+from rhn.common import rhn_mpm
class ConnectionError(Exception):
pass
diff --git a/client/tools/rhnpush/rhnpush.py b/client/tools/rhnpush/rhnpush.py
index 5aac00a..cb50127 100755
--- a/client/tools/rhnpush/rhnpush.py
+++ b/client/tools/rhnpush/rhnpush.py
@@ -37,7 +37,6 @@ import time
import urlparse
import rhnpush_cache
import rhnpush_confmanager
-import rhn_mpm
from types import IntType, StringType
try:
@@ -45,6 +44,7 @@ try:
except ImportError:
from optik import Option, OptionParser
from rhn import rpclib
+from rhn.common import rhn_mpm
import uploadLib
import rhnpush_v2
diff --git a/client/tools/rhnpush/rpm2mpm.py b/client/tools/rhnpush/rpm2mpm.py
index d9295e1..a6105b3 100644
--- a/client/tools/rhnpush/rpm2mpm.py
+++ b/client/tools/rhnpush/rpm2mpm.py
@@ -20,8 +20,7 @@ from types import ListType, TupleType, DictType
import gzip
import cStringIO
-import rhn_rpm
-import rhn_mpm
+from rhn.common import rhn_rpm, rhn_mpm
def main():
packages = sys.argv[1:]
diff --git a/client/tools/rhnpush/solaris2mpm.py b/client/tools/rhnpush/solaris2mpm.py
index 5be7b76..411dfe7 100644
--- a/client/tools/rhnpush/solaris2mpm.py
+++ b/client/tools/rhnpush/solaris2mpm.py
@@ -39,7 +39,7 @@ except ImportError:
if checksum not in ['md5', 'sha1']:
raise ValueError, "Incompatible checksum type"
-import rhn_mpm
+from rhn.common import rhn_mpm
from archive import get_archive_parser
diff --git a/client/tools/rhnpush/uploadLib.py b/client/tools/rhnpush/uploadLib.py
index f420de3..ffdcc63 100644
--- a/client/tools/rhnpush/uploadLib.py
+++ b/client/tools/rhnpush/uploadLib.py
@@ -16,11 +16,11 @@
# system imports
import os
import sys
-import rhn_mpm
import string
import fnmatch
import getpass
import rhnpush_cache
+from rhn.common import rhn_mpm
try:
import hashlib
@@ -726,7 +726,7 @@ def packageCompare(pkg1, pkg2, is_mpm=None):
if is_mpm:
func = rhn_mpm.labelCompare
else:
- import rhn_rpm
+ from rhn.common import rhn_rpm
func = rhn_rpm.labelCompare
return func(packages[0], packages[1])
commit 1a86f0f8232d7ccc064783e6af448d33f5b5035c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:17:52 2009 +0100
rhn_rpm/rhn_mpm merge: merged changes from rhnpush/rhn_mpm.py
diff --git a/client/rhel/rhnlib/rhn/common/rhn_mpm.py b/client/rhel/rhnlib/rhn/common/rhn_mpm.py
index 400f5d2..9713867 100644
--- a/client/rhel/rhnlib/rhn/common/rhn_mpm.py
+++ b/client/rhel/rhnlib/rhn/common/rhn_mpm.py
@@ -22,7 +22,7 @@ from rhn.rpclib import xmlrpclib
import struct
-from types import ListType, TupleType
+from types import ListType, TupleType, DictType
def labelCompare(l1, l2):
try:
@@ -97,6 +97,12 @@ class MPM_Header:
def __getitem__(self, name):
return self.hdr.get(name)
+ def __setitem__(self, name, item):
+ self.hdr[name] = item
+
+ def __delitem__(self, name):
+ del self.hdr[name]
+
def __getattr__(self, name):
return getattr(self.hdr, name)
commit e748014a394e9986a1d335c66648dcc05099031c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:08:38 2009 +0100
rhn_rpm/rhn_mpm merge: remove copy of rhn_rpm from certs-tools
diff --git a/spacewalk/certs-tools/rhn_rpm.py b/spacewalk/certs-tools/rhn_rpm.py
deleted file mode 100644
index 1e3d66d..0000000
--- a/spacewalk/certs-tools/rhn_rpm.py
+++ /dev/null
@@ -1,375 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-#
-# Compatibility layer for rpm
-#
-# $Id$
-
-import os
-import sys
-import rpm
-import struct
-
-import exceptions
-if not hasattr(exceptions, 'StopIteration'):
- # Presumably python 1.5.2
- class StopIteration(Exception):
- pass
-
-# Expose a bunch of useful constants from rpm
-error = rpm.error
-for sym, val in rpm.__dict__.items():
- if sym[:3] == 'RPM':
- # A constant, probably - import it into our namespace
- globals()[sym] = val
-del sym, val
-
-class InvalidPackageError(Exception):
- pass
-
-# wrapper/proxy class for rpm.Transaction so we can
-# instrument it, etc easily
-class RPMTransaction:
- read_only = 0
- def __init__(self):
- if hasattr(rpm, 'opendb'):
- db = getattr(rpm, 'opendb')(not self.read_only)
- self.ts = rpm.TransactionSet('/', db)
- else:
- self.ts = rpm.TransactionSet()
- self.tsflags = []
- # For rpm 4.0.4
- self._flags = 0
- self._prob_filter = 0
-
- def __getattr__(self, attr):
- return getattr(self.ts, attr)
-
- def getMethod(self, method):
- # in theory, we can override this with
- # profile/etc info
- return getattr(self.ts, method)
-
- # push/pop methods so we don't lose the previous
- # set value, and we can potentially debug a bit
- # easier
- def pushVSFlags(self, flags):
- self.tsflags.append(flags)
- if hasattr(self.ts, 'setVSFlags'):
- f = getattr(self.ts, 'setVSFlags')
- f(self.tsflags[-1])
-
- def popVSFlags(self):
- del self.tsflags[-1]
- if hasattr(self.ts, 'setVSFlags'):
- f = getattr(self.ts, 'setVSFlags')
- f(self.tsflags[-1])
-
- def addInstall(self, arg1, arg2, mode):
- """Install a package"""
- hdr = arg1.hdr
- if hasattr(self.ts, 'addInstall'):
- f = getattr(self.ts, 'addInstall')
- return f(hdr, arg2, mode)
- return self.ts.add(hdr, arg2, mode)
-
- def addErase(self, arg1):
- """Erase a package"""
- hdr = arg1.hdr
- if hasattr(self.ts, 'addErase'):
- f = getattr(self.ts, 'addErase')
- return f(hdr)
- return self.ts.add(hdr, hdr, "e")
-
- def check(self):
- """Check dependencies"""
- if hasattr(self.ts, 'check'):
- f = getattr(self.ts, 'check')
- else:
- f = getattr(self.ts, 'depcheck')
- return f()
-
- def setFlags(self, flag):
- """Set transaction flags"""
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- old_flags = self._flags
- self._flags = flag
- return old_flags
- return self.ts.setFlags(flag)
-
- def setProbFilter(self, flag):
- """Set problem flags"""
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- old_flags = self._prob_filter
- self._prob_filter = flag
- return old_flags
- return self.ts.setProbFilter(flag)
-
- def run(self, callback, user_data):
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- return self.ts.run(self._flags, self._prob_filter, callback,
- user_data)
- return self.ts.run(callback, user_data)
-
-
-
-
-class SharedStateTransaction:
- _shared_state = {}
-
- def __init__(self):
- self.__dict__ = self._shared_state
-
-class RPMReadOnlyTransaction(SharedStateTransaction, RPMTransaction):
- read_only = 1
- def __init__(self):
- SharedStateTransaction.__init__(self)
- if not hasattr(self, 'ts'):
- RPMTransaction.__init__(self)
- # FIXME: replace with macro defination
- self.pushVSFlags(8)
-
-class RPM_Header:
- "Wrapper class for an rpm header - we need to store a flag is_source"
- def __init__(self, hdr, is_source=None):
- self.hdr = hdr
- self.is_source = is_source
- self.packaging = 'rpm'
- self.signatures = []
- self._extract_signatures()
-
- def __getitem__(self, name):
- return self.hdr[name]
-
- def __getattr__(self, name):
- return getattr(self.hdr, name)
-
- def is_signed(self):
- if hasattr(rpm, "RPMTAG_DSAHEADER"):
- dsaheader = self.hdr["dsaheader"]
- else:
- dsaheader = 0
- if self.hdr["siggpg"] or self.hdr["sigpgp"] or dsaheader:
- return 1
- return 0
-
- def _extract_signatures(self):
- header_tags = [
- [rpm.RPMTAG_DSAHEADER, "dsa"],
- [rpm.RPMTAG_RSAHEADER, "rsa"],
- [rpm.RPMTAG_SIGGPG, "gpg"],
- [rpm.RPMTAG_SIGPGP, 'pgp'],
- ]
- for ht, sig_type in header_tags:
- ret = self.hdr[ht]
- if not ret or len(ret) < 17:
- continue
- # Get the key id - hopefully we get it right
- key_id = ret[9:17]
- key_id_len = len(key_id)
- format = "%dB" % key_id_len
- t = struct.unpack(format, key_id)
- format = "%02x" * key_id_len
- key_id = format % t
- self.signatures.append({
- 'signature_type' : sig_type,
- 'key_id' : key_id,
- 'signature' : ret,
- })
-
-
-# Loads the package header from a file / stream / file descriptor
-# Raises rpm.error if an error is found, or InvalidPacageError if package is
-# busted
-# XXX Deal with exceptions better
-def get_package_header(filename=None, file=None, fd=None):
- if (filename is None and file is None and fd is None):
- raise ValueError, "No parameters passed"
-
- if filename is not None:
- f = open(filename)
- elif file is not None:
- f = file
- f.seek(0, 0)
- else: # fd is not None
- f = None
-
- if f is None:
- os.lseek(fd, 0, 0)
- file_desc = fd
- else:
- file_desc = f.fileno()
-
- if hasattr(rpm, 'headerFromPackage'):
- hdr, is_source = rpm.headerFromPackage(file_desc)
- if hdr is None:
- raise InvalidPackageError
- else:
- ts = RPMReadOnlyTransaction()
- nomd5 = getattr(rpm, 'RPMVSF_NOMD5')
- needpayload = getattr(rpm, 'RPMVSF_NEEDPAYLOAD')
- ts.pushVSFlags(~(nomd5 | needpayload))
- hdr = RPMReadOnlyTransaction().hdrFromFdno(file_desc)
- ts.popVSFlags()
- if hdr is None:
- raise InvalidPackageError
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
-
- return RPM_Header(hdr, is_source)
-
-class MatchIterator:
- def __init__(self, tag_name=None, value=None):
- # Query by name, by default
- if not tag_name:
- tag_name = "name"
-
- if hasattr(rpm, "headerFromPackage"):
- # rpm 4.0.4 or earlier
- self.db = rpm.opendb()
- method = self.db.match
- else:
- # rpm 4.1 or later
- self.ts = rpm.TransactionSet()
- self.ts.setVSFlags(8)
- method = self.ts.dbMatch
-
- if value:
- self.mi = method(tag_name, value)
- else:
- self.mi = method(tag_name)
-
- def pattern(self, tag_name, mode, pattern):
- self.mi.pattern(tag_name, mode, pattern)
-
- def next(self):
- try:
- hdr = self.mi.next()
- except StopIteration:
- hdr = None
-
- if hdr is None:
- return None
- if hasattr(rpm, "headerFromPackage"):
- is_source = not hdr[rpm.RPMTAG_SOURCERPM]
- else:
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
- return RPM_Header(hdr, is_source)
-
-
-def headerLoad(data):
- hdr = rpm.headerLoad(data)
- if hasattr(rpm, "headerFromPackage"):
- is_source = not hdr[rpm.RPMTAG_SOURCERPM]
- else:
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
- return RPM_Header(hdr, is_source)
-
-def labelCompare(t1, t2):
- return rpm.labelCompare(t1, t2)
-
-def nvre_compare(t1, t2):
- def build_evr(p):
- evr = [p[3], p[1], p[2]]
- evr = map(str, evr)
- if evr[0] == "":
- evr[0] = None
- return evr
- if t1[0] != t2[0]:
- raise ValueError("You should only compare packages with the same name")
- evr1, evr2 = (build_evr(t1), build_evr(t2))
- return rpm.labelCompare(evr1, evr2)
-
-
-def hdrLabelCompare(hdr1, hdr2):
- """ take two RPMs or headers and compare them for order """
-
- if hdr1['name'] == hdr2['name']:
- hdr1 = [hdr1['epoch'] or None, hdr1['version'], hdr1['release']]
- hdr2 = [hdr2['epoch'] or None, hdr2['version'], hdr2['release']]
- if hdr1[0]:
- hdr1[0] = str(hdr1[0])
- if hdr2[0]:
- hdr2[0] = str(hdr2[0])
- return rpm.labelCompare(hdr1, hdr2)
- elif hdr1['name'] < hdr2['name']:
- return -1
- return 1
-
-
-def rpmLabelCompare(rpmFilename1, rpmFilename2):
- """ take two RPMs and compare them for order """
- return hdrLabelCompare(get_package_header(rpmFilename1),
- get_package_header(rpmFilename2))
-
-
-def sortHeaders(hdrs):
- """ Sorts a list of RPM headers (or RPMs).
- Assertion: they *must* exist.
- """
-
- assert isinstance(hdrs, type([]))
-
- sorted = hdrs[:]
- sorted.sort(hdrLabelCompare)
- return sorted
-
-
-def sortRPMs(rpms):
- """ Sorts a list of RPM files. They *must* exist. """
-
- assert isinstance(rpms, type([]))
-
- # We don't want to use rpmLabelCompare as a sorting mechanism, it would
- # extract the rpm header for each comparison.
- # Build a list of (header, rpm)
- helper = map(lambda x: (get_package_header(x), x), rpms)
-
- # Sort the list using the headers as a comparison
- helper.sort(lambda x, y: hdrLabelCompare(x[0], y[0]))
-
- # Extract the rpm names now
- return map(lambda x: x[1], helper)
-
-
-def getInstalledHeader(rpmName):
- """ quieries the RPM DB for a header matching rpmName. """
-
- mi = MatchIterator("name")
- mi.pattern("name", rpm.RPMMIRE_STRCMP, rpmName)
- return mi.next()
-
-
-if __name__ == '__main__':
- mi = MatchIterator("name")
- mi.pattern("name", rpm.RPMMIRE_GLOB, "*ker*")
- while 1:
- h = mi.next()
- if not h:
- break
- print h['name']
- sys.exit(1)
- hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.i386.rpm")
- print dir(hdr)
- # Sources
- hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.src.rpm")
- hdr2 = headerLoad(hdr.unload())
- print hdr2
- print len(hdr2.keys())
-
-
commit 1cde6ba4e2526b391ef2e5807d0be81647f7b3a9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:07:37 2009 +0100
rhn_rpm/rhn_mpm merge: fixed spec and Makefile to reflect rhn_rpm move
diff --git a/spacewalk/certs-tools/Makefile.certs b/spacewalk/certs-tools/Makefile.certs
index 59299d2..7cf1311 100644
--- a/spacewalk/certs-tools/Makefile.certs
+++ b/spacewalk/certs-tools/Makefile.certs
@@ -18,7 +18,7 @@
SUBDIR = certs
-FILES = __init__ rhn_rpm rhn_ssl_tool sslToolCli sslToolConfig sslToolLib \
+FILES = __init__ rhn_ssl_tool sslToolCli sslToolConfig sslToolLib \
timeLib rhn_bootstrap rhn_bootstrap_strings client_config_update
INSTALL_FILES = gen-rpm.sh sign.sh
diff --git a/spacewalk/certs-tools/spacewalk-certs-tools.spec b/spacewalk/certs-tools/spacewalk-certs-tools.spec
index 594e9a7..3ac18e5 100644
--- a/spacewalk/certs-tools/spacewalk-certs-tools.spec
+++ b/spacewalk/certs-tools/spacewalk-certs-tools.spec
@@ -10,6 +10,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
Requires: openssl rpm-build
Requires: rhn-client-tools
+Requires: rhnlib >= 2.2.16
BuildRequires: docbook-utils
BuildRequires: python
Obsoletes: rhns-certs < 5.3.0
@@ -35,7 +36,7 @@ rm -rf $RPM_BUILD_ROOT
install -d -m 755 $RPM_BUILD_ROOT/%{rhnroot}/certs
make -f Makefile.certs install PREFIX=$RPM_BUILD_ROOT ROOT=%{rhnroot} \
MANDIR=%{_mandir}
-chmod 755 $RPM_BUILD_ROOT/%{rhnroot}/certs/{rhn_ssl_tool.py,client_config_update.py,rhn_rpm.py,rhn_bootstrap.py}
+chmod 755 $RPM_BUILD_ROOT/%{rhnroot}/certs/{rhn_ssl_tool.py,client_config_update.py,rhn_bootstrap.py}
%clean
rm -rf $RPM_BUILD_ROOT
commit e1cf991b304625e025fc16a7c3eb19679c79c6f7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 12:00:39 2009 +0100
rhn_rpm/rhn_mpm merge: let certs-tools use rhn_rpm from rhnlib
instead of it's own copy
diff --git a/spacewalk/certs-tools/rhn_bootstrap.py b/spacewalk/certs-tools/rhn_bootstrap.py
index b54d182..24c1ece 100644
--- a/spacewalk/certs-tools/rhn_bootstrap.py
+++ b/spacewalk/certs-tools/rhn_bootstrap.py
@@ -34,7 +34,7 @@ import operator
from optparse import Option, OptionParser
## local imports
-import rhn_rpm
+from rhn.common import rhn_rpm
from client_config_update import readConfigFile
from rhn_bootstrap_strings import \
getHeader, getConfigFilesSh, getUp2dateScriptsSh, getGPGKeyImportSh, \
diff --git a/spacewalk/certs-tools/rhn_ssl_tool.py b/spacewalk/certs-tools/rhn_ssl_tool.py
index 56bdb8e..3835c28 100755
--- a/spacewalk/certs-tools/rhn_ssl_tool.py
+++ b/spacewalk/certs-tools/rhn_ssl_tool.py
@@ -50,7 +50,7 @@ from sslToolLib import RhnSslToolException, rotateFile, rhn_popen, cleanupAbsPat
gendir, chdir, getMachineName, fixSerial, TempDir, parseRPMFilename, \
errnoGeneralError, errnoSuccess, maketemp
-from rhn_rpm import hdrLabelCompare, sortRPMs, get_package_header, \
+from rhn.common.rhn_rpm import hdrLabelCompare, sortRPMs, get_package_header, \
getInstalledHeader
from sslToolConfig import ConfigFile, figureSerial, getOption, CERT_PATH, \
commit 417037a9f5e8fcd1fb715b76e0a4195742958d1b
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 11:53:08 2009 +0100
rhn_rpm/rhn_mpm merge: fixed list of files in Makefile
diff --git a/backend/common/Makefile b/backend/common/Makefile
index 08b7807..2512c26 100644
--- a/backend/common/Makefile
+++ b/backend/common/Makefile
@@ -9,9 +9,7 @@ TOP = ..
SUBDIR = common
FILES = __init__ \
rhn_fcntl \
- rhn_mpm \
rhn_posix \
- rhn_rpm \
rhn_timer \
rhnApache \
rhnCache \
commit f5e407bc383532ea9758dbffaba40d95b3f7515a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 11:49:18 2009 +0100
rhn_rpm/rhn_mpm merge: fixed spec to reflect rhn_rpm/rhn_mpm move
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 2b04045..309fddb 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -16,7 +16,7 @@ BuildArch: noarch
Requires: python, rpm-python
# /etc/rhn is provided by spacewalk-proxy-common or by spacewalk-config
Requires: /etc/rhn
-Requires: rhnlib >= 1.8
+Requires: rhnlib >= 2.2.16
BuildRequires: /usr/bin/msgfmt
BuildRequires: /usr/bin/docbook2man
BuildRequires: docbook-utils
@@ -274,9 +274,7 @@ rm -f %{rhnconf}/rhnSecret.py*
%dir %{rhnroot}/common
%{rhnroot}/common/__init__.py*
%{rhnroot}/common/rhn_fcntl.py*
-%{rhnroot}/common/rhn_mpm.py*
%{rhnroot}/common/rhn_posix.py*
-%{rhnroot}/common/rhn_rpm.py*
%{rhnroot}/common/rhn_timer.py*
%{rhnroot}/common/rhnApache.py*
%{rhnroot}/common/rhnCache.py*
commit a2b4004a5eda78c752a9291e1a2bd301a32e692b
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 11:42:57 2009 +0100
rhn_rpm/rhn_mpm merge: let backend use rhn_rpm/rhn_mpm from rhnlib
instead of it's own copy
diff --git a/backend/common/rhnRepository.py b/backend/common/rhnRepository.py
index c66b2d9..e112c1f 100644
--- a/backend/common/rhnRepository.py
+++ b/backend/common/rhnRepository.py
@@ -21,7 +21,7 @@ import string
import cStringIO
from rhn import rpclib
-import rhn_rpm
+from rhn.common import rhn_rpm
# local imports
import rhnFlags
diff --git a/backend/common/rhn_mpm.py b/backend/common/rhn_mpm.py
deleted file mode 100644
index 400f5d2..0000000
--- a/backend/common/rhn_mpm.py
+++ /dev/null
@@ -1,278 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-import os
-import gzip
-import cStringIO
-import tempfile
-from rhn.rpclib import xmlrpclib
-
-import struct
-
-from types import ListType, TupleType
-
-def labelCompare(l1, l2):
- try:
- import rhn_rpm
- except ImportError:
- # rhn_rpm not avalable; return a dummy comparison function
- return -1
- return rhn_rpm.labelCompare(l1, l2)
-
-def get_package_header(filename=None, file=None, fd=None):
- return load(filename=filename, file=file, fd=fd)[0]
-
-# Loads an MPM and returns its header and its payload
-def load(filename=None, file=None, fd=None):
- if (filename is None and file is None and fd is None):
- raise ValueError, "No parameters passed"
-
- if filename is not None:
- f = open(filename)
- elif file is not None:
- f = file
- else: # fd is not None
- f = os.fdopen(os.dup(fd), "r")
-
- f.seek(0, 0)
-
- p = MPM_Package()
- try:
- p.load(f)
- except InvalidPackageError, e:
- try:
- return load_rpm(f)
- except InvalidPackageError:
- raise e
-
- return p.header, p.payload_stream
-
-def load_rpm(stream):
- # Hmm, maybe an rpm
-
- try:
- import rhn_rpm
- except ImportError:
- raise InvalidPackageError
-
- # Dup the file descriptor, we don't want it to get closed before we read
- # the payload
- newfd = os.dup(stream.fileno())
- stream = os.fdopen(newfd, "r")
-
- stream.flush()
- stream.seek(0, 0)
-
- try:
- header = rhn_rpm.get_package_header(file=stream)
- except rhn_rpm.InvalidPackageError, e:
- raise apply(InvalidPackageError, e.args)
- except rhn_rpm.error, e:
- raise InvalidPackageError(e)
- stream.seek(0, 0)
-
- return header, stream
-
-class MPM_Header:
- "Wrapper class for an mpm header - we need to store a flag is_source"
- def __init__(self, hdr):
- self.hdr = hdr
- self.is_source = hdr.get('is_source')
- self.packaging = 'mpm'
- self.signatures = []
-
- def __getitem__(self, name):
- return self.hdr.get(name)
-
- def __getattr__(self, name):
- return getattr(self.hdr, name)
-
- def is_signed(self):
- return 0
-
-class InvalidPackageError(Exception):
- pass
-
-MPM_HEADER_COMPRESSED_GZIP = 1
-MPM_PAYLOAD_COMPRESSED_GZIP = 1
-
-class MPM_Package:
- _lead_format = '!16sB3s4L92s'
- _magic = 'mpmpackage012345'
- def __init__(self):
- self.header = None
- self.payload_stream = None
- self.header_flags = MPM_HEADER_COMPRESSED_GZIP
- self.payload_flags = 0
- assert(len(self._magic) == 16)
- self._buffer_size = 16384
-
- def _read_lead(self, stream):
- # Lead has the following format:
- # 16 bytes magic
- # 1 bytes version
- # 3 bytes unused
- # 4 bytes header flags
- # 4 bytes payload flags
- # 4 bytes header length
- # 4 bytes payload length
- # 92 bytes padding to 128 bytes
- lead = self._read_bytes(stream, 128)
- if len(lead) != 128:
- raise InvalidPackageError()
-
- arr = struct.unpack(self._lead_format, lead)
- return arr
-
- def load(self, input_stream):
- # Clean up
- self.__init__()
- arr = self._read_lead(input_stream)
- magic = arr[0]
- if magic != self._magic:
- raise InvalidPackageError()
- header_len, payload_len = int(arr[5]), int(arr[6])
- header_flags, payload_flags = arr[3], arr[4]
- file_size = 128 + header_len + payload_len
- input_stream.seek(file_size)
- if file_size != input_stream.tell():
- raise InvalidPackageError()
- # Read the header
- input_stream.seek(128, 0)
- header_data = self._read_bytes(input_stream, header_len)
- payload_stream = tempfile.TemporaryFile()
- self.stream_copy(input_stream, payload_stream)
-
- self._read_header(header_data, header_flags)
- self._read_payload(payload_stream, payload_flags)
-
- def _read_bytes(self, stream, amt):
- ret = ""
- while amt:
- buf = stream.read(min(amt, self._buffer_size))
- if not buf:
- return ret
- ret = ret + buf
- amt = amt - len(buf)
- return ret
-
- def _read_header(self, header_data, header_flags):
- if header_flags & MPM_HEADER_COMPRESSED_GZIP:
- t = cStringIO.StringIO(header_data)
- g = gzip.GzipFile(None, "r", 0, t)
- header_data = g.read()
- g.close()
- t.close()
-
- try:
- params, foo = xmlrpclib.loads(header_data)
- except:
- # XXX
- raise
-
- self.header = MPM_Header(params[0])
-
- def _read_payload(self, payload_stream, payload_flags):
- payload_stream.seek(0, 0)
- if payload_flags & MPM_PAYLOAD_COMPRESSED_GZIP:
- g = gzip.GzipFile(None, "r", 0, payload_stream)
- t = tempfile.TemporaryFile()
- self.stream_copy(g, t)
- g.close()
- payload_stream = t
-
- self.payload_stream = payload_stream
-
- def write(self, output_stream):
- if self.header is None:
- raise Exception()
-
- header_stream, header_size = self._encode_header()
- payload_stream, payload_size = self._encode_payload()
-
- lead_arr = (self._magic, 1, "\0" * 3, self.header_flags,
- self.payload_flags, header_size, payload_size, '\0' * 92)
- # lead
- lead = apply(struct.pack, (self._lead_format, ) + lead_arr)
- output_stream.write(lead)
- self.stream_copy(header_stream, output_stream)
- self.stream_copy(payload_stream, output_stream)
-
- def add_header_flag(self, flag):
- self.header_flags = self.header_flags | flag
-
- def add_payload_flag(self, flag):
- self.payload_flags = self.payload_flags | flag
-
- def reset_header_flags(self):
- self.header_flags = 0
-
- def reset_payload_flags(self):
- self.payload_flags = 0
-
- def _encode_header(self):
- assert(self.header is not None)
- stream = tempfile.TemporaryFile()
- data = xmlrpclib.dumps((_replace_null(self.header), ))
- if self.header_flags & MPM_HEADER_COMPRESSED_GZIP:
- f = gzip.GzipFile(None, "wb", 9, stream)
- f.write(data)
- f.close()
- else:
- stream.write(data)
- stream.flush()
- stream.seek(0, 2)
- size = stream.tell()
- stream.seek(0, 0)
- return stream, size
-
- def _encode_payload(self):
- assert(self.payload_stream is not None)
- stream = tempfile.TemporaryFile()
- if self.payload_flags & MPM_PAYLOAD_COMPRESSED_GZIP:
- f = gzip.GzipFile(None, "wb", 9, stream)
- self.stream_copy(self.payload_stream, f)
- f.close()
- else:
- stream = self.payload_stream
- stream.flush()
- stream.seek(0, 2)
- size = stream.tell()
- stream.seek(0, 0)
- return stream, size
-
- def stream_copy(self, source, dest):
- "Copies data from the source stream to the destination stream"
- while 1:
- buf = source.read(self._buffer_size)
- if not buf:
- break
- dest.write(buf)
-
-
-def _replace_null(obj):
- if obj is None:
- return ''
- if isinstance(obj, ListType):
- return map(_replace_null, obj)
- if isinstance(obj, TupleType):
- return tuple(_replace_null(list(obj)))
- if hasattr(obj, 'items'):
- dict = {}
- for k, v in obj.items():
- dict[_replace_null(k)] = _replace_null(v)
- return dict
- return obj
diff --git a/backend/common/rhn_rpm.py b/backend/common/rhn_rpm.py
deleted file mode 100644
index e1b275e..0000000
--- a/backend/common/rhn_rpm.py
+++ /dev/null
@@ -1,429 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-import os
-import sys
-import rpm
-import struct
-
-import exceptions
-if not hasattr(exceptions, 'StopIteration'):
- # Presumably python 1.5.2
- class StopIteration(Exception):
- pass
-
-# Expose a bunch of useful constants from rpm
-error = rpm.error
-for sym, val in rpm.__dict__.items():
- if sym[:3] == 'RPM':
- # A constant, probably - import it into our namespace
- globals()[sym] = val
-del sym, val
-
-class InvalidPackageError(Exception):
- pass
-
-# wrapper/proxy class for rpm.Transaction so we can
-# instrument it, etc easily
-class RPMTransaction:
- read_only = 0
- def __init__(self):
- if hasattr(rpm, 'opendb'):
- db = getattr(rpm, 'opendb')(not self.read_only)
- self.ts = rpm.TransactionSet('/', db)
- else:
- self.ts = rpm.TransactionSet()
- self.tsflags = []
- # For rpm 4.0.4
- self._flags = 0
- self._prob_filter = 0
-
- def __getattr__(self, attr):
- return getattr(self.ts, attr)
-
- def getMethod(self, method):
- # in theory, we can override this with
- # profile/etc info
- return getattr(self.ts, method)
-
- # push/pop methods so we don't lose the previous
- # set value, and we can potentially debug a bit
- # easier
- def pushVSFlags(self, flags):
- self.tsflags.append(flags)
- if hasattr(self.ts, 'setVSFlags'):
- f = getattr(self.ts, 'setVSFlags')
- f(self.tsflags[-1])
-
- def popVSFlags(self):
- del self.tsflags[-1]
- if hasattr(self.ts, 'setVSFlags'):
- f = getattr(self.ts, 'setVSFlags')
- f(self.tsflags[-1])
-
- def addInstall(self, arg1, arg2, mode):
- """Install a package"""
- hdr = arg1.hdr
- if hasattr(self.ts, 'addInstall'):
- f = getattr(self.ts, 'addInstall')
- return f(hdr, arg2, mode)
- return self.ts.add(hdr, arg2, mode)
-
- def addErase(self, arg1):
- """Erase a package"""
- hdr = arg1.hdr
- if hasattr(self.ts, 'addErase'):
- f = getattr(self.ts, 'addErase')
- return f(hdr)
- return self.ts.add(hdr, hdr, "e")
-
- def check(self):
- """Check dependencies"""
- if hasattr(self.ts, 'check'):
- f = getattr(self.ts, 'check')
- else:
- f = getattr(self.ts, 'depcheck')
- return f()
-
- def setFlags(self, flag):
- """Set transaction flags"""
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- old_flags = self._flags
- self._flags = flag
- return old_flags
- return self.ts.setFlags(flag)
-
- def setProbFilter(self, flag):
- """Set problem flags"""
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- old_flags = self._prob_filter
- self._prob_filter = flag
- return old_flags
- return self.ts.setProbFilter(flag)
-
- def run(self, callback, user_data):
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- return self.ts.run(self._flags, self._prob_filter, callback,
- user_data)
- return self.ts.run(callback, user_data)
-
-
-
-
-class SharedStateTransaction:
- _shared_state = {}
-
- def __init__(self):
- self.__dict__ = self._shared_state
-
-class RPMReadOnlyTransaction(SharedStateTransaction, RPMTransaction):
- read_only = 1
- def __init__(self):
- SharedStateTransaction.__init__(self)
- if not hasattr(self, 'ts'):
- RPMTransaction.__init__(self)
- # FIXME: replace with macro defination
- self.pushVSFlags(8)
-
-class RPM_Header:
- "Wrapper class for an rpm header - we need to store a flag is_source"
- def __init__(self, hdr, is_source=None):
- self.hdr = hdr
- self.is_source = is_source
- self.packaging = 'rpm'
- self.signatures = []
- self._extract_signatures()
-
- def __getitem__(self, name):
- return self.hdr[name]
-
- def __getattr__(self, name):
- return getattr(self.hdr, name)
-
- def is_signed(self):
- if hasattr(rpm, "RPMTAG_DSAHEADER"):
- dsaheader = self.hdr["dsaheader"]
- else:
- dsaheader = 0
- if self.hdr["siggpg"] or self.hdr["sigpgp"] or dsaheader:
- return 1
- return 0
-
- def _extract_signatures(self):
- header_tags = [
- [rpm.RPMTAG_DSAHEADER, "dsa"],
- [rpm.RPMTAG_RSAHEADER, "rsa"],
- [rpm.RPMTAG_SIGGPG, "gpg"],
- [rpm.RPMTAG_SIGPGP, 'pgp'],
- ]
- for ht, sig_type in header_tags:
- ret = self.hdr[ht]
- if not ret or len(ret) < 17:
- continue
- # Get the key id - hopefully we get it right
- key_id = ret[9:17]
- key_id_len = len(key_id)
- format = "%dB" % key_id_len
- t = struct.unpack(format, key_id)
- format = "%02x" * key_id_len
- key_id = format % t
- self.signatures.append({
- 'signature_type' : sig_type,
- 'key_id' : key_id,
- 'signature' : ret,
- })
-
-def get_header_byte_range(package_file):
- """
- Return the start and end bytes of the rpm header object.
-
- For details of the rpm file format, see:
- http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html
- """
-
- lead_size = 96
-
- # Move past the rpm lead
- package_file.seek(lead_size)
-
- sig_size = get_header_struct_size(package_file)
-
- # Now we can find the start of the actual header.
- header_start = lead_size + sig_size
-
- package_file.seek(header_start)
-
- header_size = get_header_struct_size(package_file)
-
- header_end = header_start + header_size
-
- return (header_start, header_end)
-
-def get_header_struct_size(package_file):
- """
- Compute the size in bytes of the rpm header struct starting at the current
- position in package_file.
- """
- # Move past the header preamble
- package_file.seek(8, 1)
-
- # Read the number of index entries
- header_index = package_file.read(4)
- (header_index_value, ) = struct.unpack('>I', header_index)
-
- # Read the the size of the header data store
- header_store = package_file.read(4)
- (header_store_value, ) = struct.unpack('>I', header_store)
-
- # The total size of the header. Each index entry is 16 bytes long.
- header_size = 8 + 4 + 4 + header_index_value * 16 + header_store_value
-
- # Headers end on an 8-byte boundary. Round out the extra data.
- round_out = header_size % 8
- if round_out != 0:
- header_size = header_size + (8 - round_out)
-
- return header_size
-
-# Loads the package header from a file / stream / file descriptor
-# Raises rpm.error if an error is found, or InvalidPacageError if package is
-# busted
-# XXX Deal with exceptions better
-def get_package_header(filename=None, file=None, fd=None):
- if (filename is None and file is None and fd is None):
- raise ValueError, "No parameters passed"
-
- if filename is not None:
- f = open(filename)
- elif file is not None:
- f = file
- f.seek(0, 0)
- else: # fd is not None
- f = None
-
- if f is None:
- os.lseek(fd, 0, 0)
- file_desc = fd
- else:
- file_desc = f.fileno()
-
- if hasattr(rpm, 'headerFromPackage'):
- hdr, is_source = rpm.headerFromPackage(file_desc)
- if hdr is None:
- raise InvalidPackageError
- else:
- if hasattr(rpm, 'readHeaderFromFD'):
- header_start, header_end = \
- get_header_byte_range(os.fdopen(os.dup(file_desc)))
- os.lseek(file_desc, header_start, 0)
- hdr, offset = rpm.readHeaderFromFD(file_desc)
- else:
- # RHEL-4 and older, do the old way
- ts = RPMReadOnlyTransaction()
- nomd5 = getattr(rpm, 'RPMVSF_NOMD5')
- needpayload = getattr(rpm, 'RPMVSF_NEEDPAYLOAD')
- ts.pushVSFlags(~(nomd5 | needpayload))
- hdr = RPMReadOnlyTransaction().hdrFromFdno(file_desc)
- ts.popVSFlags()
- if hdr is None:
- raise InvalidPackageError
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
-
- return RPM_Header(hdr, is_source)
-
-class MatchIterator:
- def __init__(self, tag_name=None, value=None):
- # Query by name, by default
- if not tag_name:
- tag_name = "name"
-
- if hasattr(rpm, "headerFromPackage"):
- # rpm 4.0.4 or earlier
- self.db = rpm.opendb()
- method = self.db.match
- else:
- # rpm 4.1 or later
- self.ts = rpm.TransactionSet()
- self.ts.setVSFlags(8)
- method = self.ts.dbMatch
-
- if value:
- self.mi = method(tag_name, value)
- else:
- self.mi = method(tag_name)
-
- def pattern(self, tag_name, mode, pattern):
- self.mi.pattern(tag_name, mode, pattern)
-
- def next(self):
- try:
- hdr = self.mi.next()
- except StopIteration:
- hdr = None
-
- if hdr is None:
- return None
- if hasattr(rpm, "headerFromPackage"):
- is_source = not hdr[rpm.RPMTAG_SOURCERPM]
- else:
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
- return RPM_Header(hdr, is_source)
-
-
-def headerLoad(data):
- hdr = rpm.headerLoad(data)
- if hasattr(rpm, "headerFromPackage"):
- is_source = not hdr[rpm.RPMTAG_SOURCERPM]
- else:
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
- return RPM_Header(hdr, is_source)
-
-def labelCompare(t1, t2):
- return rpm.labelCompare(t1, t2)
-
-def nvre_compare(t1, t2):
- def build_evr(p):
- evr = [p[3], p[1], p[2]]
- evr = map(str, evr)
- if evr[0] == "":
- evr[0] = None
- return evr
- if t1[0] != t2[0]:
- raise ValueError("You should only compare packages with the same name")
- evr1, evr2 = (build_evr(t1), build_evr(t2))
- return rpm.labelCompare(evr1, evr2)
-
-
-def hdrLabelCompare(hdr1, hdr2):
- """ take two RPMs or headers and compare them for order """
-
- if hdr1['name'] == hdr2['name']:
- hdr1 = [hdr1['epoch'] or None, hdr1['version'], hdr1['release']]
- hdr2 = [hdr2['epoch'] or None, hdr2['version'], hdr2['release']]
- if hdr1[0]:
- hdr1[0] = str(hdr1[0])
- if hdr2[0]:
- hdr2[0] = str(hdr2[0])
- return rpm.labelCompare(hdr1, hdr2)
- elif hdr1['name'] < hdr2['name']:
- return -1
- return 1
-
-
-def rpmLabelCompare(rpmFilename1, rpmFilename2):
- """ take two RPMs and compare them for order """
- return hdrLabelCompare(get_package_header(rpmFilename1),
- get_package_header(rpmFilename2))
-
-
-def sortHeaders(hdrs):
- """ Sorts a list of RPM headers (or RPMs).
- Assertion: they *must* exist.
- """
-
- assert isinstance(hdrs, type([]))
-
- sorted = hdrs[:]
- sorted.sort(hdrLabelCompare)
- return sorted
-
-
-def sortRPMs(rpms):
- """ Sorts a list of RPM files. They *must* exist. """
-
- assert isinstance(rpms, type([]))
-
- # We don't want to use rpmLabelCompare as a sorting mechanism, it would
- # extract the rpm header for each comparison.
- # Build a list of (header, rpm)
- helper = map(lambda x: (get_package_header(x), x), rpms)
-
- # Sort the list using the headers as a comparison
- helper.sort(lambda x, y: hdrLabelCompare(x[0], y[0]))
-
- # Extract the rpm names now
- return map(lambda x: x[1], helper)
-
-
-def getInstalledHeader(rpmName):
- """ quieries the RPM DB for a header matching rpmName. """
-
- mi = MatchIterator("name")
- mi.pattern("name", rpm.RPMMIRE_STRCMP, rpmName)
- return mi.next()
-
-
-if __name__ == '__main__':
- mi = MatchIterator("name")
- mi.pattern("name", rpm.RPMMIRE_GLOB, "*ker*")
- while 1:
- h = mi.next()
- if not h:
- break
- print h['name']
- sys.exit(1)
- hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.i386.rpm")
- print dir(hdr)
- # Sources
- hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.src.rpm")
- hdr2 = headerLoad(hdr.unload())
- print hdr2
- print len(hdr2.keys())
-
-
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 298f740..df548fd 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -17,8 +17,9 @@ import sys, os, time, grp
from optparse import OptionParser
from common import rhnLib
from server import rhnPackage, rhnSQL, rhnChannel, rhnPackageUpload
-from common import CFG, initCFG, rhn_rpm, rhnLog, fetchTraceback
-from common.rhn_mpm import InvalidPackageError
+from common import CFG, initCFG, rhnLog, fetchTraceback
+from rhn.common import rhn_rpm
+from rhn.common.rhn_mpm import InvalidPackageError
from server.importlib.importLib import IncompletePackage
from server.importlib.backendOracle import OracleBackend
from server.importlib.packageImport import ChannelPackageSubscription
diff --git a/backend/satellite_tools/satCerts.py b/backend/satellite_tools/satCerts.py
index 653c3ad..daaf741 100644
--- a/backend/satellite_tools/satCerts.py
+++ b/backend/satellite_tools/satCerts.py
@@ -27,8 +27,8 @@ import os
from server import rhnSQL
from server.rhnServer import satellite_cert
from common.rhnTB import fetchTraceback
-from common.rhn_rpm import getInstalledHeader
from common.rhnConfig import RHNOptions
+from rhn.common.rhn_rpm import getInstalledHeader
#
# RHN certificate section
diff --git a/backend/satellite_tools/satComputePkgHeaders.py b/backend/satellite_tools/satComputePkgHeaders.py
index 1e50779..54d1ff7 100644
--- a/backend/satellite_tools/satComputePkgHeaders.py
+++ b/backend/satellite_tools/satComputePkgHeaders.py
@@ -55,7 +55,7 @@ sys.modules["_apache"] = sys.modules["__main__"]
from server import rhnSQL
-from common import rhn_rpm
+from rhn.common import rhn_rpm
options_table = [
Option("-v", "--verbose", action="count",
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index cbc6ece..db58110 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -30,7 +30,8 @@ from optparse import Option, OptionParser
# __rhn imports__
from common import CFG, initCFG, initLOG, Traceback, rhnMail, \
- rhnLib, rhnFlags, rhn_rpm
+ rhnLib, rhnFlags
+from rhn.common import rhn_rpm
from server import rhnSQL
from server.rhnSQL import SQLError, SQLSchemaError, SQLConnectError
diff --git a/backend/satellite_tools/updatePackages.py b/backend/satellite_tools/updatePackages.py
index 35a07ba..e2b4247 100644
--- a/backend/satellite_tools/updatePackages.py
+++ b/backend/satellite_tools/updatePackages.py
@@ -25,7 +25,8 @@ import shutil
sys.path.append('/usr/share/rhn')
from optparse import Option, OptionParser
-from common import rhnLib, rhnLog, rhn_rpm, initLOG, CFG, initCFG
+from common import rhnLib, rhnLog, initLOG, CFG, initCFG
+from rhn.common import rhn_rpm
from server.rhnLib import parseRPMFilename
from server import rhnSQL
from server.rhnServer import server_packages
diff --git a/backend/server/basePackageUpload.py b/backend/server/basePackageUpload.py
index ad05f93..faaa329 100644
--- a/backend/server/basePackageUpload.py
+++ b/backend/server/basePackageUpload.py
@@ -20,7 +20,7 @@ import tempfile
from mod_python import apache
from common import CFG, log_debug, rhnFault, rhn_mpm, rhnLib, UserDictCase
-from common.rhn_rpm import get_header_byte_range
+from rhn.common.rhn_rpm import get_header_byte_range
from server import rhnSQL
from server.importlib import importLib, userAuth, mpmSource, backendOracle, \
diff --git a/backend/server/handlers/app/rhn_mpm.py b/backend/server/handlers/app/rhn_mpm.py
index 9ed7df8..d1a2859 100644
--- a/backend/server/handlers/app/rhn_mpm.py
+++ b/backend/server/handlers/app/rhn_mpm.py
@@ -63,7 +63,7 @@ def load_rpm(stream, seekable=1):
# Hmm, maybe an rpm
try:
- import rhn_rpm
+ from rhn.common import rhn_rpm
except ImportError:
raise InvalidPackageError
diff --git a/backend/server/handlers/applet/applet.py b/backend/server/handlers/applet/applet.py
index 3d217cb..956ae2f 100644
--- a/backend/server/handlers/applet/applet.py
+++ b/backend/server/handlers/applet/applet.py
@@ -19,9 +19,9 @@ from rhn.rpclib import xmlrpclib
import random
# common modules imports
-from common import rhnCache, rhnFlags, log_debug, CFG, rhn_rpm, \
- rhnFault
+from common import rhnCache, rhnFlags, log_debug, CFG, rhnFault
from common.rhnTranslate import _
+from rhn.common import rhn_rpm
# server modules imports
from server import rhnChannel, rhnSQL, rhnHandler, rhnLib
diff --git a/backend/server/handlers/xmlrpc/up2date.py b/backend/server/handlers/xmlrpc/up2date.py
index d09e5c0..5f09b87 100644
--- a/backend/server/handlers/xmlrpc/up2date.py
+++ b/backend/server/handlers/xmlrpc/up2date.py
@@ -24,8 +24,9 @@ from rhn import rpclib
from types import ListType, TupleType, StringType, IntType
# common module imports
-from common import CFG, rhnFlags, rhnFault, log_debug, log_error, rhn_rpm
+from common import CFG, rhnFlags, rhnFault, log_debug, log_error
from common.rhnTranslate import _
+from rhn.common import rhn_rpm
# local module imports
from server.rhnLib import computeSignature
diff --git a/backend/server/handlers/xp/rhnlint.py b/backend/server/handlers/xp/rhnlint.py
index f67736f..b4175ec 100644
--- a/backend/server/handlers/xp/rhnlint.py
+++ b/backend/server/handlers/xp/rhnlint.py
@@ -18,7 +18,8 @@
import time
import string
-from common import RPC_Base, log_debug, rhn_rpm
+from common import RPC_Base, log_debug
+from rhn.common import rhn_rpm
from server import rhnSQL
diff --git a/backend/server/importlib/backend.py b/backend/server/importlib/backend.py
index e259f02..d2b4cf7 100644
--- a/backend/server/importlib/backend.py
+++ b/backend/server/importlib/backend.py
@@ -22,7 +22,8 @@ import string
import re
import sys
-from common import rhnFault, rhn_rpm, CFG
+from common import rhnFault, CFG
+from rhn.common import rhn_rpm
from server import rhnSQL, rhnChannel, taskomatic
from importLib import Diff, Package, IncompletePackage, Erratum, \
AlreadyUploadedError, InvalidPackageError, TransactionError, \
diff --git a/backend/server/importlib/packageUpload.py b/backend/server/importlib/packageUpload.py
index a40ac72..492d323 100644
--- a/backend/server/importlib/packageUpload.py
+++ b/backend/server/importlib/packageUpload.py
@@ -17,7 +17,8 @@
# Package import code on the app side
#
-from common import rhnFault, rhn_rpm, log_debug
+from common import rhnFault, log_debug
+from rhn.common import rhn_rpm
from server import rhnChannel, taskomatic, rhnSQL
from server.importlib.headerSource import createPackage
diff --git a/backend/server/rhnChannel.py b/backend/server/rhnChannel.py
index 335afee..e8d875f 100644
--- a/backend/server/rhnChannel.py
+++ b/backend/server/rhnChannel.py
@@ -22,9 +22,10 @@ from rhn.rpclib import xmlrpclib
from types import IntType, ListType, DictType
# common module
-from common import log_debug, log_error, rhnFault, rhnException, rhnCache, rhnFlags, CFG, rhn_rpm
+from common import log_debug, log_error, rhnFault, rhnException, rhnCache, rhnFlags, CFG
from common.rhnTranslate import _
from common.rhnLib import startswith
+from rhn.common import rhn_rpm
from rhnServer import server_lib
from rhnDependency import MakeEvrError
diff --git a/backend/server/rhnPackageUpload.py b/backend/server/rhnPackageUpload.py
index 46b57a7..65ce811 100644
--- a/backend/server/rhnPackageUpload.py
+++ b/backend/server/rhnPackageUpload.py
@@ -19,7 +19,7 @@ import os
import tempfile
from common import CFG, log_debug, rhnFault, rhn_mpm, rhnLib, UserDictCase
-from common.rhn_rpm import get_header_byte_range
+from rhn.common.rhn_rpm import get_header_byte_range
from server import rhnSQL
from server.importlib import importLib, userAuth, mpmSource, backendOracle, \
diff --git a/backend/server/rhnServer/server_class.py b/backend/server/rhnServer/server_class.py
index 4605250..dead358 100644
--- a/backend/server/rhnServer/server_class.py
+++ b/backend/server/rhnServer/server_class.py
@@ -21,8 +21,9 @@ import string
# Global Modules
from common import rhnException, rhnFault, log_debug, log_error, CFG
-from common import rhnFlags, rhn_rpm
+from common import rhnFlags
from common.rhnTranslate import _
+from rhn.common import rhn_rpm
# from the server stuff...
from server import rhnChannel, rhnUser, rhnSQL, rhnLib, rhnAction, \
diff --git a/backend/server/rhnServer/server_packages.py b/backend/server/rhnServer/server_packages.py
index d3eac96..42225e8 100644
--- a/backend/server/rhnServer/server_packages.py
+++ b/backend/server/rhnServer/server_packages.py
@@ -22,7 +22,8 @@ import string
import time
from types import DictType, TupleType
-from common import log_debug, rhn_rpm, rhnFault
+from common import log_debug, rhnFault
+from rhn.common import rhn_rpm
from server import rhnSQL, rhnLib
from server_lib import snapshot_server, check_entitlement
commit dc95bf9a5361c8dc62aeb283b82be21fee97deac
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 11:06:54 2009 +0100
rhn_rpm/rhn_mpm merge: added rhn_mpm.py to rhnlib
diff --git a/client/rhel/rhnlib/rhn/common/rhn_mpm.py b/client/rhel/rhnlib/rhn/common/rhn_mpm.py
new file mode 100644
index 0000000..400f5d2
--- /dev/null
+++ b/client/rhel/rhnlib/rhn/common/rhn_mpm.py
@@ -0,0 +1,278 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2008 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+
+import os
+import gzip
+import cStringIO
+import tempfile
+from rhn.rpclib import xmlrpclib
+
+import struct
+
+from types import ListType, TupleType
+
+def labelCompare(l1, l2):
+ try:
+ import rhn_rpm
+ except ImportError:
+ # rhn_rpm not avalable; return a dummy comparison function
+ return -1
+ return rhn_rpm.labelCompare(l1, l2)
+
+def get_package_header(filename=None, file=None, fd=None):
+ return load(filename=filename, file=file, fd=fd)[0]
+
+# Loads an MPM and returns its header and its payload
+def load(filename=None, file=None, fd=None):
+ if (filename is None and file is None and fd is None):
+ raise ValueError, "No parameters passed"
+
+ if filename is not None:
+ f = open(filename)
+ elif file is not None:
+ f = file
+ else: # fd is not None
+ f = os.fdopen(os.dup(fd), "r")
+
+ f.seek(0, 0)
+
+ p = MPM_Package()
+ try:
+ p.load(f)
+ except InvalidPackageError, e:
+ try:
+ return load_rpm(f)
+ except InvalidPackageError:
+ raise e
+
+ return p.header, p.payload_stream
+
+def load_rpm(stream):
+ # Hmm, maybe an rpm
+
+ try:
+ import rhn_rpm
+ except ImportError:
+ raise InvalidPackageError
+
+ # Dup the file descriptor, we don't want it to get closed before we read
+ # the payload
+ newfd = os.dup(stream.fileno())
+ stream = os.fdopen(newfd, "r")
+
+ stream.flush()
+ stream.seek(0, 0)
+
+ try:
+ header = rhn_rpm.get_package_header(file=stream)
+ except rhn_rpm.InvalidPackageError, e:
+ raise apply(InvalidPackageError, e.args)
+ except rhn_rpm.error, e:
+ raise InvalidPackageError(e)
+ stream.seek(0, 0)
+
+ return header, stream
+
+class MPM_Header:
+ "Wrapper class for an mpm header - we need to store a flag is_source"
+ def __init__(self, hdr):
+ self.hdr = hdr
+ self.is_source = hdr.get('is_source')
+ self.packaging = 'mpm'
+ self.signatures = []
+
+ def __getitem__(self, name):
+ return self.hdr.get(name)
+
+ def __getattr__(self, name):
+ return getattr(self.hdr, name)
+
+ def is_signed(self):
+ return 0
+
+class InvalidPackageError(Exception):
+ pass
+
+MPM_HEADER_COMPRESSED_GZIP = 1
+MPM_PAYLOAD_COMPRESSED_GZIP = 1
+
+class MPM_Package:
+ _lead_format = '!16sB3s4L92s'
+ _magic = 'mpmpackage012345'
+ def __init__(self):
+ self.header = None
+ self.payload_stream = None
+ self.header_flags = MPM_HEADER_COMPRESSED_GZIP
+ self.payload_flags = 0
+ assert(len(self._magic) == 16)
+ self._buffer_size = 16384
+
+ def _read_lead(self, stream):
+ # Lead has the following format:
+ # 16 bytes magic
+ # 1 bytes version
+ # 3 bytes unused
+ # 4 bytes header flags
+ # 4 bytes payload flags
+ # 4 bytes header length
+ # 4 bytes payload length
+ # 92 bytes padding to 128 bytes
+ lead = self._read_bytes(stream, 128)
+ if len(lead) != 128:
+ raise InvalidPackageError()
+
+ arr = struct.unpack(self._lead_format, lead)
+ return arr
+
+ def load(self, input_stream):
+ # Clean up
+ self.__init__()
+ arr = self._read_lead(input_stream)
+ magic = arr[0]
+ if magic != self._magic:
+ raise InvalidPackageError()
+ header_len, payload_len = int(arr[5]), int(arr[6])
+ header_flags, payload_flags = arr[3], arr[4]
+ file_size = 128 + header_len + payload_len
+ input_stream.seek(file_size)
+ if file_size != input_stream.tell():
+ raise InvalidPackageError()
+ # Read the header
+ input_stream.seek(128, 0)
+ header_data = self._read_bytes(input_stream, header_len)
+ payload_stream = tempfile.TemporaryFile()
+ self.stream_copy(input_stream, payload_stream)
+
+ self._read_header(header_data, header_flags)
+ self._read_payload(payload_stream, payload_flags)
+
+ def _read_bytes(self, stream, amt):
+ ret = ""
+ while amt:
+ buf = stream.read(min(amt, self._buffer_size))
+ if not buf:
+ return ret
+ ret = ret + buf
+ amt = amt - len(buf)
+ return ret
+
+ def _read_header(self, header_data, header_flags):
+ if header_flags & MPM_HEADER_COMPRESSED_GZIP:
+ t = cStringIO.StringIO(header_data)
+ g = gzip.GzipFile(None, "r", 0, t)
+ header_data = g.read()
+ g.close()
+ t.close()
+
+ try:
+ params, foo = xmlrpclib.loads(header_data)
+ except:
+ # XXX
+ raise
+
+ self.header = MPM_Header(params[0])
+
+ def _read_payload(self, payload_stream, payload_flags):
+ payload_stream.seek(0, 0)
+ if payload_flags & MPM_PAYLOAD_COMPRESSED_GZIP:
+ g = gzip.GzipFile(None, "r", 0, payload_stream)
+ t = tempfile.TemporaryFile()
+ self.stream_copy(g, t)
+ g.close()
+ payload_stream = t
+
+ self.payload_stream = payload_stream
+
+ def write(self, output_stream):
+ if self.header is None:
+ raise Exception()
+
+ header_stream, header_size = self._encode_header()
+ payload_stream, payload_size = self._encode_payload()
+
+ lead_arr = (self._magic, 1, "\0" * 3, self.header_flags,
+ self.payload_flags, header_size, payload_size, '\0' * 92)
+ # lead
+ lead = apply(struct.pack, (self._lead_format, ) + lead_arr)
+ output_stream.write(lead)
+ self.stream_copy(header_stream, output_stream)
+ self.stream_copy(payload_stream, output_stream)
+
+ def add_header_flag(self, flag):
+ self.header_flags = self.header_flags | flag
+
+ def add_payload_flag(self, flag):
+ self.payload_flags = self.payload_flags | flag
+
+ def reset_header_flags(self):
+ self.header_flags = 0
+
+ def reset_payload_flags(self):
+ self.payload_flags = 0
+
+ def _encode_header(self):
+ assert(self.header is not None)
+ stream = tempfile.TemporaryFile()
+ data = xmlrpclib.dumps((_replace_null(self.header), ))
+ if self.header_flags & MPM_HEADER_COMPRESSED_GZIP:
+ f = gzip.GzipFile(None, "wb", 9, stream)
+ f.write(data)
+ f.close()
+ else:
+ stream.write(data)
+ stream.flush()
+ stream.seek(0, 2)
+ size = stream.tell()
+ stream.seek(0, 0)
+ return stream, size
+
+ def _encode_payload(self):
+ assert(self.payload_stream is not None)
+ stream = tempfile.TemporaryFile()
+ if self.payload_flags & MPM_PAYLOAD_COMPRESSED_GZIP:
+ f = gzip.GzipFile(None, "wb", 9, stream)
+ self.stream_copy(self.payload_stream, f)
+ f.close()
+ else:
+ stream = self.payload_stream
+ stream.flush()
+ stream.seek(0, 2)
+ size = stream.tell()
+ stream.seek(0, 0)
+ return stream, size
+
+ def stream_copy(self, source, dest):
+ "Copies data from the source stream to the destination stream"
+ while 1:
+ buf = source.read(self._buffer_size)
+ if not buf:
+ break
+ dest.write(buf)
+
+
+def _replace_null(obj):
+ if obj is None:
+ return ''
+ if isinstance(obj, ListType):
+ return map(_replace_null, obj)
+ if isinstance(obj, TupleType):
+ return tuple(_replace_null(list(obj)))
+ if hasattr(obj, 'items'):
+ dict = {}
+ for k, v in obj.items():
+ dict[_replace_null(k)] = _replace_null(v)
+ return dict
+ return obj
commit 909751ff1df943d685e41ee63b63c4f0b187b719
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 10:37:25 2009 +0100
rhn_rpm/rhn_mpm merge: added common subdir into rpm package
diff --git a/client/rhel/rhnlib/setup.py.in b/client/rhel/rhnlib/setup.py.in
index 35d5028..99a8c59 100644
--- a/client/rhel/rhnlib/setup.py.in
+++ b/client/rhel/rhnlib/setup.py.in
@@ -15,7 +15,7 @@ Red Hat Network (http://rhn.redhat.com) software.""",
author = 'Mihai Ibanescu',
author_email = 'misa(a)redhat.com',
url = 'http://rhn.redhat.com',
- packages = ["rhn"],
+ packages = ["rhn", "rhn/common"],
license = "GPL",
)
commit 0fe8c31ecf5726d49f22bbd67a2cc630abcdeb32
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 11:08:25 2009 +0100
rhn_rpm/rhn_mpm merge: added rhn_rpm.py to rhnlib
diff --git a/client/rhel/rhnlib/rhn/common/rhn_rpm.py b/client/rhel/rhnlib/rhn/common/rhn_rpm.py
new file mode 100644
index 0000000..0ff9965
--- /dev/null
+++ b/client/rhel/rhnlib/rhn/common/rhn_rpm.py
@@ -0,0 +1,429 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2008 Red Hat, Inc.
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation.
+#
+
+import os
+import sys
+import rpm
+import struct
+
+import exceptions
+if not hasattr(exceptions, 'StopIteration'):
+ # Presumably python 1.5.2
+ class StopIteration(Exception):
+ pass
+
+# Expose a bunch of useful constants from rpm
+error = rpm.error
+for sym, val in rpm.__dict__.items():
+ if sym[:3] == 'RPM':
+ # A constant, probably - import it into our namespace
+ globals()[sym] = val
+del sym, val
+
+class InvalidPackageError(Exception):
+ pass
+
+# wrapper/proxy class for rpm.Transaction so we can
+# instrument it, etc easily
+class RPMTransaction:
+ read_only = 0
+ def __init__(self):
+ if hasattr(rpm, 'opendb'):
+ db = getattr(rpm, 'opendb')(not self.read_only)
+ self.ts = rpm.TransactionSet('/', db)
+ else:
+ self.ts = rpm.TransactionSet()
+ self.tsflags = []
+ # For rpm 4.0.4
+ self._flags = 0
+ self._prob_filter = 0
+
+ def __getattr__(self, attr):
+ return getattr(self.ts, attr)
+
+ def getMethod(self, method):
+ # in theory, we can override this with
+ # profile/etc info
+ return getattr(self.ts, method)
+
+ # push/pop methods so we don't lose the previous
+ # set value, and we can potentially debug a bit
+ # easier
+ def pushVSFlags(self, flags):
+ self.tsflags.append(flags)
+ if hasattr(self.ts, 'setVSFlags'):
+ f = getattr(self.ts, 'setVSFlags')
+ f(self.tsflags[-1])
+
+ def popVSFlags(self):
+ del self.tsflags[-1]
+ if hasattr(self.ts, 'setVSFlags'):
+ f = getattr(self.ts, 'setVSFlags')
+ f(self.tsflags[-1])
+
+ def addInstall(self, arg1, arg2, mode):
+ """Install a package"""
+ hdr = arg1.hdr
+ if hasattr(self.ts, 'addInstall'):
+ f = getattr(self.ts, 'addInstall')
+ return f(hdr, arg2, mode)
+ return self.ts.add(hdr, arg2, mode)
+
+ def addErase(self, arg1):
+ """Erase a package"""
+ hdr = arg1.hdr
+ if hasattr(self.ts, 'addErase'):
+ f = getattr(self.ts, 'addErase')
+ return f(hdr)
+ return self.ts.add(hdr, hdr, "e")
+
+ def check(self):
+ """Check dependencies"""
+ if hasattr(self.ts, 'check'):
+ f = getattr(self.ts, 'check')
+ else:
+ f = getattr(self.ts, 'depcheck')
+ return f()
+
+ def setFlags(self, flag):
+ """Set transaction flags"""
+ if hasattr(rpm, 'headerFromPackage'):
+ # Old style rpm
+ old_flags = self._flags
+ self._flags = flag
+ return old_flags
+ return self.ts.setFlags(flag)
+
+ def setProbFilter(self, flag):
+ """Set problem flags"""
+ if hasattr(rpm, 'headerFromPackage'):
+ # Old style rpm
+ old_flags = self._prob_filter
+ self._prob_filter = flag
+ return old_flags
+ return self.ts.setProbFilter(flag)
+
+ def run(self, callback, user_data):
+ if hasattr(rpm, 'headerFromPackage'):
+ # Old style rpm
+ return self.ts.run(self._flags, self._prob_filter, callback,
+ user_data)
+ return self.ts.run(callback, user_data)
+
+
+
+
+class SharedStateTransaction:
+ _shared_state = {}
+
+ def __init__(self):
+ self.__dict__ = self._shared_state
+
+class RPMReadOnlyTransaction(SharedStateTransaction, RPMTransaction):
+ read_only = 1
+ def __init__(self):
+ SharedStateTransaction.__init__(self)
+ if not hasattr(self, 'ts'):
+ RPMTransaction.__init__(self)
+ # FIXME: replace with macro defination
+ self.pushVSFlags(8)
+
+class RPM_Header:
+ "Wrapper class for an rpm header - we need to store a flag is_source"
+ def __init__(self, hdr, is_source=None):
+ self.hdr = hdr
+ self.is_source = is_source
+ self.packaging = 'rpm'
+ self.signatures = []
+ self._extract_signatures()
+
+ def __getitem__(self, name):
+ return self.hdr[name]
+
+ def __getattr__(self, name):
+ return getattr(self.hdr, name)
+
+ def is_signed(self):
+ if hasattr(rpm, "RPMTAG_DSAHEADER"):
+ dsaheader = self.hdr["dsaheader"]
+ else:
+ dsaheader = 0
+ if self.hdr["siggpg"] or self.hdr["sigpgp"] or dsaheader:
+ return 1
+ return 0
+
+ def _extract_signatures(self):
+ header_tags = [
+ [rpm.RPMTAG_DSAHEADER, "dsa"],
+ [rpm.RPMTAG_RSAHEADER, "rsa"],
+ [rpm.RPMTAG_SIGGPG, "gpg"],
+ [rpm.RPMTAG_SIGPGP, 'pgp'],
+ ]
+ for ht, sig_type in header_tags:
+ ret = self.hdr[ht]
+ if not ret or len(ret) < 17:
+ continue
+ # Get the key id - hopefully we get it right
+ key_id = ret[9:17]
+ key_id_len = len(key_id)
+ format = "%dB" % key_id_len
+ t = struct.unpack(format, key_id)
+ format = "%02x" * key_id_len
+ key_id = format % t
+ self.signatures.append({
+ 'signature_type' : sig_type,
+ 'key_id' : key_id,
+ 'signature' : ret,
+ })
+
+def get_header_byte_range(package_file):
+ """
+ Return the start and end bytes of the rpm header object.
+
+ For details of the rpm file format, see:
+ http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html
+ """
+
+ lead_size = 96
+
+ # Move past the rpm lead
+ package_file.seek(lead_size)
+
+ sig_size = get_header_struct_size(package_file)
+
+ # Now we can find the start of the actual header.
+ header_start = lead_size + sig_size
+
+ package_file.seek(header_start)
+
+ header_size = get_header_struct_size(package_file)
+
+ header_end = header_start + header_size
+
+ return (header_start, header_end)
+
+def get_header_struct_size(package_file):
+ """
+ Compute the size in bytes of the rpm header struct starting at the current
+ position in package_file.
+ """
+ # Move past the header preamble
+ package_file.seek(8, 1)
+
+ # Read the number of index entries
+ header_index = package_file.read(4)
+ (header_index_value, ) = struct.unpack('>I', header_index)
+
+ # Read the the size of the header data store
+ header_store = package_file.read(4)
+ (header_store_value, ) = struct.unpack('>I', header_store)
+
+ # The total size of the header. Each index entry is 16 bytes long.
+ header_size = 8 + 4 + 4 + header_index_value * 16 + header_store_value
+
+ # Headers end on an 8-byte boundary. Round out the extra data.
+ round_out = header_size % 8
+ if round_out != 0:
+ header_size = header_size + (8 - round_out)
+
+ return header_size
+
+# Loads the package header from a file / stream / file descriptor
+# Raises rpm.error if an error is found, or InvalidPacageError if package is
+# busted
+# XXX Deal with exceptions better
+def get_package_header(filename=None, file=None, fd=None):
+ if (filename is None and file is None and fd is None):
+ raise ValueError, "No parameters passed"
+
+ if filename is not None:
+ f = open(filename)
+ elif file is not None:
+ f = file
+ f.seek(0, 0)
+ else: # fd is not None
+ f = None
+
+ if f is None:
+ os.lseek(fd, 0, 0)
+ file_desc = fd
+ else:
+ file_desc = f.fileno()
+
+ if hasattr(rpm, 'headerFromPackage'):
+ hdr, is_source = rpm.headerFromPackage(file_desc)
+ if hdr is None:
+ raise InvalidPackageError
+ else:
+ if hasattr(rpm, 'readHeaderFromFD'):
+ header_start, header_end = \
+ get_header_byte_range(os.fdopen(os.dup(file_desc)))
+ os.lseek(file_desc, header_start, 0)
+ hdr, offset = rpm.readHeaderFromFD(file_desc)
+ else:
+ # RHEL-4 and older, do the old way
+ ts = RPMReadOnlyTransaction()
+ nomd5 = getattr(rpm, 'RPMVSF_NOMD5')
+ needpayload = getattr(rpm, 'RPMVSF_NEEDPAYLOAD')
+ ts.pushVSFlags(~(nomd5 | needpayload))
+ hdr = RPMReadOnlyTransaction().hdrFromFdno(file_desc)
+ ts.popVSFlags()
+ if hdr is None:
+ raise InvalidPackageError
+ is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
+
+ return RPM_Header(hdr, is_source)
+
+class MatchIterator:
+ def __init__(self, tag_name=None, value=None):
+ # Query by name, by default
+ if not tag_name:
+ tag_name = "name"
+
+ if hasattr(rpm, "headerFromPackage"):
+ # rpm 4.0.4 or earlier
+ self.db = rpm.opendb()
+ method = self.db.match
+ else:
+ # rpm 4.1 or later
+ self.ts = rpm.TransactionSet()
+ self.ts.setVSFlags(8)
+ method = self.ts.dbMatch
+
+ if value:
+ self.mi = method(tag_name, value)
+ else:
+ self.mi = method(tag_name)
+
+ def pattern(self, tag_name, mode, pattern):
+ self.mi.pattern(tag_name, mode, pattern)
+
+ def next(self):
+ try:
+ hdr = self.mi.next()
+ except StopIteration:
+ hdr = None
+
+ if hdr is None:
+ return None
+ if hasattr(rpm, "headerFromPackage"):
+ is_source = not hdr[rpm.RPMTAG_SOURCERPM]
+ else:
+ is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
+ return RPM_Header(hdr, is_source)
+
+
+def headerLoad(data):
+ hdr = rpm.headerLoad(data)
+ if hasattr(rpm, "headerFromPackage"):
+ is_source = not hdr[rpm.RPMTAG_SOURCERPM]
+ else:
+ is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
+ return RPM_Header(hdr, is_source)
+
+def labelCompare(t1, t2):
+ return rpm.labelCompare(t1, t2)
+
+def nvre_compare(t1, t2):
+ def build_evr(p):
+ evr = [p[3], p[1], p[2]]
+ evr = map(str, evr)
+ if evr[0] == "":
+ evr[0] = None
+ return evr
+ if t1[0] != t2[0]:
+ raise ValueError("You should only compare packages with the same name")
+ evr1, evr2 = (build_evr(t1), build_evr(t2))
+ return rpm.labelCompare(evr1, evr2)
+
+
+def hdrLabelCompare(hdr1, hdr2):
+ """ take two RPMs or headers and compare them for order """
+
+ if hdr1['name'] == hdr2['name']:
+ hdr1 = [hdr1['epoch'] or None, hdr1['version'], hdr1['release']]
+ hdr2 = [hdr2['epoch'] or None, hdr2['version'], hdr2['release']]
+ if hdr1[0]:
+ hdr1[0] = str(hdr1[0])
+ if hdr2[0]:
+ hdr2[0] = str(hdr2[0])
+ return rpm.labelCompare(hdr1, hdr2)
+ elif hdr1['name'] < hdr2['name']:
+ return -1
+ return 1
+
+
+def rpmLabelCompare(rpmFilename1, rpmFilename2):
+ """ take two RPMs and compare them for order """
+ return hdrLabelCompare(get_package_header(rpmFilename1),
+ get_package_header(rpmFilename2))
+
+
+def sortHeaders(hdrs):
+ """ Sorts a list of RPM headers (or RPMs).
+ Assertion: they *must* exist.
+ """
+
+ assert isinstance(hdrs, type([]))
+
+ sorted = hdrs[:]
+ sorted.sort(hdrLabelCompare)
+ return sorted
+
+
+def sortRPMs(rpms):
+ """ Sorts a list of RPM files. They *must* exist. """
+
+ assert isinstance(rpms, type([]))
+
+ # We don't want to use rpmLabelCompare as a sorting mechanism, it would
+ # extract the rpm header for each comparison.
+ # Build a list of (header, rpm)
+ helper = map(lambda x: (get_package_header(x), x), rpms)
+
+ # Sort the list using the headers as a comparison
+ helper.sort(lambda x, y: hdrLabelCompare(x[0], y[0]))
+
+ # Extract the rpm names now
+ return map(lambda x: x[1], helper)
+
+
+def getInstalledHeader(rpmName):
+ """ quieries the RPM DB for a header matching rpmName. """
+
+ mi = MatchIterator("name")
+ mi.pattern("name", rpm.RPMMIRE_STRCMP, rpmName)
+ return mi.next()
+
+
+if __name__ == '__main__':
+ mi = MatchIterator("name")
+ mi.pattern("name", rpm.RPMMIRE_GLOB, "*ker*")
+ while 1:
+ h = mi.next()
+ if not h:
+ break
+ print h['name']
+ sys.exit(1)
+ hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.i386.rpm")
+ print dir(hdr)
+ # Sources
+ hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.src.rpm")
+ hdr2 = headerLoad(hdr.unload())
+ print hdr2
+ print len(hdr2.keys())
+
+
commit bf6ea40068d6bc5f7ef4241b619b1747f7ba7b82
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Thu Dec 3 11:41:33 2009 -0500
529483 - adding referer check to perl stack
diff --git a/web/modules/pxt/PXT/ApacheHandler.pm b/web/modules/pxt/PXT/ApacheHandler.pm
index 4a37404..a06a187 100644
--- a/web/modules/pxt/PXT/ApacheHandler.pm
+++ b/web/modules/pxt/PXT/ApacheHandler.pm
@@ -53,6 +53,7 @@ our $make_vile;
sub handler {
my $r = shift;
+
local $make_vile = 0;
$ENV{PATH} = "/bin:/usr/sbin";
@@ -73,6 +74,16 @@ sub handler {
my $cookies = $r->pnotes('pxt_cookies');
my $request = $r->pnotes('pxt_request');
+ #verify referer hostname is correct
+ my $referer = $r->headers_in->{'referer'};
+ if ($referer) {
+ my $hostname = $r->hostname;
+ my $ref_host = URI->new($referer)->host;
+ if ($hostname ne $ref_host) {
+ return PXT::ApacheHandler->handle_redirect($r, $request, "/rhn/YourRhn.do");
+ }
+ }
+
# Load API exceptions
my $exception_box = RHN::API::Exception->exception_box;
commit 618a7b3d9f2a072ae1ce89b8308eeaa7e68fb3b9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 3 16:16:42 2009 +0100
replaced installPackages.py & company with several lines in perl
diff --git a/satellite/install/install.pl b/satellite/install/install.pl
index 74c5b6e..0ccd063 100755
--- a/satellite/install/install.pl
+++ b/satellite/install/install.pl
@@ -971,9 +971,20 @@ sub install_rhn_packages {
26,
'Could not install RHN packages. Most likely your system is not configured with the @Base package group. See the RHN Satellite Server Installation Guide for more information about Software Requirements.');
} else {
- system_or_exit(['python', '-u', 'install/installPackages.py'],
+ my @rpms = glob("Satellite/*.rpm EmbeddedDB/*.rpm");
+
+ # skip packages already installed or newer version already installed
+ for my $i (0..$#rpms) {
+ my $ret = system ("rpm -U --test --nodeps --quiet 2>/dev/null $rpms[$i]");
+ if ($ret != 0) {
+ delete($rpms[$i]);
+ }
+ }
+ if (@rpms) {
+ system_or_exit(['rpm', '-Uv', @rpms],
26,
'Could not install RHN packages. Most likely your system is not configured with the @Base package group. See the RHN Satellite Server Installation Guide for more information about Software Requirements.');
+ }
}
return 1;
}
diff --git a/satellite/install/installPackages.py b/satellite/install/installPackages.py
deleted file mode 100755
index 178d124..0000000
--- a/satellite/install/installPackages.py
+++ /dev/null
@@ -1,234 +0,0 @@
-#!/usr/bin/python -u
-""" Install RHN product specific RPMs
-
- Copyright (c) 2002-2005, Red Hat, Inc.
- All rights reserved.
-"""
-# $Id: installPackages.py,v 1.25 2006-01-05 15:45:22 misa Exp $
-
-import os
-import sys
-import glob
-from translate import _
-
-import rhn_rpm
-import satLog
-from satErrors import *
-
-def systemExit(code, msgs=None):
- "Exit with a code and optional message(s). Saved a few lines of code."
-
- if msgs:
- if type(msgs) not in [type([]), type(())]:
- msgs = (msgs, )
- for msg in msgs:
- sys.stderr.write(str(msg)+'\n')
- sys.exit(code)
-
-
-def getInstalledPackageList():
- list = []
-
- mi = rhn_rpm.MatchIterator("name")
- while 1:
- h = mi.next()
- if not h:
- break
- epoch = h['epoch']
- if epoch is None:
- epoch = ""
- entry = (h['name'], h['version'], h['release'], epoch, h['arch'])
- list.append(entry)
- list.sort(lambda a, b: cmp(a[0], b[0]))
- return list
-
-
-def getListOfPackagesToInstall(rpmPath):
- # or if we decide to use a manifest, do it here
- globPattern = "%s/*.rpm" % rpmPath
-
- packagesToInstall = {}
- installedPackages = getInstalledPackageList()
- # Hash them by name
- installedPackagesDict = {}
- for package in installedPackages:
- name = package[0]
- installedPackagesDict[name] = package
-
- availablePackages = {}
- filenames = glob.glob(globPattern)
- for filename in filenames:
- hdr = rhn_rpm.get_package_header(filename=filename)
- epoch = hdr['epoch']
- if epoch is None:
- epoch = ""
- name = hdr['name']
- nvre = (name, hdr['version'], hdr['release'], epoch)
- availablePackages[nvre] = filename
-
- if not installedPackagesDict.has_key(name):
- # We need to install this nevertheless
- packagesToInstall[name] = filename
- continue
-
- installedPackage = installedPackagesDict[name]
- ret = rhn_rpm.nvre_compare(installedPackage, nvre)
-
- if ret >= 0:
- # already installed or older than what we have installed
- continue
-
- packagesToInstall[name] = filename
-
- return packagesToInstall.values()
-
-
-def installPackages(filenames, rpmPath, rpmCallback):
- if not filenames:
- # Nothing to do, moving on
- return 0
-
- ts = rhn_rpm.RPMTransaction()
-
- for filename in filenames:
- hdr = rhn_rpm.get_package_header(filename=filename)
- if hdr is None:
- raise RpmError(_("Error reading header from package %s") %
- filename)
- ts.addInstall(hdr, hdr, 'u')
-
- deps = ts.check()
-
- # make this smarter, duh
- if deps:
- raise DependencyError(_(
- "Dependencies should have already been resolved, "\
- "but they are not."), deps)
-
- ts.order()
- rc = ts.run(rpmCallback, rpmPath)
-
- if rc:
- errors = "\n"
- for e in rc:
- try:
- errors = errors + e[1] + "\n"
- except:
- errors = errors + str(e) + "\n"
- raise RpmError(_("Failed installing packages: %s") % errors)
-
- return 0
-
-class RPM_Callback:
- def __init__(self, total):
- self.total = total
- self.installed = 0
- self.message_template = "%%%ds/%%s Installing %%s" % len(str(self.total))
-
- def callback(self, what, amount, total, hdr, path):
- if what == rhn_rpm.RPMCALLBACK_INST_OPEN_FILE:
- fileName = "%s/%s-%s-%s.%s.rpm" % (path,
- hdr['name'],
- hdr['version'],
- hdr['release'],
- hdr['arch'])
- try:
- fd = os.open(fileName, os.O_RDONLY)
- except :
- print _("Error opening %s") % fileName
- raise RpmError(_("Error opening %s") % fileName)
-
- return fd
-
- if what == rhn_rpm.RPMCALLBACK_INST_START:
- fileName = "%s/%s-%s-%s.%s.rpm" % (path,
- hdr['name'],
- hdr['version'],
- hdr['release'],
- hdr['arch'])
- self.installed = self.installed + 1
- print self.message_template % (self.installed, self.total,
- fileName)
- elif what == rhn_rpm.RPMCALLBACK_INST_CLOSE_FILE:
- try:
- os.close(fd)
- except:
- pass
-
- elif what == rhn_rpm.RPMCALLBACK_INST_PROGRESS:
- pass
-
- elif what == rhn_rpm.RPMCALLBACK_UNINST_STOP:
- pass
-
- else:
- if hasattr(rhn_rpm, "RPMCALLBACK_UNPACK_ERROR") and \
- what == rhn_rpm.RPMCALLBACK_UNPACK_ERROR:
- pkg = "%s-%s-%s" % (hdr[rhn_rpm.RPMTAG_NAME],
- hdr[rhn_rpm.RPMTAG_VERSION],
- hdr[rhn_rpm.RPMTAG_RELEASE])
- raise RpmError(_("There was a rpm unpack error installing "
- "the package: %s") % pkg)
-
- if hasattr(rhn_rpm, "RPMCALLBACK_CPIO_ERROR") and \
- what == rhn_rpm.RPMCALLBACK_CPIO_ERROR:
- pkg = "%s-%s-%s" % (hdr[rhn_rpm.RPMTAG_NAME],
- hdr[rhn_rpm.RPMTAG_VERSION],
- hdr[rhn_rpm.RPMTAG_RELEASE])
- raise RpmError(_("There was a cpio error installing "
- "the package: %s") % pkg)
-
-
-def doInstallation(rpms_dir):
- pkgList = getListOfPackagesToInstall(rpms_dir)
- if not pkgList:
- print "All required packages are already installed"
- return 0
-
- #do it
- # may raise a DependencyError
- installPackages(pkgList, rpms_dir, RPM_Callback(len(pkgList)).callback)
-
- print "All required packages have been installed"
-
- return 0
-
-
-def main():
- os.chdir(os.path.dirname(sys.argv[0]))
-
- rpmdir = "../*"
- doInstallation(rpmdir)
-
- return 0
-
-
-if __name__ == "__main__":
- # 0 - all is well
- # -1 - help called
- # -2 - initLog failed
- # -3 - base directory access error
- # -4 - extra args on commandline
- # -5 - RpmError
- # -6 - rpm DependencyError
- # -100 - ^C
- try:
- satLog.initLog()
- except (OSError, IOError), e:
- systemExit(-2, "Unable to open log file. The error was: %s" % e)
-
- try:
- sys.exit(main() or 0)
- except KeyboardInterrupt, e:
- systemExit(-100, "User interrupted process")
- except (OSError, IOError), e:
- systemExit(-3, "Error accessing base directory: %s" % e)
- except ValueError, e:
- msg = "ERROR: these arguments make no sense in this context (try --help): %s\n" % repr(e.args)
- systemExit(-4, msg)
- except RpmError, e:
- systemExit(-5, repr(e))
- except DependencyError, e:
- systemExit(-6, 'ERROR: %s\n' % repr(e))
-
-
diff --git a/satellite/install/rhn_rpm.py b/satellite/install/rhn_rpm.py
deleted file mode 100644
index 9542cb1..0000000
--- a/satellite/install/rhn_rpm.py
+++ /dev/null
@@ -1,364 +0,0 @@
-#!/usr/bin/python
-#
-# Compatibility layer for rpm
-#
-# Copyright (c) 2004-2005, Red Hat Inc.
-# All rights reserved.
-#
-# $Id: rhn_rpm.py,v 1.9 2005-07-05 17:50:13 wregglej Exp $
-
-import os
-import sys
-import rpm
-import struct
-
-import exceptions
-if not hasattr(exceptions, 'StopIteration'):
- # Presumably python 1.5.2
- class StopIteration(Exception):
- pass
-
-# Expose a bunch of useful constants from rpm
-error = rpm.error
-for sym, val in rpm.__dict__.items():
- if sym[:3] == 'RPM':
- # A constant, probably - import it into our namespace
- globals()[sym] = val
-del sym, val
-
-class InvalidPackageError(Exception):
- pass
-
-# wrapper/proxy class for rpm.Transaction so we can
-# instrument it, etc easily
-class RPMTransaction:
- read_only = 0
- def __init__(self):
- if hasattr(rpm, 'opendb'):
- db = getattr(rpm, 'opendb')(not self.read_only)
- self.ts = rpm.TransactionSet('/', db)
- else:
- self.ts = rpm.TransactionSet()
- self.tsflags = []
- # For rpm 4.0.4
- self._flags = 0
- self._prob_filter = 0
-
- def __getattr__(self, attr):
- return getattr(self.ts, attr)
-
- def getMethod(self, method):
- # in theory, we can override this with
- # profile/etc info
- return getattr(self.ts, method)
-
- # push/pop methods so we don't lose the previous
- # set value, and we can potentially debug a bit
- # easier
- def pushVSFlags(self, flags):
- self.tsflags.append(flags)
- if hasattr(self.ts, 'setVSFlags'):
- f = getattr(self.ts, 'setVSFlags')
- f(self.tsflags[-1])
-
- def popVSFlags(self):
- del self.tsflags[-1]
- if hasattr(self.ts, 'setVSFlags'):
- f = getattr(self.ts, 'setVSFlags')
- f(self.tsflags[-1])
-
- def addInstall(self, arg1, arg2, mode):
- """Install a package"""
- hdr = arg1.hdr
- if hasattr(self.ts, 'addInstall'):
- f = getattr(self.ts, 'addInstall')
- return f(hdr, arg2, mode)
- return self.ts.add(hdr, arg2, mode)
-
- def addErase(self, arg1):
- """Erase a package"""
- hdr = arg1.hdr
- if hasattr(self.ts, 'addErase'):
- f = getattr(self.ts, 'addErase')
- return f(hdr)
- return self.ts.add(hdr, hdr, "e")
-
- def check(self):
- """Check dependencies"""
- if hasattr(self.ts, 'check'):
- f = getattr(self.ts, 'check')
- else:
- f = getattr(self.ts, 'depcheck')
- return f()
-
- def setFlags(self, flag):
- """Set transaction flags"""
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- old_flags = self._flags
- self._flags = flag
- return old_flags
- return self.ts.setFlags(flag)
-
- def setProbFilter(self, flag):
- """Set problem flags"""
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- old_flags = self._prob_filter
- self._prob_filter = flag
- return old_flags
- return self.ts.setProbFilter(flag)
-
- def run(self, callback, user_data):
- if hasattr(rpm, 'headerFromPackage'):
- # Old style rpm
- return self.ts.run(self._flags, self._prob_filter, callback,
- user_data)
- return self.ts.run(callback, user_data)
-
-
-
-
-class SharedStateTransaction:
- _shared_state = {}
-
- def __init__(self):
- self.__dict__ = self._shared_state
-
-class RPMReadOnlyTransaction(SharedStateTransaction, RPMTransaction):
- read_only = 1
- def __init__(self):
- SharedStateTransaction.__init__(self)
- if not hasattr(self, 'ts'):
- RPMTransaction.__init__(self)
- # FIXME: replace with macro defination
- self.pushVSFlags(8)
-
-class RPM_Header:
- "Wrapper class for an rpm header - we need to store a flag is_source"
- def __init__(self, hdr, is_source=None):
- self.hdr = hdr
- self.is_source = is_source
- self.packaging = 'rpm'
- self.signatures = []
- self._extract_signatures()
-
- def __getitem__(self, name):
- return self.hdr[name]
-
- def __getattr__(self, name):
- return getattr(self.hdr, name)
-
- def is_signed(self):
- if hasattr(rpm, "RPMTAG_DSAHEADER"):
- dsaheader = self.hdr["dsaheader"]
- else:
- dsaheader = 0
- if self.hdr["siggpg"] or self.hdr["sigpgp"] or dsaheader:
- return 1
- return 0
-
- def _extract_signatures(self):
- header_tags = [
- [rpm.RPMTAG_DSAHEADER, "dsa"],
- [rpm.RPMTAG_RSAHEADER, "rsa"],
- [rpm.RPMTAG_SIGGPG, "gpg"],
- [rpm.RPMTAG_SIGPGP, 'pgp'],
- ]
- for ht, sig_type in header_tags:
- ret = self.hdr[ht]
- if not ret or len(ret) < 17:
- continue
- # Get the key id - hopefully we get it right
- key_id = ret[9:17]
- key_id_len = len(key_id)
- format = "%dB" % key_id_len
- t = struct.unpack(format, key_id)
- format = "%02x" * key_id_len
- key_id = format % t
- self.signatures.append({
- 'signature_type' : sig_type,
- 'key_id' : key_id,
- 'signature' : ret,
- })
-
-
-# Loads the package header from a file / stream / file descriptor
-# Raises rpm.error if an error is found, or InvalidPacageError if package is
-# busted
-# XXX Deal with exceptions better
-def get_package_header(filename=None, file=None, fd=None):
- if (filename is None and file is None and fd is None):
- raise ValueError, "No parameters passed"
-
- if filename is not None:
- f = open(filename)
- elif file is not None:
- f = file
- f.seek(0, 0)
- else: # fd is not None
- f = None
-
- if f is None:
- os.lseek(fd, 0, 0)
- file_desc = fd
- else:
- file_desc = f.fileno()
-
- if hasattr(rpm, 'headerFromPackage'):
- hdr, is_source = rpm.headerFromPackage(file_desc)
- if hdr is None:
- raise InvalidPackageError
- else:
- ts = RPMReadOnlyTransaction()
- nomd5 = getattr(rpm, 'RPMVSF_NOMD5')
- needpayload = getattr(rpm, 'RPMVSF_NEEDPAYLOAD')
- ts.pushVSFlags(~(nomd5 | needpayload))
- hdr = RPMReadOnlyTransaction().hdrFromFdno(file_desc)
- ts.popVSFlags()
- if hdr is None:
- raise InvalidPackageError
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
-
- return RPM_Header(hdr, is_source)
-
-class MatchIterator:
- def __init__(self, tag_name=None, value=None):
- # Query by name, by default
- if not tag_name:
- tag_name = "name"
-
- if hasattr(rpm, "headerFromPackage"):
- # rpm 4.0.4 or earlier
- self.db = rpm.opendb()
- method = self.db.match
- else:
- # rpm 4.1 or later
- self.ts = rpm.TransactionSet()
- self.ts.setVSFlags(8)
- method = self.ts.dbMatch
-
- if value:
- self.mi = method(tag_name, value)
- else:
- self.mi = method(tag_name)
-
- def pattern(self, tag_name, mode, pattern):
- self.mi.pattern(tag_name, mode, pattern)
-
- def next(self):
- try:
- hdr = self.mi.next()
- except StopIteration:
- hdr = None
-
- if hdr is None:
- return None
- if hasattr(rpm, "headerFromPackage"):
- is_source = not hdr[rpm.RPMTAG_SOURCERPM]
- else:
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
- return RPM_Header(hdr, is_source)
-
-
-def headerLoad(data):
- hdr = rpm.headerLoad(data)
- if hasattr(rpm, "headerFromPackage"):
- is_source = not hdr[rpm.RPMTAG_SOURCERPM]
- else:
- is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
- return RPM_Header(hdr, is_source)
-
-def labelCompare(t1, t2):
- return rpm.labelCompare(t1, t2)
-
-def nvre_compare(t1, t2):
- def build_evr(p):
- evr = [p[3], p[1], p[2]]
- evr = map(str, evr)
- if evr[0] == "":
- evr[0] = None
- return evr
- if t1[0] != t2[0]:
- raise ValueError("You should only compare packages with the same name")
- evr1, evr2 = (build_evr(t1), build_evr(t2))
- return rpm.labelCompare(evr1, evr2)
-
-
-def hdrLabelCompare(hdr1, hdr2):
- """ take two RPMs or headers and compare them for order """
-
- if hdr1['name'] == hdr2['name']:
- hdr1 = [hdr1['epoch'] or None, hdr1['version'], hdr1['release']]
- hdr2 = [hdr2['epoch'] or None, hdr2['version'], hdr2['release']]
- if hdr1[0]:
- hdr1[0] = str(hdr1[0])
- if hdr2[0]:
- hdr2[0] = str(hdr2[0])
- return rpm.labelCompare(hdr1, hdr2)
- elif hdr1['name'] < hdr2['name']:
- return -1
- return 1
-
-
-def rpmLabelCompare(rpmFilename1, rpmFilename2):
- """ take two RPMs and compare them for order """
- return hdrLabelCompare(get_package_header(rpmFilename1),
- get_package_header(rpmFilename2))
-
-
-def sortHeaders(hdrs):
- """ Sorts a list of RPM headers (or RPMs).
- Assertion: they *must* exist.
- """
-
- assert isinstance(hdrs, type([]))
-
- sorted = hdrs[:]
- sorted.sort(hdrLabelCompare)
- return sorted
-
-
-def sortRPMs(rpms):
- """ Sorts a list of RPM files. They *must* exist. """
-
- assert isinstance(rpms, type([]))
-
- # We don't want to use rpmLabelCompare as a sorting mechanism, it would
- # extract the rpm header for each comparison.
- # Build a list of (header, rpm)
- helper = map(lambda x: (get_package_header(x), x), rpms)
-
- # Sort the list using the headers as a comparison
- helper.sort(lambda x, y: hdrLabelCompare(x[0], y[0]))
-
- # Extract the rpm names now
- return map(lambda x: x[1], helper)
-
-
-def getInstalledHeader(rpmName):
- """ quieries the RPM DB for a header matching rpmName. """
-
- mi = MatchIterator("name")
- mi.pattern("name", rpm.RPMMIRE_STRCMP, rpmName)
- return mi.next()
-
-
-if __name__ == '__main__':
- mi = MatchIterator("name")
- mi.pattern("name", rpm.RPMMIRE_GLOB, "*ker*")
- while 1:
- h = mi.next()
- if not h:
- break
- print h['name']
- sys.exit(1)
- hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.i386.rpm")
- print dir(hdr)
- # Sources
- hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.src.rpm")
- hdr2 = headerLoad(hdr.unload())
- print hdr2
- print len(hdr2.keys())
-
-
diff --git a/satellite/install/satErrors.py b/satellite/install/satErrors.py
deleted file mode 100644
index 6795b01..0000000
--- a/satellite/install/satErrors.py
+++ /dev/null
@@ -1,380 +0,0 @@
-""" single placeholder for the satellite installer exceptions
-
- Copyright (c) 2002-2005, Red Hat, Inc.
- All rights reserved.
-"""
-# $Id: satErrors.py,v 1.41 2005-07-05 17:50:13 wregglej Exp $
-
-PRODUCT_NAME = "RHN Satellite"
-
-import sys
-import time
-import socket
-import traceback
-
-from satLog import log_me
-from translate import _
-from cStringIO import StringIO
-
-# XXX Warning! Do not try to use this rhn_rpm for any exceptions
-# things; there is code that uses common/rhn_rpm
-# Even though the classes would have the same name, they would be different
-# objects; try/except would not work correctly
-import rhn_rpm
-
-def print_req(req, fd = sys.stderr):
- """ get some debugging information about the current exception for sending
- out when we raise an exception
- """
-
- fd.write("Request object information:\n")
- fd.write("URI: %s\n" % req.unparsed_uri)
- fd.write("Remote Host: %s\nServer Name: %s:%d\n" % (
- req.get_remote_host(), req.server.server_hostname, req.server.port))
- fd.write("Headers passed in:\n")
- kl = req.headers_in.keys()
- kl.sort()
- for k in kl:
- fd.write("\t%s: %s\n" % (k, req.headers_in[k]))
- return 0
-
-hostname = socket.gethostname()
-
-def Traceback(method = None, req = None, mail = 1, ostream = sys.stderr,
- extra = None, severity="notification"):
- """ Reports an traceback error and optionally sends mail about it.
- NOTE: extra = extra text information.
- NOTE2: adapted from common.rhnTB.py
- (can't import from common because this module may be imported
- before common exists)
- """
-
- e_type, e_value = sys.exc_info()[:2]
- t = time.ctime(time.time())
- exc = StringIO()
-
- exc.write("Exception reported from %s\nTime: %s\n" % (hostname, t))
- exc.write("Exception type %s\n" % (e_type,))
- if method:
- exc.write("Exception while handling function %s\n" % method)
-
- # print information about the request being served
- if req:
- print_req(req, exc)
- if extra:
- exc.write("Extra information about this error:\n%s\n" % extra)
-
- # Print the traceback
- exc.write("\nException Handler Information\n")
- traceback.print_exc(None, exc)
-
- # we always log it somewhere
- if ostream:
- ostream.write("%s\n" % exc.getvalue())
-
- ret = 0 # default return value
- if mail:
- pass
- exc.close()
- return ret
-
-def fetchTraceback(method=None, req=None, extra=None):
- #""" a cheat for snagging just the string value of a Traceback """
- exc = StringIO()
- Traceback(method=method, req=req, mail=0, ostream=exc, extra=extra,
- severity=None)
- return exc.getvalue()
-
-
-def repr_str(e):
- """return a repr(e), str(e) string safely
-
- Will return something like:
- '''
- ...repr(e)...
- ...str(e)...'''
- """
-
- s = ''
- try:
- s = 'EXCEPTION: %s' % e.__class__.__name__
- except:
- s = 'EXCEPTION: <unable to determine>'
- try:
- if e.__repr__ == e.__str__:
- s = s + '\n%s' % repr(e)
- except:
- try:
- s = s + '\n%s' % repr(e)
- except:
- pass
- try:
- s = s + '\n%s' % str(e)
- except:
- pass
- return s
-
-
-class Error(Exception):
- "base class for errors"
- def __init__(self, errmsg):
- Exception.__init__(self)
- self.errmsg = str(errmsg)
-
- def __repr__(self):
- log_me(self.errmsg)
- return self.errmsg
-
-
-class SatelliteConfigDeploymentError(Error):
- "Indicates there was a problem deploying the satellite config files"
- def __repr__(self):
- msg = _("Error deploying %s config files. "
- "The message was:\n" % PRODUCT_NAME) + self.errmsg
- log_me(msg)
- return msg
-
-
-class InvalidUsernamePassword(Error):
- "Invalid RHN username and password were provided"
- def __repr__(self):
- msg = _("The username and password provided do not "
- "match an existing RHN account:\n") + self.errmsg
- log_me(msg)
- return msg
-
-
-class SatelliteCertVerifyError(Error):
- "RHN product Entitlement Certificate failed to validate"
- def __repr__(self):
- msg = _("The %s Entitlement Certificate "
- "failed to validate:\n" % PRODUCT_NAME) + self.errmsg
- log_me(msg)
- return msg
-
-
-class RhnEntitlementError(Error):
- "System could not register to Red Hat Network"
- def __repr__(self):
- msg = _("The system was unable to register to "
- "the Red Hat Network:\n") + self.errmsg
- log_me(msg)
- return msg
-
-
-class UpdateError(Error):
- "Raise when an up2date failed"
- def __repr__(self):
- msg = _("There was an error while trying to "
- "update this system:\n") + self.errmsg
- log_me(msg)
- return msg
-
-
-class RpmError(Error):
- "RPM raised an error condition"
- def __repr__(self):
- msg = _("RPM error while handling The message was:\n") + self.errmsg
- log_me(msg)
- return msg
-
-
-def rpm_flags(flags):
- """a helper function to help translate the rpm flags on
- dependency issues"""
-
- flags = flags & 0xFF
- s = ""
- if flags != 0:
- if flags & rhn_rpm.RPMSENSE_LESS:
- s = s + "<"
- if flags & rhn_rpm.RPMSENSE_GREATER:
- s = s + ">"
- if flags & rhn_rpm.RPMSENSE_EQUAL:
- s = s + "="
- if flags & rhn_rpm.RPMSENSE_SERIAL:
- s = s + "S"
- return s
-
-
-def deps_as_text(deps):
- "stringifies/text-ifies rpm dependency infomation"
-
- s = _("Unresolved rpm dependencies:\n\n")
- sense_map = ["requires", "conflicts with"]
-
- for d in deps:
- ((name, version, release), (needsName, needsVersion),
- flags, suggested, sense) = d
- s = s + "Package "
- if needsVersion:
- s = s + _("%s %s %s\n") % (
- "%s-%s-%s" % (name, version, release),
- sense_map[sense],
- "%s %s %s" % (needsName, rpm_flags(flags), needsVersion))
- else:
- s = s + _("%s %s %s\n") % (
- "%s %s %s-%s" % (name, rpm_flags(flags), version, release),
- sense_map[sense],
- needsName)
- return s
-
-
-class DependencyError(Error):
-
- "RPM transaction raised a dependency error"
-
- def __init__(self, msg, deps=None):
- self.errmsg = str(msg)
- # just tag on the whole deps tuple, so we have plenty of info
- # to play with
- self.deps = deps
-
- def __repr__(self):
- msg = _("RPM dependency error. The message was:\n") + self.errmsg
- if self.deps:
- msg = "%s\n%s" % (msg, deps_as_text(self.deps))
- log_me(msg)
- return msg
-
-
-class genPublicCaCertError(Error):
-
- "Raise when we fail to properly generate a CA cert"
-
- def __repr__(self):
- msg = _("There was an error while generating a "
- "Certificate Authority Cert:\n") + self.errmsg
- log_me(msg)
- return msg
-
-
-class genPrivateCaKeyError(Error):
- "Raise when we fail to properly generate a CA Key"
- def __repr__(self):
- msg = _("There was an error while generating a "
- "Certificate Authority Key:\n") + self.errmsg
- log_me(msg)
- return msg
-
-
-class genServerKeyError(Error):
- "Raise when we fail to properly generate a httpd server key"
- def __repr__(self):
- msg = _("Error while generating a httpd "
- "server key:\n") + self.errmsg
- log_me(msg)
- return msg
-
-
-class genServerCertReqError(Error):
- """ Raise when we fail to properly generate a httpd server certificate
- request
- """
- def __repr__(self):
- msg = _("Error while generating a httpd server certificate "
- "request:\n") + self.errmsg
- log_me(msg)
- return msg
-
-class genServerCertError(Error):
- "Raise when we fail to properly generate a httpd server certificate"
- def __repr__(self):
- msg = _("Error while generating a httpd server "
- "certificate:\n") + self.errmsg
- log_me(msg)
- return msg
-
-#class CaCertInsertionError(Exception):
-# "raise when fail to insert CA cert into the local database"
-#XXX: now in satellite_tools.satCerts
-
-
-class InvalidDbCharsetsError(Exception):
- "databases are only allowed the UF8 charset, else raise this!"
-
-
-class dbVersionIncorrectError(Error):
- "Raise when we detect the database is not he proper version"
- def __repr__(self):
- msg = _("The database is not the proper "
- "version:\n") + self.errmsg
- log_me(msg)
- return msg
-
-
-class SchemaImportError(Error):
- "Raise when we fail to import the database schema"
- def __repr__(self):
- msg = _("Database schema import failed:\n") + self.errmsg
- log_me(msg)
- return msg
-
-
-class dbIncorrectPermissionsError(Error):
- "Database user does not have the approriate permissions"
- def __init__(self, msg, missingPrivs=None):
- self.errmsg = str(msg)
- # just tag on the whole deps tuple, so we have plenty of info
- # to play with
- self.missingPrivs = missingPrivs
-
- def __repr__(self):
- msg = _("Database Permissions error: The message "
- "was:\n") + self.errmsg
- log_me(msg)
- log_me("The database reported the following "
- "permissions were incorrect:\n %s" % self.missingPrivs)
- return msg
-
-
-class dbTableSpaceError(Error):
- "Database user doesnt have the approriate permissions"
- def __init__(self, msg, errs=None):
- Error.__init__(self, msg)
- # just tag on the whole deps tuple, so we have plenty of info
- # to play with
- self.errs = errs
-
- def __repr__(self):
- msg = _("Database Permissions error: The message "
- "was:\n") + self.errmsg
- log_me(msg)
- log_me("The database reported the following "
- "permissions were incorrect:\n %s" % self.errs)
- return msg
-
-class MissingCaCertError(Exception):
- "raised if ssl ca cert is missing at that location"
-
-class DirectoryNotFoundError(Exception):
- "missing directory"
-
-class ArgumentError(Exception):
- "raised whenever there is any issues with the options in the commandline."
-
-class UnhandledXmlrpcError(Exception):
- "generic exception, but for XMLRPC failures"
-
-
-# Exception classes mainly for the activation portion of the install.
-class MissingSystemidError(Exception):
- "raised if systemid is missing/inaccessible at that location"
-
-class MissingRhnCertError(Exception):
- "raised if RHN cert is missing/inaccessible at that location"
-
-class InvalidRhnCertError(Exception):
- "raised if RHN Entitlement Certificate is invalid"
-
-class ChannelFamilyPopulationError(Error):
- "Indicates there was a problem populating the channel families"
- def __repr__(self):
- msg = _("Error populating channel families to the local DB. "
- "The message was:\n") + self.errmsg
- log_me(msg)
- return msg
-
-class RhnsdRestartError(Error):
- "Raised if rhnsd refused to restart"
-
diff --git a/satellite/install/satLog.py b/satellite/install/satLog.py
deleted file mode 100644
index 9697d7c..0000000
--- a/satellite/install/satLog.py
+++ /dev/null
@@ -1,116 +0,0 @@
-""" Log classes/functions for the installer
-
- Copyright (c) 2002-2005, Red Hat, Inc.
- All rights reserved.
-"""
-
-#-------------------------------------------------------------------------------
-# $Id: satLog.py,v 1.14 2005-07-05 17:50:13 wregglej Exp $
-
-import sys
-import time
-import string
-
-
-DEFAULT_LOG_FILE = "/var/log/rhn_satellite_install.log"
-LOG = None
-
-
-class Log:
-
- """attempt to log all interesting stuff, namely, anything that hits
- the network any error messages, package installs, etc
-
- This log class stolen from up2date (mostly)
- """
-
- def __init__(self, filename=None):
-
- self.app = "sat-install"
- self.filename = filename
-
- self.log_me("new satinstall run started");
-
- def log_me(self, *args):
- self.log_info = "[%s] %s" % (time.ctime(time.time()), self.app)
- s = ""
- for i in args:
- s = s + "%s" % i
- self.write_log(s)
-
- def log_me_clean(self, *args):
- self.log_info = ""
- s = ""
- for i in args:
- s = s + "%s" % i
- self.write_log(s)
-
- def trace_me(self):
- import traceback
- x = traceback.extract_stack()
- bar = string.join(traceback.format_list(x))
- self.write_log(bar)
-
- def write_log(self, s):
- self.fo = open(self.filename, 'a')
- msg = "%s %s\n" % (self.log_info, str(s))
- self.fo.write(msg)
- self.fo.flush()
- self.fo.close()
-
-
-def initLog(filename=DEFAULT_LOG_FILE):
- global LOG
- if LOG == None:
- LOG = Log(filename=filename)
- return LOG
-
-
-def log_me(*args):
- global LOG
- if LOG is None:
- raise SystemError("The log file has not been initialized yet")
- apply(LOG.log_me, args)
-
-
-def log_me_clean(*args):
- global LOG
- if LOG is None:
- raise SystemError("The log file has not been initialized yet")
- apply(LOG.log_me_clean, args)
-
-
-def log_me_stderr_clean(*args):
- "write to both stderr/stdout and the log file"
-
- log_me_clean(args)
- s = ''
- for a in args:
- s = s+str(a)
- sys.stderr.write(s+'\n')
-
-
-def log_me_stdout_clean(*args):
- log_me_clean(args)
- s = ''
- for a in args:
- s = s+str(a)
- sys.stdout.write(s+'\n')
-
-
-def log_me_stderr(*args):
- log_me(args)
- s = ''
- for a in args:
- s = s+str(a)
- sys.stderr.write(s+'\n')
-
-
-def log_me_stdout(*args):
- log_me(args)
- s = ''
- for a in args:
- s = s+str(a)
- sys.stdout.write(s+'\n')
-
-#===============================================================================
diff --git a/satellite/install/translate.py b/satellite/install/translate.py
deleted file mode 100644
index 50e6157..0000000
--- a/satellite/install/translate.py
+++ /dev/null
@@ -1,112 +0,0 @@
-# rhnTranslate.py - Python module to handle translations.
-#-----------------------------------------------------------------------------
-# Handles language (human) translations.
-#
-# Copyright (c) 2001-2005, Red Hat Inc.
-# All rights reserved.
-#
-#-----------------------------------------------------------------------------
-# $Id: translate.py,v 1.9 2005-07-05 17:50:13 wregglej Exp $
-
-import os
-import types
-import gettext
-import string
-
-if hasattr(gettext, 'GNUTranslations'):
- class RHN_Translations(gettext.GNUTranslations):
- # Defining our own class, since we'd like to save the language we use
- # Determining the language is not very pretty - we parse the file name
- # which is supposed to be something like
- # .../<lang>/LC_MESSAGES/<domain>.po
- def _parse(self, fp):
- gettext.GNUTranslations._parse(self, fp)
- filename = fp.name
- filename = os.path.normpath(filename)
- # Extract the language
- self.lang = string.split(filename, '/')[-3]
-
- def getlangs(self):
- # Return all languages
- if not self._fallback or not hasattr(self._fallback, 'getlangs'):
- return [ self.lang, 'C' ]
- # Recursive call
- return [ self.lang ] + self._fallback.getlangs()
-
-class i18n:
- _default_langs = ['en', 'en_US', 'C']
- # Wrapper class that allows us to change languages
- def __init__(self, domain=None, localedir="."):
- self.domain = domain
- self.localedir = localedir
- self.langs = self._default_langs[:]
- self._set_catalog()
-
- def _set_catalog(self):
- # Set the catalog object
- self.cat = gettext.Catalog(self.domain, localedir=self.localedir,
- languages=self.langs, fallback=1, class_=RHN_Translations)
-
- def getlangs(self):
- # List of languages we support
- if not hasattr(self.cat, "getlangs"):
- return [ "C" ]
- return self.cat.getlangs()
-
- def setlangs(self, langs):
- if isinstance(langs, types.StringType):
- langs = [ langs ]
- langs.extend(self._default_langs)
- self.langs = langs
- self._set_catalog()
-
- def gettext(self, string):
- return self.cat.gettext(string)
-
- # reinitialize this catalog
- def set(self, domain=None, localedir=None):
- if domain: self.domain = domain
- if localedir: self.localedir = localedir
- self._set_catalog()
-
-# Old-style gettext
-class i18n_old(i18n):
- def _set_catalog(self):
- self.cat = gettext.Catalog(self.domain, localedir=self.localedir)
-
- def getlangs(self):
- return gettext.lang
-
- def setlangs(self, langs):
- if isinstance(langs, types.StringType):
- langs = [ langs ]
- # Build the list of languages
- _added_langs = []
- for l in langs:
- _added_langs.extend(gettext._expandLang(l))
- # Adding some defaults
- _added_langs.extend(self._default_langs)
- # Remove duplicates
- h = {}
- del gettext.lang[:]
- for l in _added_langs:
- if l == 'C':
- # We'll add it back later
- continue
- if h.has_key(l):
- # Already loaded it
- continue
- gettext.lang.append(l)
- h[l] = None
- if "C" not in gettext.lang:
- gettext.lang.append("C")
- self._set_catalog()
-
-def N_(str):
- return str
-
-if hasattr(gettext, 'GNUTranslations'):
- cat = i18n()
-else:
- cat = i18n_old()
-_ = cat.gettext
commit 12172ee30b83432143458bb30e1a7e04e22ee6b2
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Dec 3 15:08:38 2009 +0100
send an empty list rather than empty hash
Server expects list (not hash). This was mistakenly changes in commit
6006097b890aa925e06bf65a81d11d73f78b9103
diff --git a/client/rhel/rhn-client-tools/src/bin/rhnreg_ks.py b/client/rhel/rhn-client-tools/src/bin/rhnreg_ks.py
index f94ec88..e21f18e 100755
--- a/client/rhel/rhn-client-tools/src/bin/rhnreg_ks.py
+++ b/client/rhel/rhn-client-tools/src/bin/rhnreg_ks.py
@@ -104,7 +104,7 @@ class RegisterKsCli(rhncli.RhnCli):
getInfo = 1
packageList = rpmUtils.getInstalledPackageList(getInfo=getInfo)
else:
- packageList = {}
+ packageList = []
hardwareList = hardware.Hardware()
commit ccd4f51aab40d49b22ba75d0d19010c95cb62406
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Dec 3 14:06:28 2009 +0100
nightly is now build to 0.8-candidate tags
diff --git a/rel-eng/build-missing-builds-in-koji.sh b/rel-eng/build-missing-builds-in-koji.sh
index da85a92..eb8efb8 100755
--- a/rel-eng/build-missing-builds-in-koji.sh
+++ b/rel-eng/build-missing-builds-in-koji.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-TAGS=([0]="dist-5E-sw-0.7-candidate" [1]="dist-f11-sw-0.7-candidate" [2]="dist-f12-sw-0.7-candidate")
+TAGS=([0]="dist-5E-sw-0.8-candidate" [1]="dist-f11-sw-0.8-candidate" [2]="dist-f12-sw-0.8-candidate")
pushd `pwd`
commit aed727e46acf0c7b70919c656c96f824eb659ed2
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Dec 3 13:19:09 2009 +0100
216808 - if username and password is not given on command line, script will prompt for it
diff --git a/client/rhel/rhn-client-tools/man/en/spacewalk-channel.8 b/client/rhel/rhn-client-tools/man/en/spacewalk-channel.8
index 427e062..c7b40cb 100644
--- a/client/rhel/rhn-client-tools/man/en/spacewalk-channel.8
+++ b/client/rhel/rhn-client-tools/man/en/spacewalk-channel.8
@@ -42,10 +42,12 @@ You are unsubscribing system to given channel(s). You have to specify --user and
.br
.IP "\fB-u, --username\fP"
Your username used to register the system with and for Red Hat Network, RHN Satellite or Spacewalk.
+If you do not enter this option and it is required, you will be prompted.
.br
.IP "\fB-p, --password\fP"
The password associated with the username specified with the \fB--username\fR
option. This is an unencrypted password.
+If you do not enter this option and it is required, you will be prompted.
.br
.IP "\fB-c, --channel\fP"
Label of channel you want to subscribe to or unsubscribe from. Can be specified multiple
diff --git a/client/rhel/rhn-client-tools/src/bin/spacewalk-channel.py b/client/rhel/rhn-client-tools/src/bin/spacewalk-channel.py
index da1d082..968dd29 100644
--- a/client/rhel/rhn-client-tools/src/bin/spacewalk-channel.py
+++ b/client/rhel/rhn-client-tools/src/bin/spacewalk-channel.py
@@ -16,6 +16,8 @@
import os
import socket
import sys
+import getpass
+
from optparse import Option, OptionParser
def systemExit(code, msgs=None):
@@ -65,9 +67,10 @@ def processCommandline():
if args:
systemExit(1, "ERROR: these arguments make no sense in this context (try --help)")
if not OPTIONS.user and not OPTIONS.list:
- systemExit(2, "ERROR: username is required")
+ print("Username: ")
+ OPTIONS.user = sys.stdin.readline()
if not OPTIONS.password and not OPTIONS.list:
- systemExit(3, "ERROR: password is required")
+ OPTIONS.password = getpass.getpass()
def main():
if OPTIONS.add:
commit 16c641efcc1ef5d4d9e5dc408653134e14df818b
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Dec 3 12:16:24 2009 +0100
216808 - polish man page
diff --git a/client/rhel/rhn-client-tools/man/en/spacewalk-channel.8 b/client/rhel/rhn-client-tools/man/en/spacewalk-channel.8
index 668c3d6..427e062 100644
--- a/client/rhel/rhn-client-tools/man/en/spacewalk-channel.8
+++ b/client/rhel/rhn-client-tools/man/en/spacewalk-channel.8
@@ -25,23 +25,23 @@ spacewalk-channel [\fIoptions\fP]
.SH DESCRIPTION
.PP
-\fVspacewalk-channel\fR enable you to subscribe to and unsubscribe from
-specified channels via the command line so a visit to the Red Hat Network
+\fVspacewalk-channel\fR allows you to subscribe to and unsubscribe from
+specified channels via the command line. A visit to the Red Hat Network
(or Spacewalk) website isn't required.
.SH OPTIONS
.IP "\fB-l, --list\fP"
-Print list of channel you are currently subscribed to.
+Print a list of channel(s) that you are currently subscribed to.
.br
.IP "\fB-a, --add\fP"
-You are subscribing system to given channel. You have to specify --user and --password.
+You are subscribing system to given channel(s). You have to specify --user and --password.
.br
.IP "\fB-r, --remove\fP"
-You are unsubscribing system to given channel. You have to specify --user and --password.
+You are unsubscribing system to given channel(s). You have to specify --user and --password.
.br
.IP "\fB-u, --username\fP"
-The username to register the system with under Red Hat Network, RHN Satellite or Spacewalk.
+Your username used to register the system with and for Red Hat Network, RHN Satellite or Spacewalk.
.br
.IP "\fB-p, --password\fP"
The password associated with the username specified with the \fB--username\fR
@@ -57,13 +57,17 @@ Print out successfull action.
.IP "\fB-h, --help\fP"
Show a help message and exit.
+.SH NOTE
+.PP
+The addition and removal of channels is mutually exclusive, please use the command twice.
+
.SH "EXAMPLES"
Subscribe to two channels:
.RS
.nf
-spacewalk-channel --add -c rhn-tools-rhel-i386-server-5 -c rhel-i386-server-vt-5 --user user --password foobar
+spacewalk-channel --add -c rhn-tools-rhel-i386-server-5 -c rhel-i386-server-vt-5 --user username --password password
.fi
.RE
@@ -71,7 +75,7 @@ Unsubscribe from channel:
.RS
.nf
-spacewalk-channel --remove -c rhn-tools-rhel-i386-server-5 -c rhel-i386-server-vt-5 --user user --password foobar
+spacewalk-channel --remove -c rhn-tools-rhel-i386-server-5 -c rhel-i386-server-vt-5 --user username --password password
.fi
.RE
commit d131ea665c012c79c9bee9efa0205f4b4693a457
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Dec 3 10:57:43 2009 +0100
bumping Version to 0.8.0
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 3ec93e9..2b04045 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -7,7 +7,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 0.7.18
+Version: 0.8.0
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
diff --git a/branding/spacewalk-branding.spec b/branding/spacewalk-branding.spec
index 1e5fa4b..c4ebf47 100644
--- a/branding/spacewalk-branding.spec
+++ b/branding/spacewalk-branding.spec
@@ -1,5 +1,5 @@
Name: spacewalk-branding
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
Summary: Spacewalk branding data
diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec b/client/rhel/rhn-client-tools/rhn-client-tools.spec
index b39ab44..f94d6e8 100644
--- a/client/rhel/rhn-client-tools/rhn-client-tools.spec
+++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec
@@ -4,7 +4,7 @@ Group: System Environment/Base
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
URL: https://fedorahosted.org/spacewalk
Name: rhn-client-tools
-Version: 0.7.11
+Version: 0.8.0
Release: 1%{?dist}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if 0%{?suse_version: %{suse_version} > 1000}
diff --git a/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec b/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
index 467e028..51accb4 100644
--- a/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
+++ b/client/rhel/yum-rhn-plugin/yum-rhn-plugin.spec
@@ -1,6 +1,6 @@
Summary: RHN support for yum
Name: yum-rhn-plugin
-Version: 0.7.8
+Version: 0.8.0
Release: 1%{?dist}
License: GPLv2
Group: System Environment/Base
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index ac719d1..4f73b5c 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -12,7 +12,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 0.7.24
+Version: 0.8.0
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
diff --git a/monitoring/spacewalk-monitoring/spacewalk-monitoring.spec b/monitoring/spacewalk-monitoring/spacewalk-monitoring.spec
index 9fda14f..acfb919 100644
--- a/monitoring/spacewalk-monitoring/spacewalk-monitoring.spec
+++ b/monitoring/spacewalk-monitoring/spacewalk-monitoring.spec
@@ -8,7 +8,7 @@
Summary: Spacewalk monitoring
Name: spacewalk-monitoring
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
License: GPLv2
diff --git a/monitoring/spacewalk-proxy-monitoring/spacewalk-proxy-monitoring.spec b/monitoring/spacewalk-proxy-monitoring/spacewalk-proxy-monitoring.spec
index 8217b21..a573811 100644
--- a/monitoring/spacewalk-proxy-monitoring/spacewalk-proxy-monitoring.spec
+++ b/monitoring/spacewalk-proxy-monitoring/spacewalk-proxy-monitoring.spec
@@ -2,7 +2,7 @@
Summary: Meta-package that pulls in all of the Spacewalk monitoring packages
Name: spacewalk-proxy-monitoring
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
License: GPLv2
diff --git a/proxy/installer/spacewalk-proxy-installer.spec b/proxy/installer/spacewalk-proxy-installer.spec
index ddd87b2..113fd9a 100644
--- a/proxy/installer/spacewalk-proxy-installer.spec
+++ b/proxy/installer/spacewalk-proxy-installer.spec
@@ -2,7 +2,7 @@ Name: spacewalk-proxy-installer
Summary: Spacewalk Proxy Server Installer
Group: Applications/Internet
License: GPLv2
-Version: 0.7.2
+Version: 0.8.0
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
diff --git a/proxy/proxy-docs/spacewalk-proxy-docs.spec b/proxy/proxy-docs/spacewalk-proxy-docs.spec
index 2c715df..ea32f21 100644
--- a/proxy/proxy-docs/spacewalk-proxy-docs.spec
+++ b/proxy/proxy-docs/spacewalk-proxy-docs.spec
@@ -4,7 +4,7 @@ Group: Applications/Internet
License: Open Publication
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 0.7.0
+Version: 0.8.0
Release: 1%{?dist}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
diff --git a/proxy/proxy-html/spacewalk-proxy-html.spec b/proxy/proxy-html/spacewalk-proxy-html.spec
index 4125b46..65a81b8 100644
--- a/proxy/proxy-html/spacewalk-proxy-html.spec
+++ b/proxy/proxy-html/spacewalk-proxy-html.spec
@@ -6,7 +6,7 @@ Group: Applications/Internet
License: GPLv2
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 0.7.2
+Version: 0.8.0
Release: 1%{?dist}
BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
BuildArch: noarch
diff --git a/proxy/proxy/spacewalk-proxy.spec b/proxy/proxy/spacewalk-proxy.spec
index 32a1b97..9f3daf7 100644
--- a/proxy/proxy/spacewalk-proxy.spec
+++ b/proxy/proxy/spacewalk-proxy.spec
@@ -4,7 +4,7 @@ Group: Applications/Internet
License: GPLv2
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
-Version: 0.7.2
+Version: 0.8.0
Release: 1%{?dist}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: python
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index 749ce86..2c3268f 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -2,7 +2,7 @@ Name: spacewalk-schema
Group: Applications/Internet
Summary: Oracle SQL schema for Spacewalk server
-Version: 0.7.7
+Version: 0.8.0
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
diff --git a/search-server/spacewalk-doc-indexes/spacewalk-doc-indexes.spec b/search-server/spacewalk-doc-indexes/spacewalk-doc-indexes.spec
index ea1668c..dfb848f 100644
--- a/search-server/spacewalk-doc-indexes/spacewalk-doc-indexes.spec
+++ b/search-server/spacewalk-doc-indexes/spacewalk-doc-indexes.spec
@@ -1,5 +1,5 @@
Name: spacewalk-doc-indexes
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
Summary: Lucene indexes of help documentation for spacewalk
diff --git a/search-server/spacewalk-search.spec b/search-server/spacewalk-search.spec
index 832197f..289215e 100644
--- a/search-server/spacewalk-search.spec
+++ b/search-server/spacewalk-search.spec
@@ -4,7 +4,7 @@ Name: spacewalk-search
Summary: Spacewalk Full Text Search Server
Group: Applications/Internet
License: GPLv2
-Version: 0.7.3
+Version: 0.8.0
Release: 1%{?dist}
# This src.rpm is cannonical upstream
# You can obtain it using this set of commands
diff --git a/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring-selinux.spec b/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring-selinux.spec
index 90eeb44..293b6f2 100644
--- a/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring-selinux.spec
+++ b/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring-selinux.spec
@@ -7,7 +7,7 @@
%define modulename spacewalk-monitoring
Name: spacewalk-monitoring-selinux
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
Summary: SELinux policy module supporting Spacewalk monitoring
diff --git a/selinux/spacewalk-proxy-selinux/spacewalk-proxy-selinux.spec b/selinux/spacewalk-proxy-selinux/spacewalk-proxy-selinux.spec
index 535a8dd..21f7fa2 100644
--- a/selinux/spacewalk-proxy-selinux/spacewalk-proxy-selinux.spec
+++ b/selinux/spacewalk-proxy-selinux/spacewalk-proxy-selinux.spec
@@ -7,7 +7,7 @@
%define modulename spacewalk-proxy
Name: spacewalk-proxy-selinux
-Version: 0.7.0
+Version: 0.8.0
Release: 1%{?dist}
Summary: SELinux policy module supporting Spacewalk Proxy
diff --git a/selinux/spacewalk-selinux/spacewalk-selinux.spec b/selinux/spacewalk-selinux/spacewalk-selinux.spec
index f2d6d1b..0fc16cf 100644
--- a/selinux/spacewalk-selinux/spacewalk-selinux.spec
+++ b/selinux/spacewalk-selinux/spacewalk-selinux.spec
@@ -7,7 +7,7 @@
%define modulename spacewalk
Name: spacewalk-selinux
-Version: 0.7.0
+Version: 0.8.0
Release: 1%{?dist}
Summary: SELinux policy module supporting Spacewalk Server
diff --git a/spacewalk/admin/spacewalk-admin.spec b/spacewalk/admin/spacewalk-admin.spec
index c287019..983e3b3 100644
--- a/spacewalk/admin/spacewalk-admin.spec
+++ b/spacewalk/admin/spacewalk-admin.spec
@@ -2,7 +2,7 @@
Summary: Various utility scripts and data files for RHN Satellite installations
Name: spacewalk-admin
URL: https://fedorahosted.org/spacewalk
-Version: 0.7.0
+Version: 0.8.0
Release: 1%{?dist}
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
License: GPLv2
diff --git a/spacewalk/certs-tools/spacewalk-certs-tools.spec b/spacewalk/certs-tools/spacewalk-certs-tools.spec
index 16c8396..594e9a7 100644
--- a/spacewalk/certs-tools/spacewalk-certs-tools.spec
+++ b/spacewalk/certs-tools/spacewalk-certs-tools.spec
@@ -2,7 +2,7 @@ Name: spacewalk-certs-tools
Summary: Spacewalk SSL Key/Cert Tool
Group: Applications/Internet
License: GPLv2 and Python
-Version: 0.7.2
+Version: 0.8.0
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
diff --git a/spacewalk/config/spacewalk-config.spec b/spacewalk/config/spacewalk-config.spec
index ed2eda7..3077a1c 100644
--- a/spacewalk/config/spacewalk-config.spec
+++ b/spacewalk/config/spacewalk-config.spec
@@ -2,7 +2,7 @@
Name: spacewalk-config
Summary: Spacewalk Configuration
-Version: 0.7.2
+Version: 0.8.0
Release: 1%{?dist}
URL: http://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
diff --git a/spacewalk/package/spacewalk.spec b/spacewalk/package/spacewalk.spec
index 0294138..d04fd2d 100644
--- a/spacewalk/package/spacewalk.spec
+++ b/spacewalk/package/spacewalk.spec
@@ -1,7 +1,7 @@
%define release_name Gemini
Name: spacewalk
-Version: 0.7.4
+Version: 0.8.0
Release: 1%{?dist}
Summary: Spacewalk Systems Management Application
URL: https://fedorahosted.org/spacewalk
diff --git a/spacewalk/setup/spacewalk-setup.spec b/spacewalk/setup/spacewalk-setup.spec
index 0b8da2b..3e898e1 100644
--- a/spacewalk/setup/spacewalk-setup.spec
+++ b/spacewalk/setup/spacewalk-setup.spec
@@ -1,5 +1,5 @@
Name: spacewalk-setup
-Version: 0.7.7
+Version: 0.8.0
Release: 1%{?dist}
Summary: Initial setup tools for Red Hat Spacewalk
diff --git a/utils/spacewalk-utils.spec b/utils/spacewalk-utils.spec
index f498c27..424992e 100644
--- a/utils/spacewalk-utils.spec
+++ b/utils/spacewalk-utils.spec
@@ -1,7 +1,7 @@
%define rhnroot %{_prefix}/share/rhn
Name: spacewalk-utils
-Version: 0.7.1
+Version: 0.8.0
Release: 1%{?dist}
Summary: Utilities that may be run against a Spacewalk server.
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 6ee6ac4..89becbf 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -2,7 +2,7 @@ Name: spacewalk-web
Summary: Spacewalk Web site packages
Group: Applications/Internet
License: GPLv2
-Version: 0.7.8
+Version: 0.8.0
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
commit 5a787bbfcdca363df858fbcfe10762e59fb4a175
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Dec 3 10:47:45 2009 +0100
add contributed script apply_errata
This script works against RHN Hosted (the client probably needs a
provisioning entitlement though, haven't checked) and
Satellite/Spacewalk.
The point of the script is to make it easy to apply only particular
errata (i.e. just security errata) but only up to a specific date.
This is useful for people who have to draw a line in the sand
regarding the errata they are allowed to install.
diff --git a/utils/Makefile b/utils/Makefile
index 834eee7..00d54e7 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -7,7 +7,7 @@ NAME := spacewalk-utils
SUBDIR = utils
FILES = __init__ systemSnapshot migrateSystemProfile rhnLockfile rhn_fcntl
-SCRIPTS = sw-system-snapshot migrate-system-profile spacewalk-api
+SCRIPTS = sw-system-snapshot migrate-system-profile spacewalk-api apply_errata
DOCBOOK = $(wildcard /usr/bin/docbook2man)
diff --git a/utils/apply_errata b/utils/apply_errata
new file mode 100755
index 0000000..f741141
--- /dev/null
+++ b/utils/apply_errata
@@ -0,0 +1,287 @@
+#!/usr/bin/python
+
+"""
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ Copyright 2009 Colin Coe <colin.coe(a)gmail.com>
+
+ Portions of code reused from the Satellite/Spacewalk documentation and
+ 'Mastering Regular Expressions (2nd Edition)' and various sources on
+ the Internet
+
+"""
+
+import getopt, sys, time, os, re
+import xmlrpclib, httplib
+from time import localtime
+from sys import argv
+import getpass
+
+prog = sys.argv[0]
+today = "%d-%d-%d" % (localtime()[2], localtime()[1], localtime()[0])
+erratum = []
+opt = dict()
+opt['test'] = True
+opt['user'] = ""
+opt['passwd'] = ""
+opt['sat_host'] = ""
+opt['date'] = time.localtime(time.time())
+opt['proxy'] = ""
+
+def usage(code):
+ offset = time.time() - (45 * 86400)
+ today = "%d-%d-%d" % (localtime(offset)[2], localtime(offset)[1], localtime(offset)[0])
+ if code is not None:
+ try:
+ code = int(code)
+ except:
+ code = 0
+ else:
+ code = 0
+ print "-a - all errata - implies -b -e -s"
+ print "-b - bug fix errata"
+ print "-d <date> - date (in m-d-yy format) - defaults to today's date"
+ print "-e - enhancement errata"
+ print "-s - security errata"
+ print "-r - do it for real - required to make the script actually do"
+ print " updates"
+ print "-v - be verbose, implied if -r is not supplied"
+ print "-n - call /usr/sbin/rhn_check rather than waiting for the next"
+ print " scheduled checkin"
+ print "-u <username> - username for connecting to RHN hosted or the Satellite server"
+ print "-p <password> - password for connecting to RHN hosted or the Satellite server"
+ print "-P <proxy> - the proxy server to use"
+ print "-z <search> - only apply errata matching this regular expression"
+ print "-h - this help message"
+ print "Notes:"
+ print "1) Errata are scheduled only if they have a date of <date> or older"
+ print "2) -u and -p can be ommitted if the environment variables RHN_USER and RHN_PASS"
+ print " are defined. If -u/-p are provided and RHN_USER and RHN_PASS are also"
+ print " defined, the -u/-p switches have preference."
+ print " If the password is '-' then the user is asked to enter the password via stdin"
+ print "3) the search is case insensitive and looks in the errata synopsis. An"
+ print " example use is:"
+ print " '%s -u admin -p - -P squid:3128 -s -d %s -z \"critical|important\"'" % (prog, today)
+ print "-P <proxy> is needed to define the proxy server (and port) to use and overrides"
+ print " the environment variable RHN_PROXY"
+ sys.exit(code)
+
+
+def testEnvVar(ev):
+ try:
+ var = os.environ[ev]
+ except:
+ return False
+ return True
+
+
+def getSysId():
+ infile = open("/etc/sysconfig/rhn/systemid","r")
+ text = infile.read()
+ pattern = re.compile("[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]")
+ result = pattern.search(text)
+ infile.close()
+ if result is None:
+ print "No system ID found, please register the node with RHN or your local Satellite/"
+ print "Spacewalk server using rhn_register or another appropriate tool"
+ sys.exit(3)
+ return int(result.group(0))
+
+
+def getServer():
+ infile = open("/etc/sysconfig/rhn/up2date","r")
+ text = infile.read()
+ pattern = re.compile("(serverURL=).*")
+ result = pattern.search(text)
+ infile.close()
+ if result is None:
+ print "No server details found. This should not happen as RHN hosted is"
+ print "present by default. Resolve and re-run."
+ sys.exit(3)
+ return result.group(0).split("/")[2]
+
+
+class ProxiedTransport(xmlrpclib.Transport):
+ def set_proxy(self, proxy):
+ self.proxy = opt['proxy']
+ def make_connection(self, host):
+ self.realhost = host
+ h = httplib.HTTP(self.proxy)
+ return h
+ def send_request(self, connection, handler, request_body):
+ connection.putrequest("POST", 'http://%s%s' % (self.realhost, handler))
+ def send_host(self, connection, host):
+ connection.putheader('Host', self.realhost)
+
+
+def main():
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "abd:esrvhu:p:P:z:n")
+ except getopt.GetoptError:
+ # print help information and exit:
+ usage(2)
+
+ type = dict()
+ EI = dict()
+ EN = dict()
+ ED = dict()
+
+ type['b'] = False
+ type['e'] = False
+ type['s'] = False
+
+ if len(argv) == 1:
+ usage(1)
+
+ if testEnvVar('RHN_USER'):
+ opt['user'] = os.environ['RHN_USER']
+
+ if testEnvVar('RHN_PASS'):
+ opt['passwd'] = os.environ['RHN_PASS']
+
+ if testEnvVar('RHN_PROXY'):
+ opt['proxy'] = os.environ['RHN_PROXY']
+
+ opt['verbose'] = False
+ for o, a in opts:
+ if o == "-v":
+ opt['verbose'] = True
+ if o in ("-h"):
+ usage(0)
+ if o in ("-p"):
+ if opt['passwd'] == "":
+ opt['passwd'] = a
+ if o in ("-u"):
+ if opt['user'] == "":
+ opt['user'] = a
+ if o in ("-P"):
+ if opt['proxy'] == "":
+ opt['proxy'] = a
+ if o in ("-d"):
+ opt['date'] = a
+ if o in ("-b") or o in ("-a"):
+ type['b'] = True
+ if o in ("-e") or o in ("-a"):
+ type['e'] = True
+ if o in ("-s") or o in ("-a"):
+ type['s'] = True
+ if o in ("-r"):
+ opt['test'] = False
+ if o in ("-z"):
+ opt['search'] = a
+
+ if opt['passwd'] == '-':
+ opt['passwd'] = getpass.getpass()
+
+ try:
+ if opt['search'] == "":
+ opt['search'] = ".*"
+ except:
+ opt['search'] = ".*"
+
+ if not type['b'] and not type['e'] and not type['s']:
+ # Nothing selected, assuming all
+ type['b'] = True
+ type['e'] = True
+ type['s'] = True
+
+ if opt['test'] == True:
+ opt['verbose'] = True
+
+ if opt['user'] == "":
+ print "-u <username> not supplied and environment variable RHN_USER not set"
+ sys.exit(4)
+
+ if opt['passwd'] == "":
+ print "-p <password> not supplied and environment variable RHN_PASS not set"
+ sys.exit(5)
+
+ if opt['sat_host'] == "":
+ opt['sat_host'] = getServer()
+ sid = getSysId()
+
+ SATELLITE_URL = "http://%s/rpc/api" % opt['sat_host']
+
+ # If no proxy is defined, assume no proxy needed
+ if opt['proxy'] != "":
+ p = ProxiedTransport()
+ p.set_proxy(opt['proxy']);
+ client = xmlrpclib.Server(SATELLITE_URL, verbose=0, transport=p)
+ else:
+ client = xmlrpclib.Server(SATELLITE_URL, verbose=0)
+ session = client.auth.login(opt['user'], opt['passwd'])
+
+ ue = client.system.getUnscheduledErrata(session, sid)
+
+ for e in ue:
+ year = int(e['date'].split("/")[2]) + 2000
+ month = int(e['date'].split("/")[0])
+ day = int(e['date'].split("/")[1])
+ e_epoch = int(time.mktime(time.strptime('%d-%d-%d 00:00:00' % (year, month, day), '%Y-%m-%d %H:%M:%S')))
+
+ try:
+ year = int(opt['date'].split('-')[2])
+ month = int(opt['date'].split('-')[0])
+ day = int(opt['date'].split('-')[1])
+ except:
+ year = int(opt['date'][0])
+ month = int(opt['date'][1])
+ day = int(opt['date'][2])
+
+ d_epoch = int(time.mktime(time.strptime('%d-%d-%d 00:00:00' % (year, month, day), '%Y-%m-%d %H:%M:%S')))
+ ED[e['id']] = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.localtime(e_epoch))
+
+ if e_epoch < d_epoch:
+ EI[e['id']] = e['advisory_synopsis']
+ EN[e['id']] = e['advisory_name']
+
+ pattern = re.compile(opt['search'], re.I)
+ result = pattern.search(e['advisory_synopsis'])
+
+ if result is not None:
+ if type['b'] and e['advisory_name'].find("RHBA") == 0:
+ erratum.append(e['id'])
+
+ if type['e'] and e['advisory_name'].find("RHEA") == 0:
+ erratum.append(e['id'])
+
+ if type['s'] and e['advisory_name'].find("RHSA") == 0:
+ erratum.append(e['id'])
+
+ if opt['verbose']:
+ print "Notes:"
+ print "\tUsing: %s" % opt['sat_host']
+ if opt['test']:
+ print "\tRunning in test mode, updates will not be scheduled"
+ else:
+ print "\tUpdates *will* be scheduled"
+ if type['b']:
+ print "\tBug fix errata selected"
+ if type['e']:
+ print "\tEnhancement errata selected"
+ if type['s']:
+ print "\tSecurity errata selected"
+ print "\t%d errata selected" % len(erratum)
+ print ""
+
+ if opt['verbose']:
+ for errata in erratum:
+ print "(Errata ID: %04d, Errata Name: %s, Released: %s) %s" % (errata, EN[errata], ED[errata], EI[errata])
+
+ if not opt['test']:
+ client.system.applyErrata(session, sid, erratum)
+
+ client.auth.logout(session)
+
+
+if __name__ == "__main__":
+ main()
+
14 years, 4 months
146 commits - backend/common backend/po backend/satellite_exporter backend/satellite_tools backend/server backend/upload_server client/rhel client/tools java/code java/spacewalk-java.spec proxy/proxy schema/spacewalk web/html web/modules
by Michael Mraka
backend/common/rhnException.py | 3
backend/common/rhnLib.py | 43
backend/po/server.pot | 2
backend/satellite_exporter/exporter/dumper.py | 20
backend/satellite_tools/disk_dumper/dumper.py | 18
backend/satellite_tools/disk_dumper/iss.py | 22
backend/satellite_tools/exporter/exportLib.py | 54 -
backend/satellite_tools/reposync.py | 61 -
backend/satellite_tools/satsync.py | 13
backend/satellite_tools/updatePackages.py | 12
backend/server/action/configfiles.py | 4
backend/server/action_extra_data/packages.py | 2
backend/server/basePackageUpload.py | 9
backend/server/configFilesHandler.py | 19
backend/server/handlers/app/packages.py | 30
backend/server/handlers/config/rhn_config_management.py | 4
backend/server/handlers/config_mgmt/rhn_config_management.py | 8
backend/server/handlers/xp/rhnlint.py | 7
backend/server/importlib/backend.py | 32
backend/server/importlib/backendOracle.py | 19
backend/server/importlib/errataImport.py | 22
backend/server/importlib/headerSource.py | 27
backend/server/importlib/importLib.py | 30
backend/server/importlib/mpmSource.py | 10
backend/server/importlib/packageImport.py | 32
backend/server/importlib/packageUpload.py | 3
backend/server/importlib/test/test_solaris.py | 8
backend/server/repomd/domain.py | 3
backend/server/repomd/mapper.py | 23
backend/server/repomd/repository.py | 13
backend/server/repomd/view.py | 28
backend/server/rhnKickstart.py | 11
backend/server/rhnLib.py | 23
backend/server/rhnPackage.py | 12
backend/server/rhnPackageUpload.py | 63 -
backend/server/rhnServer/server_packages.py | 13
backend/upload_server/handlers/package_push/package_push.py | 24
backend/upload_server/handlers/package_upload/package_upload.py | 5
client/rhel/rhnlib/rhn/common/rhn_rpm.py | 34
client/tools/rhnpush/uploadLib.py | 74 +
java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml | 23
java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml | 7
java/code/src/com/redhat/rhn/common/db/datasource/xml/General_queries.xml | 14
java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml | 7
java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml | 9
java/code/src/com/redhat/rhn/common/db/datasource/xml/checksum_queries.xml | 10
java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml | 32
java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml | 1
java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml | 26
java/code/src/com/redhat/rhn/domain/common/Checksum.java | 99 +
java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java | 165 +++
java/code/src/com/redhat/rhn/domain/common/ChecksumType.hbm.xml | 2
java/code/src/com/redhat/rhn/domain/common/ChecksumType.java | 9
java/code/src/com/redhat/rhn/domain/common/ChecksumTypeException.java | 54 +
java/code/src/com/redhat/rhn/domain/config/ConfigContent.hbm.xml | 3
java/code/src/com/redhat/rhn/domain/config/ConfigContent.java | 17
java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java | 5
java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java | 2
java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrataFile.hbm.xml | 3
java/code/src/com/redhat/rhn/domain/errata/impl/UnpublishedErrataFile.hbm.xml | 3
java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java | 15
java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml | 7
java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.java | 29
java/code/src/com/redhat/rhn/domain/rhnpackage/Package_satellite.hbm.xml | 5
java/code/src/com/redhat/rhn/domain/rhnpackage/test/PackageTest.java | 8
java/code/src/com/redhat/rhn/frontend/dto/ErrataPackageFile.java | 34
java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java | 31
java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java | 2
java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackageHelper.java | 7
java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackagesHandler.java | 12
java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/test/PackageHelperTest.java | 3
java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java | 2
java/code/src/com/redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java | 2
java/code/src/com/redhat/rhn/taskomatic/task/repomd/RepomdWriter.java | 2
java/code/src/com/redhat/rhn/taskomatic/task/repomd/UpdateInfoWriter.java | 2
java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java | 5
java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/add_details.jspf | 2
java/code/webapp/WEB-INF/pages/errata/erratapackages.jsp | 2
java/code/webapp/WEB-INF/pages/rhnpackage/packagedetail.jsp | 2
java/spacewalk-java.spec | 7
proxy/proxy/pm/uploadLib.py | 511 ----------
proxy/proxy/spacewalk-proxy.spec | 1
schema/spacewalk/common/data/rhnChecksumType.sql | 14
schema/spacewalk/common/tables/rhnAppInstallSession.sql | 4
schema/spacewalk/common/tables/rhnChecksum.sql | 33
schema/spacewalk/common/tables/rhnChecksumType.sql | 6
schema/spacewalk/common/tables/rhnConfigContent.sql | 8
schema/spacewalk/common/tables/rhnErrataFile.sql | 4
schema/spacewalk/common/tables/rhnErrataFileTmp.sql | 4
schema/spacewalk/common/tables/rhnFile.sql | 4
schema/spacewalk/common/tables/rhnKSTreeFile.sql | 4
schema/spacewalk/common/tables/rhnPackage.sql | 8
schema/spacewalk/common/tables/rhnPackageFile.sql | 4
schema/spacewalk/common/tables/rhnPackageSource.sql | 8
schema/spacewalk/common/tables/rhnServerActionVerifyResult.sql | 6
schema/spacewalk/common/tables/tables.deps | 25
schema/spacewalk/common/views/rhnChecksumView.sql | 24
schema/spacewalk/common/views/views.deps | 1
schema/spacewalk/oracle/procs/lookup_checksum.sql | 49
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/004-rhnChecksumType-table.sql | 37
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql | 33
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql | 14
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/007-rhnChecksumView.sql | 24
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/008-lookup_checksum.sql | 49
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-1-rhnFile-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-2-rhnFile-data.sql | 10
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-3-rhnFile-md5.sql | 2
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-4-rhnFile-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-1-rhnPackage-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-2-rhnPackage-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-3-rhnPackage-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-4-rhnPackage-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-1-rhnPackageFile-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-2-rhnPackageFile-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-3-rhnPackageFile-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-1-rhnErrataFile-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-2-rhnErrataFile-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-3-rhnErrataFile-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-4-rhnErrataFile-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-1-rhnErrataFileTmp-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-2-rhnErrataFileTmp-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-3-rhnErrataFileTmp-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-4-rhnErrataFileTmp-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-1-rhnKSTreeFile-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-2-rhnKSTreeFile-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-3-rhnKSTreeFile-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-4-rhnKSTreeFile-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-1-rhnConfigContent-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-2-rhnConfigContent-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-3-rhnConfigContent-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-4-rhnConfigContent-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-1-rhnPackageSource-checksum.sql | 6
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-2-rhnPackageSource-data.sql | 21
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-3-rhnPackageSource-md5.sql | 2
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-4-rhnPackageSource-checksum.sql | 2
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-1-rhnAppInstallSession-checksum.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-2-rhnAppInstallSession-data.sql | 11
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-3-rhnAppInstallSession-md5.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-4-rhnAppInstallSession-checksum.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/019-1-rhnServerActionVerifyResult-checksum.sql | 7
web/html/network/software/packages/file_list.pxt | 2
web/html/network/systems/details/history/snapshots/config.pxt | 2
web/modules/rhn/RHN/DB/Channel.pm | 6
web/modules/rhn/RHN/DB/ConfigRevision.pm | 10
web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml | 7
web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml | 4
web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml | 36
web/modules/rhn/RHN/DB/Errata.pm | 39
web/modules/rhn/RHN/DB/ErrataEditor.pm | 4
web/modules/rhn/RHN/DB/KSTree.pm | 6
web/modules/rhn/RHN/DB/Package.pm | 14
web/modules/sniglets/Sniglets/ListView/FileList.pm | 8
web/modules/sniglets/Sniglets/Packages.pm | 3
153 files changed, 1642 insertions(+), 1049 deletions(-)
New commits:
commit c5a50bd3f792553271e1f514c68b2c8b7b50ba81
Merge: e7a1d61... 067eced...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 16:11:32 2009 +0100
Merge branch sha256 to master
SHA256 is mostly done, merging to master
commit 067ecedbb7de27514d07c625e8cacd34967541e3
Merge: e7a1d61... 8cba619...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Dec 4 13:52:11 2009 +0100
Merge branch 'master' into sha256-support3
Conflicts:
backend/server/basePackageUpload.py
client/tools/rhnpush/uploadLib.py
diff --cc client/rhel/rhnlib/rhn/common/rhn_rpm.py
index 0000000,66a46e1..349388a
mode 000000,100644..100644
--- a/client/rhel/rhnlib/rhn/common/rhn_rpm.py
+++ b/client/rhel/rhnlib/rhn/common/rhn_rpm.py
@@@ -1,0 -1,428 +1,462 @@@
+ #
+ # Copyright (c) 2008 Red Hat, Inc.
+ #
+ # This software is licensed to you under the GNU General Public License,
+ # version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ # implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ # along with this software; if not, see
+ # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ #
+ # Red Hat trademarks are not licensed under GPLv2. No permission is
+ # granted to use or replicate Red Hat trademarks that are incorporated
+ # in this software or its documentation.
+ #
+
+ import os
+ import sys
+ import rpm
+ import struct
+
+ import exceptions
+ if not hasattr(exceptions, 'StopIteration'):
+ # Presumably python 1.5.2
+ class StopIteration(Exception):
+ pass
+
+ # Expose a bunch of useful constants from rpm
+ error = rpm.error
+ for sym, val in rpm.__dict__.items():
+ if sym[:3] == 'RPM':
+ # A constant, probably - import it into our namespace
+ globals()[sym] = val
+ del sym, val
+
++# need this for rpm-pyhon < 4.6 (e.g. on RHEL5)
++rpm.RPMTAG_FILEDIGESTALGO = 5011
++
++# these values are taken from /usr/include/rpm/rpmpgp.h
++# PGPHASHALGO_MD5 = 1, /*!< MD5 */
++# PGPHASHALGO_SHA1 = 2, /*!< SHA1 */
++# PGPHASHALGO_RIPEMD160 = 3, /*!< RIPEMD160 */
++# PGPHASHALGO_MD2 = 5, /*!< MD2 */
++# PGPHASHALGO_TIGER192 = 6, /*!< TIGER192 */
++# PGPHASHALGO_HAVAL_5_160 = 7, /*!< HAVAL-5-160 */
++# PGPHASHALGO_SHA256 = 8, /*!< SHA256 */
++# PGPHASHALGO_SHA384 = 9, /*!< SHA384 */
++# PGPHASHALGO_SHA512 = 10, /*!< SHA512 */
++PGPHASHALGO = {
++ 1: 'md5',
++ 2: 'sha1',
++ 3: 'ripemd160',
++ 5: 'md2',
++ 6: 'tiger192',
++ 7: 'haval-5-160',
++ 8: 'sha256',
++ 9: 'sha384',
++ 10: 'sha512',
++}
++
++
+ class InvalidPackageError(Exception):
+ pass
+
+ # wrapper/proxy class for rpm.Transaction so we can
+ # instrument it, etc easily
+ class RPMTransaction:
+ read_only = 0
+ def __init__(self):
+ if hasattr(rpm, 'opendb'):
+ db = getattr(rpm, 'opendb')(not self.read_only)
+ self.ts = rpm.TransactionSet('/', db)
+ else:
+ self.ts = rpm.TransactionSet()
+ self.tsflags = []
+ # For rpm 4.0.4
+ self._flags = 0
+ self._prob_filter = 0
+
+ def __getattr__(self, attr):
+ return getattr(self.ts, attr)
+
+ def getMethod(self, method):
+ # in theory, we can override this with
+ # profile/etc info
+ return getattr(self.ts, method)
+
+ # push/pop methods so we don't lose the previous
+ # set value, and we can potentially debug a bit
+ # easier
+ def pushVSFlags(self, flags):
+ self.tsflags.append(flags)
+ if hasattr(self.ts, 'setVSFlags'):
+ f = getattr(self.ts, 'setVSFlags')
+ f(self.tsflags[-1])
+
+ def popVSFlags(self):
+ del self.tsflags[-1]
+ if hasattr(self.ts, 'setVSFlags'):
+ f = getattr(self.ts, 'setVSFlags')
+ f(self.tsflags[-1])
+
+ def addInstall(self, arg1, arg2, mode):
+ """Install a package"""
+ hdr = arg1.hdr
+ if hasattr(self.ts, 'addInstall'):
+ f = getattr(self.ts, 'addInstall')
+ return f(hdr, arg2, mode)
+ return self.ts.add(hdr, arg2, mode)
+
+ def addErase(self, arg1):
+ """Erase a package"""
+ hdr = arg1.hdr
+ if hasattr(self.ts, 'addErase'):
+ f = getattr(self.ts, 'addErase')
+ return f(hdr)
+ return self.ts.add(hdr, hdr, "e")
+
+ def check(self):
+ """Check dependencies"""
+ if hasattr(self.ts, 'check'):
+ f = getattr(self.ts, 'check')
+ else:
+ f = getattr(self.ts, 'depcheck')
+ return f()
+
+ def setFlags(self, flag):
+ """Set transaction flags"""
+ if hasattr(rpm, 'headerFromPackage'):
+ # Old style rpm
+ old_flags = self._flags
+ self._flags = flag
+ return old_flags
+ return self.ts.setFlags(flag)
+
+ def setProbFilter(self, flag):
+ """Set problem flags"""
+ if hasattr(rpm, 'headerFromPackage'):
+ # Old style rpm
+ old_flags = self._prob_filter
+ self._prob_filter = flag
+ return old_flags
+ return self.ts.setProbFilter(flag)
+
+ def run(self, callback, user_data):
+ if hasattr(rpm, 'headerFromPackage'):
+ # Old style rpm
+ return self.ts.run(self._flags, self._prob_filter, callback,
+ user_data)
+ return self.ts.run(callback, user_data)
+
+
+
+
+ class SharedStateTransaction:
+ _shared_state = {}
+
+ def __init__(self):
+ self.__dict__ = self._shared_state
+
+ class RPMReadOnlyTransaction(SharedStateTransaction, RPMTransaction):
+ read_only = 1
+ def __init__(self):
+ SharedStateTransaction.__init__(self)
+ if not hasattr(self, 'ts'):
+ RPMTransaction.__init__(self)
+ # FIXME: replace with macro defination
+ self.pushVSFlags(8)
+
+ class RPM_Header:
+ "Wrapper class for an rpm header - we need to store a flag is_source"
+ def __init__(self, hdr, is_source=None):
+ self.hdr = hdr
+ self.is_source = is_source
+ self.packaging = 'rpm'
+ self.signatures = []
+ self._extract_signatures()
+
+ def __getitem__(self, name):
+ return self.hdr[name]
+
+ def __getattr__(self, name):
+ return getattr(self.hdr, name)
+
++ def checksum_type(self):
++ if self.hdr[rpm.RPMTAG_FILEDIGESTALGO] \
++ and PGPHASHALGO.has_key(self.hdr[rpm.RPMTAG_FILEDIGESTALGO]):
++ checksum_type = PGPHASHALGO[self.hdr[rpm.RPMTAG_FILEDIGESTALGO]]
++ else:
++ checksum_type = 'md5'
++ return checksum_type
++
+ def is_signed(self):
+ if hasattr(rpm, "RPMTAG_DSAHEADER"):
+ dsaheader = self.hdr["dsaheader"]
+ else:
+ dsaheader = 0
+ if self.hdr["siggpg"] or self.hdr["sigpgp"] or dsaheader:
+ return 1
+ return 0
+
+ def _extract_signatures(self):
+ header_tags = [
+ [rpm.RPMTAG_DSAHEADER, "dsa"],
+ [rpm.RPMTAG_RSAHEADER, "rsa"],
+ [rpm.RPMTAG_SIGGPG, "gpg"],
+ [rpm.RPMTAG_SIGPGP, 'pgp'],
+ ]
+ for ht, sig_type in header_tags:
+ ret = self.hdr[ht]
+ if not ret or len(ret) < 17:
+ continue
+ # Get the key id - hopefully we get it right
+ key_id = ret[9:17]
+ key_id_len = len(key_id)
+ format = "%dB" % key_id_len
+ t = struct.unpack(format, key_id)
+ format = "%02x" * key_id_len
+ key_id = format % t
+ self.signatures.append({
+ 'signature_type' : sig_type,
+ 'key_id' : key_id,
+ 'signature' : ret,
+ })
+
+ def get_header_byte_range(package_file):
+ """
+ Return the start and end bytes of the rpm header object.
+
+ For details of the rpm file format, see:
+ http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html
+ """
+
+ lead_size = 96
+
+ # Move past the rpm lead
+ package_file.seek(lead_size)
+
+ sig_size = get_header_struct_size(package_file)
+
+ # Now we can find the start of the actual header.
+ header_start = lead_size + sig_size
+
+ package_file.seek(header_start)
+
+ header_size = get_header_struct_size(package_file)
+
+ header_end = header_start + header_size
+
+ return (header_start, header_end)
+
+ def get_header_struct_size(package_file):
+ """
+ Compute the size in bytes of the rpm header struct starting at the current
+ position in package_file.
+ """
+ # Move past the header preamble
+ package_file.seek(8, 1)
+
+ # Read the number of index entries
+ header_index = package_file.read(4)
+ (header_index_value, ) = struct.unpack('>I', header_index)
+
+ # Read the the size of the header data store
+ header_store = package_file.read(4)
+ (header_store_value, ) = struct.unpack('>I', header_store)
+
+ # The total size of the header. Each index entry is 16 bytes long.
+ header_size = 8 + 4 + 4 + header_index_value * 16 + header_store_value
+
+ # Headers end on an 8-byte boundary. Round out the extra data.
+ round_out = header_size % 8
+ if round_out != 0:
+ header_size = header_size + (8 - round_out)
+
+ return header_size
+
+ # Loads the package header from a file / stream / file descriptor
+ # Raises rpm.error if an error is found, or InvalidPacageError if package is
+ # busted
+ # XXX Deal with exceptions better
+ def get_package_header(filename=None, file=None, fd=None):
+ if (filename is None and file is None and fd is None):
+ raise ValueError, "No parameters passed"
+
+ if filename is not None:
+ f = open(filename)
+ elif file is not None:
+ f = file
+ f.seek(0, 0)
+ else: # fd is not None
+ f = None
+
+ if f is None:
+ os.lseek(fd, 0, 0)
+ file_desc = fd
+ else:
+ file_desc = f.fileno()
+
+ if hasattr(rpm, 'headerFromPackage'):
+ hdr, is_source = rpm.headerFromPackage(file_desc)
+ if hdr is None:
+ raise InvalidPackageError
+ else:
+ if hasattr(rpm, 'readHeaderFromFD'):
+ header_start, header_end = \
+ get_header_byte_range(os.fdopen(os.dup(file_desc)))
+ os.lseek(file_desc, header_start, 0)
+ hdr, offset = rpm.readHeaderFromFD(file_desc)
+ else:
+ # RHEL-4 and older, do the old way
+ ts = RPMReadOnlyTransaction()
+ nomd5 = getattr(rpm, 'RPMVSF_NOMD5')
+ needpayload = getattr(rpm, 'RPMVSF_NEEDPAYLOAD')
+ ts.pushVSFlags(~(nomd5 | needpayload))
+ hdr = RPMReadOnlyTransaction().hdrFromFdno(file_desc)
+ ts.popVSFlags()
+ if hdr is None:
+ raise InvalidPackageError
+ is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
+
+ return RPM_Header(hdr, is_source)
+
+ class MatchIterator:
+ def __init__(self, tag_name=None, value=None):
+ # Query by name, by default
+ if not tag_name:
+ tag_name = "name"
+
+ if hasattr(rpm, "headerFromPackage"):
+ # rpm 4.0.4 or earlier
+ self.db = rpm.opendb()
+ method = self.db.match
+ else:
+ # rpm 4.1 or later
+ self.ts = rpm.TransactionSet()
+ self.ts.setVSFlags(8)
+ method = self.ts.dbMatch
+
+ if value:
+ self.mi = method(tag_name, value)
+ else:
+ self.mi = method(tag_name)
+
+ def pattern(self, tag_name, mode, pattern):
+ self.mi.pattern(tag_name, mode, pattern)
+
+ def next(self):
+ try:
+ hdr = self.mi.next()
+ except StopIteration:
+ hdr = None
+
+ if hdr is None:
+ return None
+ if hasattr(rpm, "headerFromPackage"):
+ is_source = not hdr[rpm.RPMTAG_SOURCERPM]
+ else:
+ is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
+ return RPM_Header(hdr, is_source)
+
+
+ def headerLoad(data):
+ hdr = rpm.headerLoad(data)
+ if hasattr(rpm, "headerFromPackage"):
+ is_source = not hdr[rpm.RPMTAG_SOURCERPM]
+ else:
+ is_source = hdr[getattr(rpm, 'RPMTAG_SOURCEPACKAGE')]
+ return RPM_Header(hdr, is_source)
+
+ def labelCompare(t1, t2):
+ return rpm.labelCompare(t1, t2)
+
+ def nvre_compare(t1, t2):
+ def build_evr(p):
+ evr = [p[3], p[1], p[2]]
+ evr = map(str, evr)
+ if evr[0] == "":
+ evr[0] = None
+ return evr
+ if t1[0] != t2[0]:
+ raise ValueError("You should only compare packages with the same name")
+ evr1, evr2 = (build_evr(t1), build_evr(t2))
+ return rpm.labelCompare(evr1, evr2)
+
+
+ def hdrLabelCompare(hdr1, hdr2):
+ """ take two RPMs or headers and compare them for order """
+
+ if hdr1['name'] == hdr2['name']:
+ hdr1 = [hdr1['epoch'] or None, hdr1['version'], hdr1['release']]
+ hdr2 = [hdr2['epoch'] or None, hdr2['version'], hdr2['release']]
+ if hdr1[0]:
+ hdr1[0] = str(hdr1[0])
+ if hdr2[0]:
+ hdr2[0] = str(hdr2[0])
+ return rpm.labelCompare(hdr1, hdr2)
+ elif hdr1['name'] < hdr2['name']:
+ return -1
+ return 1
+
+
+ def rpmLabelCompare(rpmFilename1, rpmFilename2):
+ """ take two RPMs and compare them for order """
+ return hdrLabelCompare(get_package_header(rpmFilename1),
+ get_package_header(rpmFilename2))
+
+
+ def sortHeaders(hdrs):
+ """ Sorts a list of RPM headers (or RPMs).
+ Assertion: they *must* exist.
+ """
+
+ assert isinstance(hdrs, type([]))
+
+ sorted = hdrs[:]
+ sorted.sort(hdrLabelCompare)
+ return sorted
+
+
+ def sortRPMs(rpms):
+ """ Sorts a list of RPM files. They *must* exist. """
+
+ assert isinstance(rpms, type([]))
+
+ # We don't want to use rpmLabelCompare as a sorting mechanism, it would
+ # extract the rpm header for each comparison.
+ # Build a list of (header, rpm)
+ helper = map(lambda x: (get_package_header(x), x), rpms)
+
+ # Sort the list using the headers as a comparison
+ helper.sort(lambda x, y: hdrLabelCompare(x[0], y[0]))
+
+ # Extract the rpm names now
+ return map(lambda x: x[1], helper)
+
+
+ def getInstalledHeader(rpmName):
+ """ quieries the RPM DB for a header matching rpmName. """
+
+ mi = MatchIterator("name")
+ mi.pattern("name", rpm.RPMMIRE_STRCMP, rpmName)
+ return mi.next()
+
+
+ if __name__ == '__main__':
+ mi = MatchIterator("name")
+ mi.pattern("name", rpm.RPMMIRE_GLOB, "*ker*")
+ while 1:
+ h = mi.next()
+ if not h:
+ break
+ print h['name']
+ sys.exit(1)
+ hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.i386.rpm")
+ print dir(hdr)
+ # Sources
+ hdr = get_package_header(filename="/tmp/python-1.5.2-42.72.src.rpm")
+ hdr2 = headerLoad(hdr.unload())
+ print hdr2
+ print len(hdr2.keys())
+
+
diff --cc client/tools/rhnpush/uploadLib.py
index fbcf63b,ffdcc63..52b3215
--- a/client/tools/rhnpush/uploadLib.py
+++ b/client/tools/rhnpush/uploadLib.py
@@@ -21,7 -20,7 +20,8 @@@ import strin
import fnmatch
import getpass
import rhnpush_cache
+import struct
+ from rhn.common import rhn_mpm
try:
import hashlib
commit e7a1d61929d563ce50392760a925387aa511e5c3
Merge: 7279c22... 49e5770...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 3 11:04:19 2009 +0100
Merge branch 'master' into sha256-support3
commit 7279c22dec3bbaf38a8ded0dd3e200ca7eeca5a0
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Nov 20 12:06:36 2009 +0100
fixed lookup_checksum not to ignore checksum type
added lookup_checksum to upgrades
diff --git a/schema/spacewalk/oracle/procs/lookup_checksum.sql b/schema/spacewalk/oracle/procs/lookup_checksum.sql
index d025b38..5baba4b 100644
--- a/schema/spacewalk/oracle/procs/lookup_checksum.sql
+++ b/schema/spacewalk/oracle/procs/lookup_checksum.sql
@@ -29,10 +29,9 @@ BEGIN
SELECT c.id
INTO checksum_id
- FROM rhnChecksum c,
- rhnChecksumType t
+ FROM rhnChecksumView c
WHERE c.checksum = checksum_in
- AND c.checksum_type_id = t.id;
+ AND c.checksum_type = checksum_type_in;
RETURN checksum_id;
EXCEPTION
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/008-lookup_checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/008-lookup_checksum.sql
new file mode 100644
index 0000000..5baba4b
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/008-lookup_checksum.sql
@@ -0,0 +1,49 @@
+--
+-- Copyright (c) 2009 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_CHECKSUM(checksum_type_in IN VARCHAR2, checksum_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ checksum_id NUMBER;
+BEGIN
+ if checksum_in is null then
+ return null;
+ end if;
+
+ SELECT c.id
+ INTO checksum_id
+ FROM rhnChecksumView c
+ WHERE c.checksum = checksum_in
+ AND c.checksum_type = checksum_type_in;
+
+ RETURN checksum_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ INSERT INTO rhnChecksum (id, checksum_type_id, checksum)
+ VALUES (rhnChecksum_seq.nextval,
+ (select id from rhnChecksumType where label = checksum_type_in),
+ checksum_in)
+ RETURNING id INTO checksum_id;
+ COMMIT;
+ RETURN checksum_id;
+END;
+/
+SHOW ERRORS
+
commit 87b31b546f1b6299c2ceeb019e8e672b3eb28e1a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Nov 20 11:47:28 2009 +0100
added forgotten rhnLib to imports
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index d77f17c..731c608 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -22,7 +22,7 @@ import os
import string
import tempfile
-from common import RPC_Base, rhnFault, log_debug, log_error, CFG
+from common import RPC_Base, rhnFault, log_debug, log_error, CFG, rhnLib
from server import rhnSQL, rhnPackageUpload, rhnUser, rhnSession
diff --git a/backend/server/importlib/headerSource.py b/backend/server/importlib/headerSource.py
index 5bc1d36..fba9224 100644
--- a/backend/server/importlib/headerSource.py
+++ b/backend/server/importlib/headerSource.py
@@ -24,7 +24,7 @@ from importLib import File, Dependency, ChangeLog, Channel, \
IncompletePackage, Package, SourcePackage
from backendLib import gmtime, localtime
from types import ListType, TupleType, IntType
-from common import log_debug
+from common import log_debug, rhnLib
class rpmPackage(IncompletePackage):
# Various mappings
diff --git a/backend/upload_server/handlers/package_push/package_push.py b/backend/upload_server/handlers/package_push/package_push.py
index 96ba828..3784123 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -25,7 +25,7 @@ import string
from mod_python import apache
from rhn import rpclib
-from common import CFG, log_debug, log_error, rhnFault, rhnFlags
+from common import CFG, log_debug, log_error, rhnFault, rhnFlags, rhnLib
from server import rhnPackageUpload, rhnSQL, basePackageUpload
class PackagePush(basePackageUpload.BasePackageUpload):
diff --git a/backend/upload_server/handlers/package_upload/package_upload.py b/backend/upload_server/handlers/package_upload/package_upload.py
index 185c05f..1f221c5 100644
--- a/backend/upload_server/handlers/package_upload/package_upload.py
+++ b/backend/upload_server/handlers/package_upload/package_upload.py
@@ -22,7 +22,7 @@
import os
from mod_python import apache
-from common import CFG, log_debug, log_error, rhnFault, rhnFlags
+from common import CFG, log_debug, log_error, rhnFault, rhnFlags, rhnLib
from server import rhnPackageUpload, basePackageUpload
from server.rhnLib import get_package_path
commit 150e16697ad6cf3b38b6e4dd62d2bf40e85ecfdb
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Nov 20 00:10:07 2009 +0100
fixed checksum type of files inside rpm package
diff --git a/backend/server/importlib/headerSource.py b/backend/server/importlib/headerSource.py
index 4773d58..5bc1d36 100644
--- a/backend/server/importlib/headerSource.py
+++ b/backend/server/importlib/headerSource.py
@@ -282,7 +282,8 @@ class rpmFile(File, ChangeLog):
'rdev' : 'filerdevs',
'file_size' : 'filesizes',
'mtime' : 'filemtimes',
- 'md5' : 'filemd5s',
+ 'filedigest' : 'filemd5s', # FILEMD5S is a pre-rpm4.6 name for FILEDIGESTS
+ # we have to use it for compatibility reason
'linkto' : 'filelinktos',
'flags' : 'fileflags',
'verifyflags' : 'fileverifyflags',
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index e0c82f7..5044c84 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -253,13 +253,14 @@ class PackageImport(ChannelPackageSubscription):
self.capabilities[nv] = None
# Process files too
fileList = package['files']
+ checksum_type = package['checksum'][0]
for f in fileList:
nv = (f['name'], '')
del f['name']
f['capability'] = nv
if not self.capabilities.has_key(nv):
self.capabilities[nv] = None
- fchecksum = ('md5', f['md5'])
+ fchecksum = (checksum_type, f['filedigest'])
f['checksum'] = fchecksum
if not self.checksums.has_key(fchecksum):
self.checksums[fchecksum] = None
@@ -486,7 +487,7 @@ class PackageImport(ChannelPackageSubscription):
package['solaris_patch_set_members'] = infoObjs
def _comparePackages(self, package1, package2):
- if package1['md5sum'] == package2['md5sum']:
+ if package1['checksum'] == package2['checksum']:
return
# XXX Handle this better
raise Exception("Different packages in the same batch")
@@ -552,7 +553,7 @@ class SourcePackageImport(Import):
def _comparePackages(self, package1, package2):
- if package1['md5sum'] == package2['md5sum']:
+ if package1['checksum'] == package2['checksum']:
return
# XXX Handle this better
raise Exception("Different packages in the same batch")
commit eba05941e8a324731c2d929ee2f4303297f6e436
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 19 23:40:45 2009 +0100
removed commented out code
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index b102925..e0c82f7 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -71,7 +71,6 @@ class ChannelPackageSubscription(GenericPackageImport):
if package.ignored:
continue
self._postprocessPackageNEVRA(package)
- #package['checksum_id'] = self.checksums[package['checksum']]
self._postprocessPackage(package)
if not CFG.ENABLE_NVREA:
# nvrea disabled, skip checksum
@@ -180,12 +179,6 @@ class ChannelPackageSubscription(GenericPackageImport):
# Replace the channel list with the uniquified list
package.channels = channels
-# # FIXME: needs to be fixed for sha256
-# checksum = ('md5',package['md5sum'])
-# package['checksum'] = checksum
-# if not self.checksums.has_key(checksum):
-# self.checksums[checksum] = None
-
# Copies the channels from one package to the other
def __copyChannels(self, sourcePackage, destPackage):
dpHash = destPackage['channels']
commit ae0a3a61985c4e0300468d404b8dbc718bc7f018
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 19 23:39:06 2009 +0100
fixed comment
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index 036bdab..b102925 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -74,14 +74,14 @@ class ChannelPackageSubscription(GenericPackageImport):
#package['checksum_id'] = self.checksums[package['checksum']]
self._postprocessPackage(package)
if not CFG.ENABLE_NVREA:
- # nvrea disabled, skip md5sum
+ # nvrea disabled, skip checksum
nevrao = (
package['name_id'],
package['evr_id'],
package['package_arch_id'],
package['org_id'])
else:
- # As nvrea is enabled uniquify based on md5sum
+ # As nvrea is enabled uniquify based on checksum
nevrao = (
package['name_id'],
package['evr_id'],
commit cbfb3f23da96c253759e04f99f5d067079e57863
Merge: c5eb153... 7dbc7e0...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 19 22:46:40 2009 +0100
Merge branch 'master' into sha256-support3
commit c5eb15338d0d842addf0d6e07ee76d1d403d3b98
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 19 12:17:52 2009 +0100
checksum type looks better in upper case
diff --git a/web/modules/sniglets/Sniglets/ListView/FileList.pm b/web/modules/sniglets/Sniglets/ListView/FileList.pm
index 67fd1ff..ff4e308 100644
--- a/web/modules/sniglets/Sniglets/ListView/FileList.pm
+++ b/web/modules/sniglets/Sniglets/ListView/FileList.pm
@@ -114,7 +114,7 @@ sub row_callback {
$row->{NAME} = '<tt>' . $row->{NAME} . '</tt>';
if ($row->{CHECKSUM}) {
- $row->{CHECKSUM} = '<tt>' . $row->{CHECKSUM_TYPE} . ': ' . $row->{CHECKSUM} . '</tt>';
+ $row->{CHECKSUM} = '<tt>' . uc($row->{CHECKSUM_TYPE}) . ': ' . $row->{CHECKSUM} . '</tt>';
$row->{FILE_SIZE} = '<tt>' . PXT::Utils->commafy($row->{FILE_SIZE}) . " bytes</tt>";
}
elsif ($row->{LINKTO}) {
commit 8d7cbbe5e293b342767aab5c57bdcde6fb2d2e59
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 19 11:27:23 2009 +0100
fixed checksum on config.pxt page
diff --git a/web/html/network/systems/details/history/snapshots/config.pxt b/web/html/network/systems/details/history/snapshots/config.pxt
index 44a9869..35b298f 100644
--- a/web/html/network/systems/details/history/snapshots/config.pxt
+++ b/web/html/network/systems/details/history/snapshots/config.pxt
@@ -41,7 +41,7 @@ Snapshot - Configuration Files</h2>
<url>/rhn/configuration/file/FileDetails.do?crid={column:id}</url>
</column>
<column name="Revision" label="revision" width="1%"/>
- <column name="MD5 Checksum" label="md5sum" width="25%" />
+ <column name="Checksum" label="checksum" width="25%" />
<column name="Created" label="created" width="10%" />
<empty_list_message>No files</empty_list_message>
</rhn-listview>
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml
index 9af09c7..0abc9be 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml
@@ -519,7 +519,7 @@ ORDER BY CFN.path
<query params="ss_id">
SELECT DISTINCT
CR.id,
- Csum.checksum md5sum,
+ UPPER(Csum.checksum_type) || ': ' || Csum.checksum AS CHECKSUM,
CFN.id AS CONFIG_FILE_NAME_ID,
CFN.path,
CR.revision,
@@ -533,7 +533,7 @@ SELECT DISTINCT
rhnConfigFile CF,
rhnConfigRevision CR,
rhnSnapshotConfigRevision SCR,
- rhnChecksum Csum
+ rhnChecksumView Csum
WHERE SCR.snapshot_id = :ss_id
AND SCR.config_revision_id = CR.id
AND CR.config_content_id = CCon.id
commit b76c5333c82232e8c7e71e823cfdc21223b66229
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 19 11:09:17 2009 +0100
replaced rhnChecksum and rhnChecksumType join with rhnChecksumView
diff --git a/backend/server/repomd/mapper.py b/backend/server/repomd/mapper.py
index c34c940..f7c71f2 100644
--- a/backend/server/repomd/mapper.py
+++ b/backend/server/repomd/mapper.py
@@ -215,7 +215,7 @@ class SqlPackageMapper:
p.path,
sr.name source_rpm,
p.last_modified,
- ct.label checksum_type
+ c.checksum_type
from
rhnPackage p,
rhnPackageName pn,
@@ -223,8 +223,7 @@ class SqlPackageMapper:
rhnPackageArch pa,
rhnPackageGroup pg,
rhnSourceRPM sr,
- rhnChecksum c,
- rhnChecksumType ct
+ rhnChecksumView c
where
p.id = :package_id
and p.name_id = pn.id
@@ -233,7 +232,6 @@ class SqlPackageMapper:
and p.package_group = pg.id
and p.source_rpm_id = sr.id
and p.checksum_id = c.id
- and c.checksum_type_id = ct.id
""")
self.filelist_sql = rhnSQL.prepare("""
diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index 16ec336..8bed05f 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -441,13 +441,11 @@ def get_package_for_checksum(org_id, checksum):
p.id
from
rhnPackage p,
- rhnChecksum c,
- rhnChecksumType ct
+ rhnChecksumView c
where p.org_id = :org_id
and p.checksum_id = c.id
and c.checksum = :checksum
- and ct.id = c.checksum_type_id
- and ct.label = :checksumtype
+ and c.checksum_type = :checksumtype
"""
h = rhnSQL.prepare(statement)
h.execute(org_id=org_id, checksum=checksum[1], checksumtype=checksum[0])
diff --git a/backend/server/rhnPackageUpload.py b/backend/server/rhnPackageUpload.py
index f6306bd..5503525 100644
--- a/backend/server/rhnPackageUpload.py
+++ b/backend/server/rhnPackageUpload.py
@@ -218,12 +218,10 @@ def push_package(header, payload_stream, checksum, org_id=None, force=None,
h_path_sql = """
select ps.path path
from %s ps,
- rhnChecksum c,
- rhnChecksumType ct
+ rhnChecksumView c
where
c.checksum = :csum
- and ct.label = :ctype
- and c.checksum_type_id = ct.id
+ and c.checksum_type = :ctype
and ps.checksum_id = c.id
and (ps.org_id = :org_id or
(ps.org_id is null and :org_id is null)
@@ -248,11 +246,9 @@ def push_package(header, payload_stream, checksum, org_id=None, force=None,
update rhnpackage
set path = :path
where checksum_id = (
- select id from rhnChecksum c,
- rhnChecksumType ct
+ select id from rhnChecksumView c
where c.checksum = :csum
- and ct.label = :ctype
- and c.checksum_type_id = ct.id)
+ and c.checksum_type = :ctype)
""")
h_upd.execute(path=relative_path, ctype=checksum[0], csum=checksum[1])
diff --git a/backend/server/rhnServer/server_packages.py b/backend/server/rhnServer/server_packages.py
index a941be0..c6ed87d 100644
--- a/backend/server/rhnServer/server_packages.py
+++ b/backend/server/rhnServer/server_packages.py
@@ -400,11 +400,9 @@ def processPackageKeyAssociations(header, checksum):
lookup_pkgid_sql = rhnSQL.prepare("""
select p.id
from rhnPackage p,
- rhnChecksum c,
- rhnChecksumType ct
+ rhnChecksumView c
where c.checksum = :csum
- and ct.label = :ctype
- and c.checksum_type_id = ct.id
+ and c.checksum_type = :ctype
and p.checksum_id = c.id
""")
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
index 5806da0..84a0140 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
@@ -1147,7 +1147,7 @@ GROUP BY C.id, C.name
<mode name="channel_errata_packages" class="com.redhat.rhn.frontend.dto.PackageDto">
<query params="eid, cid">
- SELECT P.id, CS.checksum, CST.label checksumtype,
+ SELECT P.id, CS.checksum, CS.checksum_type checksumtype,
PN.name || '-' || PE.version
|| '-' || PE.release || (CASE WHEN PE.epoch IS NULL THEN '' ELSE ':' || PE.epoch END)
|| '-' || PA.label name
@@ -1157,8 +1157,7 @@ GROUP BY C.id, C.name
rhnPackageName PN on P.name_id = PN.id inner join
rhnPackageEvr PE on P.evr_id = PE.id inner join
rhnPackageArch PA on P.package_arch_id = PA.id inner join
- rhnChecksum CS on P.checksum_id = CS.id inner join
- rhnChecksumType CST on CS.checksum_type_id = CST.id
+ rhnChecksumView CS on P.checksum_id = CS.id
where CP.channel_id = :cid
and EP.errata_id = :eid
ORDER by name
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
index e171617..1381baa 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
@@ -1152,22 +1152,20 @@ ORDER BY UPPER(EK.keyword)
<query params="eid, org_id">
SELECT DISTINCT EFP.package_id,
CS.checksum,
- CST.label AS CHECKSUMTYPE,
+ CS.checksum_type AS CHECKSUMTYPE,
EF.filename AS FILENAME,
C.name AS CHANNEL_NAME
FROM rhnChannel C,
rhnErrataFilePackage EFP,
rhnErrataFileChannel EFC,
rhnErrataFile EF,
- rhnChecksum CS,
- rhnChecksumType CST
+ rhnChecksumView CS
WHERE EF.errata_id = :eid
AND EF.id = EFC.errata_file_id (+)
AND EF.id = EFP.errata_file_id (+)
AND EFC.channel_id IN (SELECT AC.channel_id FROM rhnAvailableChannels AC WHERE AC.org_id = :org_id)
AND EFC.channel_id = C.id
AND EF.checksum_id = CS.id
- AND CS.checksum_type_id = CST.id
ORDER BY C.name, EF.filename DESC
</query>
</mode>
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml
index 7b68962..3ad9d97 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml
@@ -87,16 +87,15 @@ ORDER BY UPPER(C.name), C.version
SELECT C.name,
F.file_size,
CS.checksum,
- CST.label checksumtype,
+ CS.checksum_type checksumtype,
F.file_mode,
F.linkto,
TO_CHAR(F.mtime, 'YYYY-MM-DD HH24:MI:SS') AS MTIME
FROM rhnPackageFile F, rhnPackageCapability C,
- rhnChecksum CS, rhnChecksumType CST
+ rhnChecksumView CS
WHERE F.package_id = :pid
AND F.capability_id = C.id
AND F.checksum_id = CS.id
- AND CS.checksum_type_id = CST.id
ORDER BY UPPER(C.name)
</query>
</mode>
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
index cffddc0..fc63093 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
@@ -558,7 +558,7 @@ FROM
p.build_time, p.path, p.package_size, p.payload_size,
p.copyright, p.vendor, p.build_host, p.header_start, p.header_end,
srpm.name as source_rpm, pg.name as package_group_name,
- cs.checksum, cst.label as checksumtype
+ cs.checksum, cs.checksum_type as checksumtype
FROM
rhnChannelPackage cp,
rhnPackage p
@@ -567,8 +567,7 @@ FROM
rhnPackageName pn,
rhnPackageEvr pevr,
rhnPackageArch pa,
- rhnChecksum cs,
- rhnChecksumType cst
+ rhnChecksumView cs
WHERE
cp.package_id = p.id
AND p.name_id = pn.id
@@ -576,7 +575,6 @@ FROM
AND p.package_arch_id = pa.id
AND cp.channel_id = :channel_id
AND p.checksum_id = cs.id
- AND cs.checksum_type_id = cst.id
ORDER by 1
</query>
</mode>
commit ecf2fa89a99c3ae995066a3e3c5b001f8e7cb9ad
Merge: 5f2a436... c5b0183...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 19 10:44:23 2009 +0100
Merge branch 'master' into sha256-support3
commit c5b0183e830715676285a6f27c27091e34afdeab
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 19 10:43:45 2009 +0100
fixed typo
diff --git a/schema/spacewalk/common/views/views.deps b/schema/spacewalk/common/views/views.deps
index fe018f1..1704088 100644
--- a/schema/spacewalk/common/views/views.deps
+++ b/schema/spacewalk/common/views/views.deps
@@ -36,7 +36,7 @@ rhnChannelFamilyServerVirtual :: rhnServerEntitlementView \
rhnChannelFamilyMembers \
rhnServerChannel \
rhnServer
-hnChannelFamilyOverview :: rhnPrivateChannelFamily rhnChannelFamily
+rhnChannelFamilyOverview :: rhnPrivateChannelFamily rhnChannelFamily
rhnChannelFamilyPermissions :: rhnPublicChannelFamily \
rhnPrivateChannelFamily
rhnChannelFamilyServers :: rhnChannelFamilyMembers rhnChannelFamily \
commit 5f2a436354f2cdea15c93cb9336da390ed1bda8e
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 19 10:41:22 2009 +0100
added rhnChecksumView
diff --git a/schema/spacewalk/common/views/rhnChecksumView.sql b/schema/spacewalk/common/views/rhnChecksumView.sql
new file mode 100644
index 0000000..4c3dfe1
--- /dev/null
+++ b/schema/spacewalk/common/views/rhnChecksumView.sql
@@ -0,0 +1,24 @@
+--
+-- Copyright (c) 2009 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+create or replace view rhnChecksumView
+as
+select c.id,
+ ct.label checksum_type,
+ c.checksum
+ from rhnChecksum c,
+ rhnChecksumType ct
+ where c.checksum_type_id = ct.id;
+
diff --git a/schema/spacewalk/common/views/views.deps b/schema/spacewalk/common/views/views.deps
index fe018f1..265a788 100644
--- a/schema/spacewalk/common/views/views.deps
+++ b/schema/spacewalk/common/views/views.deps
@@ -46,6 +46,7 @@ rhnChannelPermissions :: rhnChannelFamilyMembers rhnPrivateChannelFam
rhnPublicChannelFamily web_contact
rhnChannelTreeView :: rhnChannel rhnChannelFamilyMembers \
rhnChannelFamilyPermissions
+rhnChecksumView :: rhnChecksum rhnChecksumType
rhnDemoOrgs :: demo_log
rhnEntitledServers :: rhnServerGroup rhnServerGroupType \
rhnServerGroupMembers rhnServer
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/007-rhnChecksumView.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/007-rhnChecksumView.sql
new file mode 100644
index 0000000..4c3dfe1
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/007-rhnChecksumView.sql
@@ -0,0 +1,24 @@
+--
+-- Copyright (c) 2009 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+create or replace view rhnChecksumView
+as
+select c.id,
+ ct.label checksum_type,
+ c.checksum
+ from rhnChecksum c,
+ rhnChecksumType ct
+ where c.checksum_type_id = ct.id;
+
commit 21b94283c059c47f9b1e369dd4cbb8bdb0a24bc7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 19 10:32:56 2009 +0100
added checksum type to filelist page
diff --git a/web/html/network/software/packages/file_list.pxt b/web/html/network/software/packages/file_list.pxt
index 0d14e9b..cb16ad9 100644
--- a/web/html/network/software/packages/file_list.pxt
+++ b/web/html/network/software/packages/file_list.pxt
@@ -25,7 +25,7 @@
<rhn-listview class="Sniglets::ListView::FileList" mode="package_files">
<formvars><var name="pid" /></formvars>
<column name="Filename" label="name" align="left" />
- <column name="MD5 Sum" label="md5" align="left" />
+ <column name="Checksum" label="checksum" align="left" />
<column name="Last Modified" label="mtime" />
<column name="Size" label="file_size" align="right" />
<empty_list_message>No files.</empty_list_message>
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml
index c660586..6502112 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml
@@ -104,12 +104,13 @@ ORDER BY created DESC
<query params="pid">
SELECT C.name,
F.file_size,
- Cs.checksum md5,
+ Cs.checksum,
+ Cs.checksum_type,
F.file_mode,
F.linkto,
TO_CHAR(F.mtime, 'YYYY-MM-DD HH24:MI:SS') AS MTIME
FROM rhnPackageFile F, rhnPackageCapability C,
- rhnChecksum Cs
+ rhnChecksumView Cs
WHERE F.package_id = :pid
AND F.capability_id = C.id
AND CS.id = F.checksum_id
diff --git a/web/modules/sniglets/Sniglets/ListView/FileList.pm b/web/modules/sniglets/Sniglets/ListView/FileList.pm
index 0a84da6..67fd1ff 100644
--- a/web/modules/sniglets/Sniglets/ListView/FileList.pm
+++ b/web/modules/sniglets/Sniglets/ListView/FileList.pm
@@ -113,17 +113,17 @@ sub row_callback {
if ($self->datasource->mode eq 'package_files') {
$row->{NAME} = '<tt>' . $row->{NAME} . '</tt>';
- if ($row->{MD5}) {
- $row->{MD5} = '<tt>' . $row->{MD5} . '</tt>';
+ if ($row->{CHECKSUM}) {
+ $row->{CHECKSUM} = '<tt>' . $row->{CHECKSUM_TYPE} . ': ' . $row->{CHECKSUM} . '</tt>';
$row->{FILE_SIZE} = '<tt>' . PXT::Utils->commafy($row->{FILE_SIZE}) . " bytes</tt>";
}
elsif ($row->{LINKTO}) {
$row->{FILE_SIZE} = ' ';
- $row->{MD5} = "<tt>(Symlink)</tt>";
+ $row->{CHECKSUM} = "<tt>(Symlink)</tt>";
}
else {
$row->{FILE_SIZE} = ' ';
- $row->{MD5} = "<tt>(Directory)</tt>";
+ $row->{CHECKSUM} = "<tt>(Directory)</tt>";
}
}
commit 223bfbc08b4eb604df6aecced0f4f60d7a74cc0e
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Nov 18 16:31:42 2009 +0100
fixed ORA-00904: "P"."MD5SUM": invalid identifier
Execution of /var/www/html/network/software/packages/change_log.pxt
failed at Wed Nov 18 15:58:45 2009: RHN::Exception: DBD::Oracle::db
prepare failed: ORA-00904: "P"."MD5SUM": invalid identifier (DBD ERROR:
error possibly near <*> indicator at char 233 in 'SELECT P.id, P.org_id,
P.name_id, P.evr_id, P.package_arch_id, P.package_group, P.rpm_version,
P.description, P.summary, P.package_size, P.payload_size, P.build_host,
TO_CHAR(P.build_time , 'YYYY-MM-DD HH24:MI:SS'), P.source_rpm_id, <*>P.md5sum,
P.vendor, P.payload_format, P.compat, P.path, P.header_sig, P.copyright,
P.cookie, TO_CHAR(P.last_modified , 'YYYY-MM-DD HH24:MI:SS'), PA.id,
PA.name, PA.label, PA.arch_type_id, PN.id, PN.name, PEVR.id, PEVR.epoch,
PEVR.version, PEVR.release, PG.id, PG.name, SRPM.id, SRPM.name\nFROM
rhnPackage P, rhnPackageArch PA, rhnPackageName PN, rhnPackageEVR PEVR,
rhnPackageGroup PG, rhnSourceRPM SRPM\nWHERE P.PACKAGE_ARCH_ID = PA.ID
AND P.NAME_ID = PN.ID AND P.EVR_ID = PEVR.ID AND P.PACKAGE_GROUP =
PG.ID(+) AND P.SOURCE_RPM_ID = SRPM.ID(+) AND P.ID = :p1') [for
Statement "SELECT P.id, P.org_id, P.name_id, P.evr_id,
P.package_arch_id, P.package_group, P.rpm_version, P.description,
P.summary, P.package_size, P.payload_size, P.build_host,
TO_CHAR(P.build_time , 'YYYY-MM-DD HH24:MI:SS'), P.source_rpm_id,
P.md5sum, P.vendor, P.payload_format, P.compat, P.path, P.header_sig,
P.copyright, P.cookie, TO_CHAR(P.last_modified , 'YYYY-MM-DD
HH24:MI:SS'), PA.id, PA.name, PA.label, PA.arch_type_id, PN.id, PN.name,
PEVR.id, PEVR.epoch, PEVR.version, PEVR.release, PG.id, PG.name,
SRPM.id, SRPM.name\nFROM rhnPackage P, rhnPackageArch PA, rhnPackageName
PN, rhnPackageEVR PEVR, rhnPackageGroup PG, rhnSourceRPM SRPM\nWHERE
P.PACKAGE_ARCH_ID = PA.ID AND P.NAME_ID = PN.ID AND P.EVR_ID = PEVR.ID
AND P.PACKAGE_GROUP = PG.ID(+) AND P.SOURCE_RPM_ID = SRPM.ID(+) AND P.ID
= ?"]\n RHN::DB /usr/lib/perl5/vendor_perl/5.8.8/RHN/DB.pm 234
RHN::Exception::DB::throw\n RHN::DB::Package
/usr/lib/perl5/vendor_perl/5.8.8/RHN/DB/Package.pm 547
RHN::DB::handle_error\n RHN::Package
/usr/lib/perl5/vendor_perl/5.8.8/RHN/Package.pm 31
RHN::DB::Package::lookup\n Sniglets::Packages
/usr/lib/perl5/vendor_perl/5.8.8/Sniglets/Packages.pm 329
RHN::Package::lookup\n PXT::Parser
/usr/lib/perl5/vendor_perl/5.8.8/PXT/Parser.pm 171
Sniglets::Packages::package_details\n PXT::Parser
/usr/lib/perl5/vendor_perl/5.8.8/PXT/Parser.pm 83
PXT::Parser::expand_tag\n PXT::ApacheHandler
/usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm 633
PXT::Parser::expand_tags\n PXT::ApacheHandler
/usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm 124
PXT::ApacheHandler::pxt_parse_data\n PXT::ApacheHandler
/usr/lib/perl5/vendor_perl/5.8.8/PXT/ApacheHandler.pm 124 (eval)\n main
-e 0 PXT::ApacheHandler::handler\n main -e 0 (eval)\n\nOffending Query:
SELECT P.id, P.org_id, P.name_id, P.evr_id, P.package_arch_id,
P.package_group, P.rpm_version, P.description, P.summary,
P.package_size, P.payload_size, P.build_host, TO_CHAR(P.build_time ,
'YYYY-MM-DD HH24:MI:SS'), P.source_rpm_id, P.md5sum, P.vendor,
P.payload_format, P.compat, P.path, P.header_sig, P.copyright, P.cookie,
TO_CHAR(P.last_modified , 'YYYY-MM-DD HH24:MI:SS'), PA.id, PA.name,
PA.label, PA.arch_type_id, PN.id, PN.name, PEVR.id, PEVR.epoch,
PEVR.version, PEVR.release, PG.id, PG.name, SRPM.id, SRPM.name\nFROM
rhnPackage P, rhnPackageArch PA, rhnPackageName PN, rhnPackageEVR PEVR,
rhnPackageGroup PG, rhnSourceRPM SRPM\nWHERE P.PACKAGE_ARCH_ID = PA.ID
AND P.NAME_ID = PN.ID AND P.EVR_ID = PEVR.ID AND P.PACKAGE_GROUP =
PG.ID(+) AND P.SOURCE_RPM_ID = SRPM.ID(+) AND P.ID = ?
diff --git a/web/modules/rhn/RHN/DB/Package.pm b/web/modules/rhn/RHN/DB/Package.pm
index b126a21..382b6e1 100644
--- a/web/modules/rhn/RHN/DB/Package.pm
+++ b/web/modules/rhn/RHN/DB/Package.pm
@@ -33,13 +33,14 @@ use RHN::Package::SolarisPatchSet;
my @pkg_fields = qw/
id org_id name_id evr_id package_arch_id package_group rpm_version description
summary package_size payload_size build_host build_time:longdate source_rpm_id
- md5sum vendor payload_format compat path header_sig copyright cookie last_modified:longdate
+ vendor payload_format compat path header_sig copyright cookie last_modified:longdate
/;
my @arch_fields = qw { id name label arch_type_id};
my @name_fields = qw { id name };
my @evr_fields = qw { id epoch version release };
my @group_fields = qw { id name };
my @srpm_fields = qw { id name };
+my @csum_fields = qw { id checksum };
my $p = new RHN::DB::TableClass("rhnPackage","P","",@pkg_fields);
my $a = new RHN::DB::TableClass("rhnPackageArch","PA","arch",@arch_fields);
@@ -47,14 +48,16 @@ my $n = new RHN::DB::TableClass("rhnPackageName", "PN", "package_name", @name_fi
my $evr = new RHN::DB::TableClass("rhnPackageEVR", "PEVR", "package_evr", @evr_fields);
my $pg = new RHN::DB::TableClass("rhnPackageGroup", "PG", "package_group", @group_fields);
my $srpm = new RHN::DB::TableClass("rhnSourceRPM", "SRPM", "s_rpm", @srpm_fields);
+my $csum = new RHN::DB::TableClass("rhnChecksum", "Csum", "checksum", @csum_fields);
-my $tc = $p->create_join([ $a, $n, $evr, $pg, $srpm ],{ "rhnPackage" => {
+my $tc = $p->create_join([ $a, $n, $evr, $pg, $srpm, $csum ],{ "rhnPackage" => {
"rhnPackage" => [ "ID", "ID" ],
"rhnPackageArch" => ["PACKAGE_ARCH_ID", "ID" ],
"rhnPackageName" => ["NAME_ID", "ID"],
"rhnPackageEVR" => ["EVR_ID", "ID"],
"rhnPackageGroup" => ["PACKAGE_GROUP", "ID"],
- "rhnSourceRPM" => ["SOURCE_RPM_ID", "ID"]
+ "rhnSourceRPM" => ["SOURCE_RPM_ID", "ID"],
+ "rhnChecksum" => ["CHECKSUM_ID", "ID"],
}
},
{ rhnSourceRPM => "(+)",
diff --git a/web/modules/sniglets/Sniglets/Packages.pm b/web/modules/sniglets/Sniglets/Packages.pm
index 7ce66c1..ad777ae 100644
--- a/web/modules/sniglets/Sniglets/Packages.pm
+++ b/web/modules/sniglets/Sniglets/Packages.pm
@@ -344,7 +344,8 @@ sub package_details {
$pxt->pnotes(package_name => $package->nvre);
$subst{"package_$_"} = PXT::Utils->escapeHTML($package->$_() || '') || $no_data
- foreach qw/id arch_name arch_label arch_type_label arch_type_name package_group_name rpm_version build_host build_time md5sum vendor copyright/;
+ foreach qw/id arch_name arch_label arch_type_label arch_type_name
+ package_group_name rpm_version build_host build_time vendor copyright/;
my ($relative_path, $size) = $package->source_rpm_path;
commit 77af04e4ac94a8b7bb9f436ebacf7ee8cc7e3a00
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Nov 18 15:46:31 2009 +0100
fixed another bunch of perl queries for sha256 schema
diff --git a/web/modules/rhn/RHN/DB/Channel.pm b/web/modules/rhn/RHN/DB/Channel.pm
index d0029fe..5edfcad 100644
--- a/web/modules/rhn/RHN/DB/Channel.pm
+++ b/web/modules/rhn/RHN/DB/Channel.pm
@@ -1128,7 +1128,7 @@ SELECT DISTINCT C.label,
PE.release,
E.advisory_name,
C.name,
- P.md5sum OUTDATED_PACKAGE_MD5SUM,
+ Csum.checksum OUTDATED_PACKAGE_MD5SUM,
P.path
FROM rhnPackageArch PA,
rhnChannel C,
@@ -1141,7 +1141,8 @@ SELECT DISTINCT C.label,
rhnChannelErrata CE,
rhnPackage P2,
rhnPackage P,
- rhnErrataPackage EP
+ rhnErrataPackage EP,
+ rhnChecksum Csum
WHERE EP.errata_id = ?
AND EP.package_id = P.id
AND P.name_id = P2.name_id
@@ -1157,6 +1158,7 @@ SELECT DISTINCT C.label,
AND P2.evr_id = PE.id
AND P2.package_arch_id = PA.id
AND CE2.channel_id = C.id
+ AND P.checksum_id = Csum.id
EOQ
$sth = $dbh->prepare($query);
diff --git a/web/modules/rhn/RHN/DB/ConfigRevision.pm b/web/modules/rhn/RHN/DB/ConfigRevision.pm
index 3575fb7..0f84dc5 100644
--- a/web/modules/rhn/RHN/DB/ConfigRevision.pm
+++ b/web/modules/rhn/RHN/DB/ConfigRevision.pm
@@ -49,7 +49,7 @@ SELECT
CFN.path,
CC.org_id,
CC.id config_channel_id,
- CCon.md5sum,
+ Csum.checksum md5sum,
CCon.file_size,
(SELECT CFt.latest_config_revision_id FROM rhnConfigFile CFt WHERE CFT.id = CR.config_file_id) LATEST_ID,
CCon.is_binary,
@@ -60,7 +60,8 @@ SELECT
rhnConfigChannel CC,
rhnConfigFile CF,
rhnConfigRevision CR,
- rhnConfigFileType CFT
+ rhnConfigFileType CFT,
+ rhnChecksum Csum
WHERE CR.id = :id
AND CI.id = CR.config_info_id
AND CF.id = CR.config_file_id
@@ -68,6 +69,7 @@ SELECT
AND CCon.id = CR.config_content_id
AND CC.id = CF.config_channel_id
AND CFT.id = CR.config_file_type_id
+ AND CCon.checksum_id = Csum.id
EOS
my $sth = $dbh->prepare($query);
$sth->execute_h(id => $params{id});
@@ -100,9 +102,9 @@ sub create_config_contents {
my $sth;
$sth = $dbh->prepare(<<EOS);
INSERT INTO rhnConfigContent
- (id, md5sum, file_size, contents)
+ (id, checksum_id, file_size, contents)
VALUES
- (rhn_confcontent_id_seq.nextval, :md5sum, :file_size, :contents)
+ (rhn_confcontent_id_seq.nextval, lookup_checksum('md5', :md5sum), :file_size, :contents)
RETURNING id INTO :ccid
EOS
diff --git a/web/modules/rhn/RHN/DB/Errata.pm b/web/modules/rhn/RHN/DB/Errata.pm
index 19b6fdb..39642c2 100644
--- a/web/modules/rhn/RHN/DB/Errata.pm
+++ b/web/modules/rhn/RHN/DB/Errata.pm
@@ -159,7 +159,7 @@ sub files {
$query = <<EOQ;
SELECT DISTINCT
EF.id AS ID,
- EF.md5sum AS MD5SUM,
+ Csum.checksum AS MD5SUM,
EF.filename AS FILENAME,
EFP.package_id AS PACKAGE_ID,
P1.path AS RHN_PACKAGE_PATH,
@@ -206,7 +206,8 @@ SELECT MAX(E.advisory_name)
rhnChannel C,
rhnErrataFileChannel EFC,
rhnErrataFileType EFT,
- rhnErrataFile EF
+ rhnErrataFile EF,
+ rhnChecksum Csum
WHERE EF.errata_id = ?
AND EF.type = EFT.id
AND EF.id = EFC.errata_file_id (+)
@@ -222,6 +223,7 @@ SELECT MAX(E.advisory_name)
AND P1.source_rpm_id = PS1.source_rpm_id (+)
AND P1.package_arch_id = PA.id (+)
AND EFPS.package_id = PS2.id (+)
+ AND EF.checksum_id = Csum.id
ORDER BY UPPER(Prod.name), UPPER(PA.name), UPPER(EF.filename)
EOQ
@@ -768,7 +770,7 @@ sub packages_in_errata {
PE.evr.version,
PE.evr.release,
C.name,
- P.md5sum,
+ Csum.checksum md5sum,
P.path,
PE.evr.epoch,
PA.label,
@@ -780,7 +782,8 @@ sub packages_in_errata {
rhnChannel C,
rhnChannelErrata CE,
rhnChannelPackage CP,
- rhnErrataPackage EP
+ rhnErrataPackage EP,
+ rhnChecksum Csum
WHERE EP.errata_id = ?
AND CE.errata_id = ?
AND EP.package_id = CP.package_id
@@ -790,6 +793,7 @@ sub packages_in_errata {
AND P.name_id = PN.id
AND P.evr_id = PE.id
AND P.package_arch_id = PA.id
+ AND P.checksum_id = Csum.id
EOS
$sth = $dbh->prepare($query);
@@ -817,13 +821,16 @@ sub source_rpms {
my $sth;
$query = <<EOS;
- SELECT PS.id, P.id, PS.id, C.label, 'src', PS.path, NULL, NULL, 'SRPMs', P.md5sum, PS.md5sum
+ SELECT PS.id, P.id, PS.id, C.label, 'src', PS.path, NULL, NULL, 'SRPMs',
+ CPsum.checksum md5sum, CPSsum.checksum md5sum
FROM rhnChannel C,
rhnPackageSource PS,
rhnPackage P,
rhnChannelPackage CP,
rhnChannelErrata CE,
rhnErrataPackage EP
+ rhnChecksum CPsum,
+ rhnChecksum CPSsum
WHERE EP.errata_id = ?
AND CE.errata_id = ?
AND EP.package_id = CP.package_id
@@ -831,6 +838,8 @@ sub source_rpms {
AND CE.channel_id = C.id
AND EP.package_id = P.id
AND P.source_rpm_id = PS.source_rpm_id
+ AND P.checksum_id = CPsum.id
+ AND PS.checksum_id = CPSsum.id
EOS
@@ -857,14 +866,14 @@ sub public_packages_overview {
my $sth;
$query = <<EOQ;
-SELECT P2.id, P2.md5sum, C.name, PN.name, PE.evr.version, PE.evr.release, PE.evr.epoch, P2.path, PA.name, C.label, CFM.channel_family_id,
+SELECT P2.id, Csum.checksum md5sum, C.name, PN.name, PE.evr.version, PE.evr.release, PE.evr.epoch, P2.path, PA.name, C.label, CFM.channel_family_id,
(
SELECT CFP2.channel_family_id
FROM rhnChannelFamilyPermissions CFP2
WHERE CFP2.org_id IS NULL
AND CFP2.channel_family_id = CFM.channel_family_id
) PUBLIC_PACKAGE
- FROM rhnChannelFamily CF, rhnChannelFamilyMembers CFM, rhnPackageArch PA, rhnPackageName PN, rhnPackageEVR PE, rhnPackage P2, rhnPackage P, rhnChannel C, rhnChannelPackage CP, rhnChannelErrata CE, rhnErrataPackage EP
+ FROM rhnChannelFamily CF, rhnChannelFamilyMembers CFM, rhnPackageArch PA, rhnPackageName PN, rhnPackageEVR PE, rhnPackage P2, rhnPackage P, rhnChannel C, rhnChannelPackage CP, rhnChannelErrata CE, rhnErrataPackage EP, rhnChecksum Csum
WHERE EP.errata_id = ?
AND CE.errata_id = ?
AND EP.package_id = CP.package_id
@@ -879,6 +888,7 @@ SELECT P2.id, P2.md5sum, C.name, PN.name, PE.evr.version, PE.evr.release, PE.ev
AND C.id = CFM.channel_id
AND CFM.channel_family_id = CF.id
AND CF.org_id IS NULL
+ AND P2.checksum_id = Csum.id
EOQ
$sth = $dbh->prepare($query);
@@ -906,18 +916,20 @@ sub rhn_files_overview {
$query = <<EOQ;
SELECT DISTINCT EFP.package_id,
- EF.md5sum,
+ Csum.checksum md5sum,
EF.filename AS FILENAME,
C.name AS CHANNEL_NAME
FROM rhnChannel C,
rhnErrataFilePackage EFP,
rhnErrataFileChannel EFC,
- rhnErrataFile EF
+ rhnErrataFile EF,
+ rhnChecksum Csum
WHERE EF.errata_id = :errata_id
AND EF.id = EFC.errata_file_id (+)
AND EF.id = EFP.errata_file_id (+)
AND EFC.channel_id IN (SELECT AC.channel_id FROM rhnAvailableChannels AC WHERE AC.org_id = :org_id)
AND EFC.channel_id = C.id
+ AND EF.checksum_id = Csum.id
ORDER BY C.name, EF.filename DESC
EOQ
@@ -1486,15 +1498,16 @@ EOQ
my $ep_table = $self->table_map('rhnErrataPackage');
$query = <<EOQ;
-SELECT rhn_erratafile_id_seq.nextval AS ID, EFT.id AS TYPE_ID, P.md5sum, P.path, P.id AS PACKAGE_ID,
+SELECT rhn_erratafile_id_seq.nextval AS ID, EFT.id AS TYPE_ID, Csum.checksum md5sum, P.path, P.id AS PACKAGE_ID,
PN.name || '-' || PE.evr.as_vre_simple() || '.' || PA.label AS NVREA
- FROM rhnErrataFileType EFT, rhnPackage P, $ep_table EP, rhnPackageName PN, rhnPackageEVR PE, rhnPackageArch PA
+ FROM rhnErrataFileType EFT, rhnPackage P, $ep_table EP, rhnPackageName PN, rhnPackageEVR PE, rhnPackageArch PA, rhnChecksum Csum
WHERE EFT.label = 'RPM'
AND P.id = EP.package_id
AND EP.errata_id = :eid
AND P.evr_id = PE.id
AND P.name_id = PN.id
AND P.package_arch_id = PA.id
+ AND P.checksum_id = Csum.id
EOQ
$sth = $dbh->prepare($query);
@@ -1503,8 +1516,8 @@ EOQ
my $ef_insert_query = <<EOQ;
INSERT
INTO $ef_table
- (id, errata_id, type, md5sum, filename)
-VALUES (:id, :eid, :type, :md5sum, :filename)
+ (id, errata_id, type, checksum_id, filename)
+VALUES (:id, :eid, :type, lookup_checksum('md5', :md5sum), :filename)
EOQ
my $ef_insert_sth = $dbh->prepare($ef_insert_query);
diff --git a/web/modules/rhn/RHN/DB/ErrataEditor.pm b/web/modules/rhn/RHN/DB/ErrataEditor.pm
index 35f852e..f0833f3 100644
--- a/web/modules/rhn/RHN/DB/ErrataEditor.pm
+++ b/web/modules/rhn/RHN/DB/ErrataEditor.pm
@@ -397,8 +397,8 @@ EOQ
$query =<<EOQ;
INSERT
INTO rhnErrataFileTmp
- (id, errata_id, type, md5sum, filename)
- (SELECT rhn_erratafile_id_seq.nextval, :new_eid, EF.type, EF.md5sum, EF.filename
+ (id, errata_id, type, checksum_id, filename)
+ (SELECT rhn_erratafile_id_seq.nextval, :new_eid, EF.type, EF.checksum_id, EF.filename
FROM rhnErrataFile EF
WHERE EF.errata_id = :old_eid)
EOQ
diff --git a/web/modules/rhn/RHN/DB/KSTree.pm b/web/modules/rhn/RHN/DB/KSTree.pm
index 3f5017d..0c75646 100644
--- a/web/modules/rhn/RHN/DB/KSTree.pm
+++ b/web/modules/rhn/RHN/DB/KSTree.pm
@@ -89,7 +89,7 @@ EOQ
return unless ($row);
$self->$_($row->{uc $_}) for qw/id label base_path channel_id boot_image org_id tree_type tree_type_name tree_type_label install_type install_type_label install_type_name channel_arch_id channel_arch_label channel_arch_name/;
- $sth = $dbh->prepare("SELECT relative_filename, file_size, md5sum, TO_CHAR(last_modified, 'YYYY-MM-DD HH24:MI:SS') AS LAST_MODIFIED FROM rhnKSTreeFile WHERE kstree_id = :tree_id");
+ $sth = $dbh->prepare("SELECT relative_filename, file_size, Csum.checksum md5sum, TO_CHAR(last_modified, 'YYYY-MM-DD HH24:MI:SS') AS LAST_MODIFIED FROM rhnKSTreeFile, rhnChecksum Csum WHERE kstree_id = :tree_id AND checksum_id = Csum.id");
$sth->execute_h(tree_id => $self->id);
$self->files( [ $sth->fullfetch_hashref ] );
@@ -194,9 +194,9 @@ sub commit_files {
for my $file (@{$self->files}) {
$sth = $dbh->prepare(<<EOQ);
INSERT INTO rhnKSTreeFile
- (kstree_id, relative_filename, md5sum, last_modified, file_size)
+ (kstree_id, relative_filename, checksum_id, last_modified, file_size)
VALUES
- (:tree_id, :relative_filename, :md5sum, TO_DATE(:last_modified, 'YYYY-MM-DD HH24:MI:SS'), :file_size)
+ (:tree_id, :relative_filename, lookup_checksum('md5', :md5sum), TO_DATE(:last_modified, 'YYYY-MM-DD HH24:MI:SS'), :file_size)
EOQ
$sth->execute_h(tree_id => $self->id, map { $_ => $file->{+uc $_} } qw/relative_filename md5sum last_modified file_size/)
diff --git a/web/modules/rhn/RHN/DB/Package.pm b/web/modules/rhn/RHN/DB/Package.pm
index 8b9c003..b126a21 100644
--- a/web/modules/rhn/RHN/DB/Package.pm
+++ b/web/modules/rhn/RHN/DB/Package.pm
@@ -329,10 +329,11 @@ sub file_list {
my $sth;
$query = <<EOQ;
-SELECT C.name, F.file_size, F.md5, F.file_mode
- FROM rhnPackageFile F, rhnPackageCapability C
+SELECT C.name, F.file_size, Csum.checksum md5, F.file_mode
+ FROM rhnPackageFile F, rhnPackageCapability C, rhnChecksum Csum
WHERE F.package_id = ?
AND F.capability_id = C.id
+ AND F.checksum_id = Csum.id
ORDER BY UPPER(C.name)
EOQ
commit 33ee571867c04f630a78705f49406bd3d21b2a2d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Nov 18 14:55:43 2009 +0100
fixed perl queries for sha256 schema
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml
index 821dcfb..c660586 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/General_queries.xml
@@ -104,13 +104,15 @@ ORDER BY created DESC
<query params="pid">
SELECT C.name,
F.file_size,
- F.md5,
+ Cs.checksum md5,
F.file_mode,
F.linkto,
TO_CHAR(F.mtime, 'YYYY-MM-DD HH24:MI:SS') AS MTIME
- FROM rhnPackageFile F, rhnPackageCapability C
+ FROM rhnPackageFile F, rhnPackageCapability C,
+ rhnChecksum Cs
WHERE F.package_id = :pid
AND F.capability_id = C.id
+ AND CS.id = F.checksum_id
ORDER BY UPPER(C.name)
</query>
</mode>
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml
index 19ce8d3..723cd77 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml
@@ -1752,7 +1752,7 @@ SELECT NEWEST.package_id AS id, NEWEST.channel_id
<query params="sid, action_id">
SELECT SAVR.mode_differs,
SAVR.size_differs,
- SAVR.md5_differs,
+ SAVR.checksum_differs md5_differs,
SAVR.uid_differs,
SAVR.gid_differs,
SAVR.mtime_differs,
@@ -1777,7 +1777,7 @@ SELECT SAVR.mode_differs,
UNION
SELECT 'N' AS mode_differs,
'N' AS size_differs,
- 'N' AS md5_differs,
+ 'N' AS checksum_differs md5_differs,
'N' AS uid_differs,
'N' AS gid_differs,
'N' AS mtime_differs,
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml
index dd3e921..9af09c7 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/config_queries.xml
@@ -115,14 +115,16 @@ ORDER BY CFN.path
<mode name="configfile_revisions">
<query params="crid">
SELECT CR.id,
- CCon.md5sum,
+ Csum.checksum md5sum,
CR.revision,
NVL2((SELECT 1 FROM rhnConfigFile CFt WHERE CFT.latest_config_revision_id = CR.id), 'Y', 'N') LATEST,
TO_CHAR(CCon.created, 'YYYY-MM-DD HH24:MI:SS') AS CREATED
- FROM rhnConfigContent CCon, rhnConfigRevision CR, rhnConfigFile CF
+ FROM rhnConfigContent CCon, rhnConfigRevision CR, rhnConfigFile CF,
+ rhnChecksum Csum
WHERE CCon.id = CR.config_content_id
AND CF.id = (SELECT config_file_id FROM rhnConfigRevision WHERE id = :crid)
AND CF.id = CR.config_file_id
+ AND CCon.checksum_id = Csum.id
ORDER BY CR.revision DESC
</query>
</mode>
@@ -130,7 +132,7 @@ ORDER BY CR.revision DESC
<mode name="configfiles_for_system">
<query params="sid">
SELECT CR.id AS ID,
- CCon.md5sum,
+ Csum.checksum md5sum,
CFN.path,
CR.revision,
NVL2((SELECT 1 FROM rhnConfigFile CFt WHERE CFT.latest_config_revision_id = CR.id), 'Y', 'N') LATEST,
@@ -150,7 +152,8 @@ SELECT CR.id AS ID,
rhnConfigFile CF,
rhnConfigRevision CR,
rhnServerConfigChannel SCC,
- rhnConfigFileType CFT
+ rhnConfigFileType CFT,
+ rhnChecksum Csum
WHERE SCC.server_id = :sid
AND SCC.config_channel_id = CF.config_channel_id
AND CF.id = CR.config_file_id
@@ -161,6 +164,7 @@ SELECT CR.id AS ID,
AND CF.latest_config_revision_id = CR.id
AND CCT.label in ('normal', 'local_override')
AND CR.config_file_type_id = CFT.id
+ AND CCon.checksum_id = Csum.id
ORDER BY CCT.priority, SCC.position
</query>
<elaborator params="sid" multiple="t">
@@ -197,7 +201,7 @@ ORDER BY SCC.position
<mode name="configfiles_for_system_diff">
<query params="sid">
SELECT CR.id AS ID,
- CCon.md5sum,
+ Csum.checksum md5sum,
CFN.path,
CR.revision,
NVL2((SELECT 1 FROM rhnConfigFile CFt WHERE CFT.latest_config_revision_id = CR.id), 'Y', 'N') LATEST,
@@ -217,7 +221,8 @@ SELECT CR.id AS ID,
rhnConfigFile CF,
rhnConfigRevision CR,
rhnServerConfigChannel SCC,
- rhnConfigFileType CFT
+ rhnConfigFileType CFT,
+ rhnChecksum Csum
WHERE SCC.server_id = :sid
AND SCC.config_channel_id = CF.config_channel_id
AND CF.id = CR.config_file_id
@@ -229,6 +234,7 @@ SELECT CR.id AS ID,
AND CCT.label in ('normal', 'local_override')
AND CR.config_file_type_id = CFT.id
AND NOT CFT.label = 'directory'
+ AND CCon.checksum_id = Csum.id
ORDER BY CCT.priority, SCC.position
</query>
<elaborator params="sid" multiple="t">
@@ -266,7 +272,7 @@ ORDER BY SCC.position
<query params="user_id">
SELECT SCC.server_id,
CR.id AS ID,
- CCon.md5sum,
+ Csum.checksum md5sum,
CFN.path,
CR.revision,
NVL2((SELECT 1 FROM rhnConfigFile CFt WHERE CFT.latest_config_revision_id = CR.id), 'Y', 'N') LATEST,
@@ -284,7 +290,8 @@ SELECT SCC.server_id,
rhnConfigFileName CFN,
rhnConfigFile CF,
rhnConfigRevision CR,
- rhnServerConfigChannel SCC
+ rhnServerConfigChannel SCC,
+ rhnChecksum Csum
WHERE SCC.server_id IN (
SELECT DISTINCT S.id
FROM rhnServer S,
@@ -311,6 +318,7 @@ SELECT SCC.server_id,
WHERE label = 'selected_configfiles_ssm'
AND USER_ID = :user_id
)
+ AND CCon.checksum_id = Csum.id
ORDER BY SCC.server_id, CCT.priority, SCC.position
</query>
</mode>
@@ -460,7 +468,7 @@ SELECT CFN.id, count(DISTINCT SCC.server_id) AS system_count
<mode name="selected_configfiles">
<query params="set_label, user_id">
SELECT CR.id,
- CCon.md5sum,
+ Csum.checksum md5sum,
CFN.path,
CR.revision,
NVL2((SELECT 1 FROM rhnConfigFile CFt WHERE CFT.latest_config_revision_id = CR.id), 'Y', 'N') LATEST,
@@ -474,7 +482,8 @@ SELECT CR.id,
rhnConfigFile CF,
rhnConfigContent CCon,
rhnConfigRevision CR,
- rhnSet S
+ rhnSet S,
+ rhnChecksum Csum
WHERE S.user_id = :user_id
AND S.label = :set_label
AND S.element = CR.id
@@ -484,6 +493,7 @@ SELECT CR.id,
AND CCon.id = CR.config_content_id
AND CCT.label IN ('normal', 'local_override')
AND CFN.id = CF.config_file_name_id
+ AND CCon.checksum_id = Csum.id
ORDER BY CFN.path
</query>
</mode>
@@ -509,7 +519,7 @@ ORDER BY CFN.path
<query params="ss_id">
SELECT DISTINCT
CR.id,
- CCon.md5sum,
+ Csum.checksum md5sum,
CFN.id AS CONFIG_FILE_NAME_ID,
CFN.path,
CR.revision,
@@ -522,12 +532,14 @@ SELECT DISTINCT
rhnConfigFileName CFN,
rhnConfigFile CF,
rhnConfigRevision CR,
- rhnSnapshotConfigRevision SCR
+ rhnSnapshotConfigRevision SCR,
+ rhnChecksum Csum
WHERE SCR.snapshot_id = :ss_id
AND SCR.config_revision_id = CR.id
AND CR.config_content_id = CCon.id
AND CR.config_file_id = CF.id
AND CF.config_file_name_id = CFN.id
+ AND CCon.checksum_id = Csum.id
ORDER BY CFN.path
</query>
</mode>
commit 23716d56f54d356fd266d2ab2b11c98d44369a25
Merge: 5418570... 0d51f52...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Nov 16 20:03:21 2009 +0100
Merge branch 'master' into sha256-support3
commit 54185708074a39ce7cc1a23fde604d898e6a23ac
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Nov 16 19:58:49 2009 +0100
let repomd.xml reflect channel checksum type
diff --git a/backend/server/repomd/domain.py b/backend/server/repomd/domain.py
index 1205e0e..045da2d 100644
--- a/backend/server/repomd/domain.py
+++ b/backend/server/repomd/domain.py
@@ -25,6 +25,7 @@ class Channel:
self.label = None
self.name = None
+ self.checksumtype = None
self.num_packages = 0
self.packages = []
diff --git a/backend/server/repomd/mapper.py b/backend/server/repomd/mapper.py
index d0da1d0..c34c940 100644
--- a/backend/server/repomd/mapper.py
+++ b/backend/server/repomd/mapper.py
@@ -41,11 +41,14 @@ class ChannelMapper:
self.channel_details_sql = rhnSQL.prepare("""
select
- label,
- name
+ c.label,
+ c.name,
+ ct.label checksumtype
from
- rhnChannel
- where id = :channel_id
+ rhnChannel c,
+ rhnChecksumType ct
+ where c.id = :channel_id
+ and c.checksum_type_id = ct.id
""")
self.channel_sql = rhnSQL.prepare("""
@@ -109,6 +112,7 @@ class ChannelMapper:
channel.label = details[0]
channel.name = details[1]
+ channel.checksumtype = details[2]
self.channel_sql.execute(channel_id = channel_id)
package_ids = self.channel_sql.fetchall()
diff --git a/backend/server/repomd/repository.py b/backend/server/repomd/repository.py
index 7675ca8..af6ff66 100644
--- a/backend/server/repomd/repository.py
+++ b/backend/server/repomd/repository.py
@@ -16,7 +16,7 @@
# Classes for generating repository metadata from RHN info.
#
-import sha
+import hashlib
import time
import StringIO
import shutil
@@ -361,7 +361,7 @@ class MetadataRepository:
ret = self.cache.set_file(cache_entry, self.last_modified)
repomd_view = view.RepoView(primary, filelists, other, updateinfo,
- comps, ret)
+ comps, ret, self.__get_checksumtype())
repomd_view.write_repomd()
ret.close()
@@ -370,14 +370,14 @@ class MetadataRepository:
return ret
def __get_file_checksum(self, xml_file):
- sha_computer = sha.new()
+ hash_computer = hashlib.new(self.__get_checksumtype())
chunk = xml_file.read(CHUNK_SIZE)
while chunk:
- sha_computer.update(chunk)
+ hash_computer.update(chunk)
chunk = xml_file.read(CHUNK_SIZE)
- return sha_computer.hexdigest()
+ return hash_computer.hexdigest()
def __compute_open_checksum(self, timestamp, xml_file):
template_hash = {}
@@ -394,6 +394,9 @@ class MetadataRepository:
return template_hash
+ def __get_checksumtype(self):
+ return self.repository.channel.checksumtype
+
def __getattr__(self, x):
return getattr(self.compressed_repository, x)
diff --git a/backend/server/repomd/view.py b/backend/server/repomd/view.py
index 257ae87..c6f7ffd 100644
--- a/backend/server/repomd/view.py
+++ b/backend/server/repomd/view.py
@@ -18,7 +18,8 @@ XML_ENCODING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
class RepoView:
- def __init__(self, primary, filelists, other, updateinfo, groups, fileobj):
+ def __init__(self, primary, filelists, other, updateinfo, groups, fileobj,
+ checksumtype):
self.primary = primary
self.filelists = filelists
self.other = other
@@ -26,17 +27,18 @@ class RepoView:
self.groups = groups
self.fileobj = fileobj
+ self.checksumtype = checksumtype
def _get_data(self, data_type, data_obj):
output = []
output.append(" <data type=\"%s\">" % (data_type))
output.append(" <location href=\"repodata/%s.xml.gz\"/>"
% (data_type))
- output.append(" <checksum type=\"sha\">%s</checksum>"
- % (data_obj['gzip_checksum']))
+ output.append(" <checksum type=\"%s\">%s</checksum>"
+ % (self.checksumtype, data_obj['gzip_checksum']))
output.append(" <timestamp>%d</timestamp>" % (data_obj['timestamp']))
- output.append(" <open-checksum type=\"sha\">%s</open-checksum>"
- % (data_obj['open_checksum']))
+ output.append(" <open-checksum type=\"%s\">%s</open-checksum>"
+ % (self.checksumtype, data_obj['open_checksum']))
output.append(" </data>")
return output
@@ -45,8 +47,8 @@ class RepoView:
if self.groups:
output.append(" <data type=\"group\">")
output.append(" <location href=\"repodata/comps.xml\"/>")
- output.append(" <checksum type=\"sha\">%s</checksum>"
- % (self.groups['open_checksum']))
+ output.append(" <checksum type=\"%s\">%s</checksum>"
+ % (self.checksumtype, self.groups['open_checksum']))
output.append(" <timestamp>%d</timestamp>"
% (self.groups['timestamp']))
output.append(" </data>")
commit a1bb7ca4f0dda625d86d6d7b63eb81769abd5140
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Nov 16 14:52:21 2009 +0100
let repomd generator be sha256'ish
diff --git a/backend/server/repomd/domain.py b/backend/server/repomd/domain.py
index 535d3b6..1205e0e 100644
--- a/backend/server/repomd/domain.py
+++ b/backend/server/repomd/domain.py
@@ -46,7 +46,7 @@ class Package:
self.epoch = 0
self.arch = None
- self.md5sum = None
+ self.checksum = (None, None)
self.summary = None
self.description = None
self.vendor = None
diff --git a/backend/server/repomd/mapper.py b/backend/server/repomd/mapper.py
index e43eda1..d0da1d0 100644
--- a/backend/server/repomd/mapper.py
+++ b/backend/server/repomd/mapper.py
@@ -196,7 +196,7 @@ class SqlPackageMapper:
pevr.release,
pevr.epoch,
pa.label arch,
- c.checksum md5sum,
+ c.checksum checksum,
p.summary,
p.description,
p.vendor,
@@ -210,7 +210,8 @@ class SqlPackageMapper:
p.copyright,
p.path,
sr.name source_rpm,
- p.last_modified
+ p.last_modified,
+ ct.label checksum_type
from
rhnPackage p,
rhnPackageName pn,
@@ -218,7 +219,8 @@ class SqlPackageMapper:
rhnPackageArch pa,
rhnPackageGroup pg,
rhnSourceRPM sr,
- rhnChecksum c
+ rhnChecksum c,
+ rhnChecksumType ct
where
p.id = :package_id
and p.name_id = pn.id
@@ -227,6 +229,7 @@ class SqlPackageMapper:
and p.package_group = pg.id
and p.source_rpm_id = sr.id
and p.checksum_id = c.id
+ and c.checksum_type_id = ct.id
""")
self.filelist_sql = rhnSQL.prepare("""
@@ -346,7 +349,7 @@ class SqlPackageMapper:
package.epoch = pkg[3]
package.arch = pkg[4]
- package.md5sum = pkg[5]
+ package.checksum = (pkg[20], pkg[5])
package.summary = string_to_unicode(pkg[6])
package.description = string_to_unicode(pkg[7])
package.vendor = string_to_unicode(pkg[8])
diff --git a/backend/server/repomd/view.py b/backend/server/repomd/view.py
index 8e4118d..257ae87 100644
--- a/backend/server/repomd/view.py
+++ b/backend/server/repomd/view.py
@@ -104,8 +104,8 @@ class PrimaryView(object):
output.append(" <arch>%s</arch>" % (package.arch))
output.append(" <version epoch=\"%s\" ver=\"%s\" rel=\"%s\" />"
% (package.epoch, package.version, package.release))
- output.append(" <checksum type=\"md5\" pkgid=\"YES\">%s</checksum>"
- % (package.md5sum))
+ output.append(" <checksum type=\"%s\" pkgid=\"YES\">%s</checksum>"
+ % package.checksum)
output.append(" <summary>%s</summary>"
% (text_filter(package.summary)))
output.append(" <description>%s</description>"
@@ -180,7 +180,7 @@ class FilelistsView(object):
def _get_package(self, package):
output = []
output.append(" <package pkgid=\"%s\" name=\"%s\" arch=\"%s\">"
- % (package.md5sum, package.name, package.arch))
+ % (package.checksum[1], package.name, package.arch))
output.append(" <version epoch=\"%s\" ver=\"%s\" rel=\"%s\" />"
% (package.epoch, package.version, package.release))
@@ -212,7 +212,7 @@ class OtherView(object):
def _get_package(self, package):
output = []
output.append(" <package pkgid=\"%s\" name=\"%s\" arch=\"%s\">"
- % (package.md5sum, package.name, package.arch))
+ % (package.checksum[1], package.name, package.arch))
output.append(" <version epoch=\"%s\" ver=\"%s\" rel=\"%s\" />"
% (package.epoch, package.version, package.release))
@@ -282,8 +282,8 @@ class UpdateinfoView(object):
package.epoch, package.arch, text_filter(package.source_rpm)))
output.append(" <filename>%s</filename>"
% text_filter(package.filename))
- output.append(" <sum type=\"md5\">%s</sum>"
- % package.md5sum)
+ output.append(" <sum type=\"%s\">%s</sum>"
+ % package.checksum)
output.append(" </package>")
output.append(" </collection>")
commit 3228f089cd8cb5fd40ee2e2097af92403e132119
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Nov 16 11:00:37 2009 +0100
made get_package_for_checksum consistent with other functions
where checksum is tuple of (type, string)
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 9401fef..28da650 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -153,8 +153,7 @@ class RepoSync:
package.checksum = (checksum_type, rhnLib.getFileChecksum(
checksum_type, file=temp_file))
pid = rhnPackage.get_package_for_checksum(
- self.channel['org_id'],
- package.checksum[0], package.checksum[1])
+ self.channel['org_id'], package.checksum)
if pid is None:
rel_package_path = rhnPackageUpload.relative_path_from_header(
diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index bd94799..16ec336 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -433,9 +433,9 @@ def get_channels_for_package(pkg):
return map(lambda c: c['label'], ret)
def get_package_for_md5sum(org_id, md5sum):
- return get_package_for_checksum(org_id, 'md5', md5sum)
+ return get_package_for_checksum(org_id, ('md5', md5sum))
-def get_package_for_checksum(org_id, checksumtype, checksum):
+def get_package_for_checksum(org_id, checksum):
statement = """
select
p.id
@@ -450,7 +450,7 @@ def get_package_for_checksum(org_id, checksumtype, checksum):
and ct.label = :checksumtype
"""
h = rhnSQL.prepare(statement)
- h.execute(org_id=org_id, checksum=checksum, checksumtype=checksumtype)
+ h.execute(org_id=org_id, checksum=checksum[1], checksumtype=checksum[0])
ret = h.fetchone_dict()
if not ret:
return None
commit 79990c26be09573ea5545cad6270dbf5d2dbc125
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Nov 16 10:49:24 2009 +0100
switched checksum back from usage of repo metadata to compute on our own
although it works fine for Fedora 11 yum repo (sha256) it fails on
RHEL5 (where yum repo uses sha checksums while rpms are md5 summed)
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index d6952aa..9401fef 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -116,16 +116,6 @@ class RepoSync:
to_download = []
self.print_msg("Repo " + self.url + " has " + str(len(packages)) + " packages.")
for pack in packages:
- pid = None
- # use the best checksum we know
- for ctype in ('sha512', 'sha256', 'sha1', 'md5'):
- if pack.checksums.has_key(ctype):
- pack.checksum = (ctype, pack.checksums[ctype])
- break
- if pack.checksum == None:
- raise rhnFault(507, "Checksum type: %s; Package: %s" %
- (string.join(pack.checksums.keys()), pack.file)) # FIXME
- if pid == None:
if self.channel_label not in \
rhnPackage.get_channels_for_package([pack.name, \
pack.version, pack.release, pack.epoch, pack.arch]) and \
@@ -142,11 +132,7 @@ class RepoSync:
self.print_msg(str(index+1) + "/" + str(len(to_download)) + " : "+ \
pack.getNVREA())
path = self.plugin.get_package(pack)
- pid = rhnPackage.get_package_for_checksum(
- self.channel['org_id'],
- pack.checksum[0], pack.checksum[1])
- if pid is None:
- self.upload_package(pack, path)
+ self.upload_package(pack, path)
self.associate_package(pack)
if self.url.find("file://") < 0:
os.remove(path)
@@ -163,11 +149,19 @@ class RepoSync:
temp_file = open(path, 'rb')
header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_file)
- rel_package_path = rhnPackageUpload.relative_path_from_header(
+ checksum_type = header.checksum_type()
+ package.checksum = (checksum_type, rhnLib.getFileChecksum(
+ checksum_type, file=temp_file))
+ pid = rhnPackage.get_package_for_checksum(
+ self.channel['org_id'],
+ package.checksum[0], package.checksum[1])
+
+ if pid is None:
+ rel_package_path = rhnPackageUpload.relative_path_from_header(
header, self.channel['org_id'], package.checksum)
- package_path = os.path.join(CFG.MOUNT_POINT,
+ package_path = os.path.join(CFG.MOUNT_POINT,
rel_package_path)
- package_dict, diff_level = rhnPackageUpload.push_package(header,
+ package_dict, diff_level = rhnPackageUpload.push_package(header,
payload_stream, package.checksum, force=False,
header_start=header_start, header_end=header_end,
relative_path=rel_package_path,
commit 1a4050429d3c4dac4f89175cb1b771a9b79dd717
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Nov 16 00:05:08 2009 +0100
rhnPackageUpload.push_package and all the stuff it uses modified to use checksum
where all the stuff are:
rhnPackageUpload.push_package
importLib.copy_package
mpmSource.create_package
server_packages.processPackageKeyAssociations
rhnLib.getFileMD5 -> rhnLib.getFileChecksum
headerSource.createPackage
mpmBinaryPackage.populate
rpmBinaryPackage.populate
rpmSourcePackage.populate
rpmPackage.populate
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 868fe6b..d6952aa 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -168,7 +168,7 @@ class RepoSync:
package_path = os.path.join(CFG.MOUNT_POINT,
rel_package_path)
package_dict, diff_level = rhnPackageUpload.push_package(header,
- payload_stream, package.checksum[1], force=False,
+ payload_stream, package.checksum, force=False,
header_start=header_start, header_end=header_end,
relative_path=rel_package_path,
org_id=self.channel['org_id'])
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index b2cd5dd..e40922e 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -1669,8 +1669,9 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
# Populate the package key info
if len(self.pkg_header_info) > 0:
for data in self.pkg_header_info:
+ checksum = ('md5', data['md5sum']) # FIXME sha256
server_packages.processPackageKeyAssociations(data['header'], \
- data['md5sum'])
+ checksum)
return self._link_channel_packages()
def _link_channel_packages(self):
diff --git a/backend/satellite_tools/updatePackages.py b/backend/satellite_tools/updatePackages.py
index 734fefb..4be119f 100644
--- a/backend/satellite_tools/updatePackages.py
+++ b/backend/satellite_tools/updatePackages.py
@@ -214,7 +214,8 @@ def process_package_data():
if debug: Log.writeMessage("query Executed: update rhnPackage %d to %s" \
% ( path['id'], new_path ))
# Process gpg key ids
- server_packages.processPackageKeyAssociations(hdr, md5sum)
+ checksum = ('md5', md5sum) # FIXME sha256
+ server_packages.processPackageKeyAssociations(hdr, checksum)
if debug: Log.writeMessage("gpg key info updated from %s" % new_abs_path )
i = i + 1
# we need to break the transaction to smaller pieces
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index ceee2c3..03feba4 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -283,8 +283,9 @@ class Packages(RPC_Base):
header, org_id=org_id)
md5sum = rhnLib.getFileMD5(file=package_stream)
+ checksum = ('md5', md5sum) # FIXME sha256
package_dict, diff_level = rhnPackageUpload.push_package(
- header, payload_stream, md5sum, org_id=org_id, force=force,
+ header, payload_stream, checksum, org_id=org_id, force=force,
header_start=header_start, header_end=header_end,
relative_path=relative_path)
diff --git a/backend/server/importlib/headerSource.py b/backend/server/importlib/headerSource.py
index d06c3a0..4773d58 100644
--- a/backend/server/importlib/headerSource.py
+++ b/backend/server/importlib/headerSource.py
@@ -33,7 +33,7 @@ class rpmPackage(IncompletePackage):
'last_modified' : None,
}
- def populate(self, header, size, md5sum, path=None, org_id=None,
+ def populate(self, header, size, checksum, path=None, org_id=None,
header_start=None, header_end=None, channels=[]):
# XXX is seems to me that this is the place that 'source_rpm' is getting
@@ -63,7 +63,7 @@ class rpmPackage(IncompletePackage):
self[f] = val
self['package_size'] = size
- self['md5sum'] = md5sum
+ self['checksum'] = checksum
self['path'] = path
self['org_id'] = org_id
self['header_start'] = header_start
@@ -97,7 +97,8 @@ class rpmPackage(IncompletePackage):
# Strip trailing slashes
path = "%s/%s" % (sanitizePath(relpath), os.path.basename(f_path))
md5sum = rhnLib.getFileMD5(file=f_obj)
- self.populate(header, size, md5sum, path, org_id, header_start,
+ checksum = ('md5', md5sum) # FIXME sha256
+ self.populate(header, size, checksum, path, org_id, header_start,
header_end, channels)
class rpmBinaryPackage(Package, rpmPackage):
@@ -132,10 +133,10 @@ class rpmBinaryPackage(Package, rpmPackage):
'package_id' : None,
})
- def populate(self, header, size, md5sum, path=None, org_id=None,
+ def populate(self, header, size, checksum, path=None, org_id=None,
header_start=None, header_end=None, channels=[]):
- rpmPackage.populate(self, header, size, md5sum, path, org_id,
+ rpmPackage.populate(self, header, size, checksum, path, org_id,
header_start, header_end)
# Populate file information
@@ -247,9 +248,9 @@ class rpmSourcePackage(SourcePackage, rpmPackage):
'channels' : None,
'package_id' : None,
})
- def populate(self, header, size, md5sum, path=None, org_id=None,
+ def populate(self, header, size, checksum, path=None, org_id=None,
header_start=None, header_end=None, channels=[]):
- rpmPackage.populate(self, header, size, md5sum, path, org_id,
+ rpmPackage.populate(self, header, size, checksum, path, org_id,
header_start, header_end)
nvr = []
# Fill in source_rpm
@@ -358,7 +359,7 @@ def sanitizeList(l):
return l
return [l]
-def createPackage(header, size, md5sum, relpath, org_id, header_start,
+def createPackage(header, size, checksum, relpath, org_id, header_start,
header_end, channels):
"""
Returns a populated instance of rpmBinaryPackage or rpmSourcePackage
@@ -373,7 +374,7 @@ def createPackage(header, size, md5sum, relpath, org_id, header_start,
# bug #524231 - we need to call fullFilelist() for RPM v3 file list
# to expand correctly
header.hdr.fullFilelist()
- p.populate(header, size, md5sum, relpath, org_id, header_start, header_end,
+ p.populate(header, size, checksum, relpath, org_id, header_start, header_end,
channels)
return p
diff --git a/backend/server/importlib/importLib.py b/backend/server/importlib/importLib.py
index 7c63b2b..3d9f5f4 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -23,7 +23,7 @@ from UserDict import UserDict
from UserList import UserList
from common import log_debug, rhn_mpm
-from common.rhnLib import maketemp, getFileMD5
+from common.rhnLib import maketemp, getFileChecksum
from server.rhnLib import get_package_path
@@ -816,7 +816,7 @@ def write_temp_package(packageData, org_id, prepend=""):
# Clean up the package variable
del packageData
# Compute the md5sum
- pkgmd5sum = getFileMD5(None, fd)
+ pkgmd5sum = getFileChecksum('md5', None, fd) # FIXME sha256
# Read the RPM header
os.lseek(fd, 0, 0)
header = rhn_mpm.get_package_header(fd=fd)
@@ -828,19 +828,19 @@ def write_temp_package(packageData, org_id, prepend=""):
# And return this information
return fd, header, packageSize, pkgmd5sum, relPackagePath
-def copy_package(fd, basedir, relpath, md5sum, force=None):
+def copy_package(fd, basedir, relpath, checksum, force=None):
"""
Copies the information from the file descriptor to a file
- Checks the file's MD5 sum, raising FileConflictErrror if it's different
+ Checks the file's checksum, raising FileConflictErrror if it's different
The force flag prevents the exception from being raised, and copies the
- file even if the md5sum has changed
+ file even if the checksum has changed
"""
packagePath = basedir + "/" + relpath
# Is the file there already?
if os.path.isfile(packagePath) and not force:
- # Get its md5sum
- localmd5sum = getFileMD5(packagePath)
- if md5sum == localmd5sum:
+ # Get its checksum
+ localsum = getFileChecksum(checksum[0], packagePath)
+ if checksum[1] == localsum:
# Same file, so get outa here
return
raise FileConflictError(os.path.basename(packagePath))
diff --git a/backend/server/importlib/mpmSource.py b/backend/server/importlib/mpmSource.py
index bf49048..6d1a0e2 100644
--- a/backend/server/importlib/mpmSource.py
+++ b/backend/server/importlib/mpmSource.py
@@ -80,11 +80,11 @@ class mpmBinaryPackage(headerSource.rpmBinaryPackage):
if tagMap.has_key(t):
del tagMap[t]
- def populate(self, header, size, md5sum, path=None, org_id=None,
+ def populate(self, header, size, checksum, path=None, org_id=None,
channels=[]):
# call to base class method
- headerSource.rpmBinaryPackage.populate(self, header, size, md5sum, path,
+ headerSource.rpmBinaryPackage.populate(self, header, size, checksum, path,
org_id, channels)
srpm = self.get('source_rpm', '')
@@ -202,15 +202,15 @@ class mpmBinaryPackage(headerSource.rpmBinaryPackage):
# top-level package object creation --------------------------------------
-def create_package(header, size, md5sum, relpath, org_id, header_start=None,
+def create_package(header, size, checksum, relpath, org_id, header_start=None,
header_end=None, channels=[]):
if header.packaging == 'rpm':
- return headerSource.createPackage(header, size=size, md5sum=md5sum,
+ return headerSource.createPackage(header, size=size, checksum=checksum,
relpath=relpath, org_id=org_id, header_start=header_start,
header_end=header_end, channels=channels)
if header.is_source:
raise NotImplementedError()
p = mpmBinaryPackage()
- p.populate(header, size=size, md5sum=md5sum, path=relpath,
+ p.populate(header, size=size, checksum=checksum, path=relpath,
org_id=org_id, channels=channels)
return p
diff --git a/backend/server/importlib/packageUpload.py b/backend/server/importlib/packageUpload.py
index a40ac72..c40a136 100644
--- a/backend/server/importlib/packageUpload.py
+++ b/backend/server/importlib/packageUpload.py
@@ -100,7 +100,8 @@ def __processPackage(package, org_id, channels, source):
# Just say the whole package
header_end = packageSize
- p = createPackage(header, packageSize, md5sum, relpath, org_id,
+ checksum = ('md5', md5sum) # FIXME sha256
+ p = createPackage(header, packageSize, checksum, relpath, org_id,
header_start, header_end, channels)
return p
diff --git a/backend/server/importlib/test/test_solaris.py b/backend/server/importlib/test/test_solaris.py
index 4363654..ddccdd9 100644
--- a/backend/server/importlib/test/test_solaris.py
+++ b/backend/server/importlib/test/test_solaris.py
@@ -56,7 +56,7 @@ solaris_pkgs = [
'version': '4.0p1'
},
size=1024,
- md5sum='somecrap',
+ checksum=('md5','somecrap'),
path='/dev/null',
org_id=1,
channels=['solaris']
@@ -105,7 +105,7 @@ solaris_patches = [
'version': '09',
},
size=1024,
- md5sum='somecrap',
+ checksum=('md5','somecrap'),
path='/dev/null',
org_id=1,
channels=['solaris-patches']
@@ -196,7 +196,7 @@ solaris_patches = [
'version': '36',
},
size=1024,
- md5sum='somemorecrap',
+ checksum=('md5','somemorecrap'),
path='/dev/null',
org_id=1,
channels=['solaris-patches']
@@ -239,7 +239,7 @@ solaris_patch_sets = [
'version': '20050323',
},
size=1024,
- md5sum='somecrap',
+ chekcsum=('md5','somecrap'),
path='/dev/null',
org_id=1,
channels=['solaris']
diff --git a/backend/server/rhnPackageUpload.py b/backend/server/rhnPackageUpload.py
index d2906cf..f6306bd 100644
--- a/backend/server/rhnPackageUpload.py
+++ b/backend/server/rhnPackageUpload.py
@@ -127,7 +127,7 @@ def relative_path_from_nevra_without_package_name(nevra, org_id, checksum):
return get_package_path_without_package_name(nevra, org_id,
prepend=CFG.PREPENDED_DIR, checksum=checksum)
-def push_package(header, payload_stream, md5sum, org_id=None, force=None,
+def push_package(header, payload_stream, checksum, org_id=None, force=None,
header_start=None, header_end=None, channels=[], relative_path=None):
"""Uploads an RPM package
"""
@@ -141,13 +141,13 @@ def push_package(header, payload_stream, md5sum, org_id=None, force=None,
# First write the package to the filesystem to final location
try:
importLib.copy_package(payload_stream.fileno(), basedir=CFG.MOUNT_POINT,
- relpath=relative_path, md5sum=md5sum, force=1)
+ relpath=relative_path, checksum=checksum, force=1)
except OSError, e:
raise rhnFault(50, "Package upload failed: %s" % e)
except importLib.FileConflictError:
raise rhnFault(50, "File already exists")
- pkg = mpmSource.create_package(header, size=payload_size, md5sum=md5sum,
+ pkg = mpmSource.create_package(header, size=payload_size, checksum=checksum,
relpath=relative_path, org_id=org_id, header_start=header_start,
header_end=header_end, channels=channels)
@@ -206,7 +206,7 @@ def push_package(header, payload_stream, md5sum, org_id=None, force=None,
#case 1:check if the path exists in the db and also on the file system.
#if it does then no need to copy
#case2: file exists on file system but path not in db.then add the
- #realtive path in the db based on md5sum of the pkg
+ #realtive path in the db based on checksum of the pkg
#case3: if no file on file system but path exists.then we write the
#file to file system
#case4:no file exists on FS and no path in db .then we write both.
@@ -218,9 +218,12 @@ def push_package(header, payload_stream, md5sum, org_id=None, force=None,
h_path_sql = """
select ps.path path
from %s ps,
- rhnChecksum c
+ rhnChecksum c,
+ rhnChecksumType ct
where
- c.checksum = :md5sum
+ c.checksum = :csum
+ and ct.label = :ctype
+ and c.checksum_type_id = ct.id
and ps.checksum_id = c.id
and (ps.org_id = :org_id or
(ps.org_id is null and :org_id is null)
@@ -231,7 +234,7 @@ def push_package(header, payload_stream, md5sum, org_id=None, force=None,
else:
h_package_table = 'rhnPackage'
h_path = rhnSQL.prepare(h_path_sql % h_package_table)
- h_path.execute(md5sum=md5sum, org_id = org_id)
+ h_path.execute(ctype=checksum[0], csum=checksum[1], org_id = org_id)
rs_path = h_path.fetchall_dict()
path_dict = {}
@@ -245,15 +248,19 @@ def push_package(header, payload_stream, md5sum, org_id=None, force=None,
update rhnpackage
set path = :path
where checksum_id = (
- select id from rhnChecksum where checksum = :md5sum)
+ select id from rhnChecksum c,
+ rhnChecksumType ct
+ where c.checksum = :csum
+ and ct.label = :ctype
+ and c.checksum_type_id = ct.id)
""")
- h_upd.execute(path=relative_path, md5sum=md5sum)
+ h_upd.execute(path=relative_path, ctype=checksum[0], csum=checksum[1])
# commit the transactions
rhnSQL.commit()
if not header.is_source:
# Process Package Key information
- server_packages.processPackageKeyAssociations(header, md5sum)
+ server_packages.processPackageKeyAssociations(header, checksum)
if not header.is_source:
errataCache.schedule_errata_cache_update(importer.affected_channels)
diff --git a/backend/server/rhnServer/server_packages.py b/backend/server/rhnServer/server_packages.py
index 9acb17d..a941be0 100644
--- a/backend/server/rhnServer/server_packages.py
+++ b/backend/server/rhnServer/server_packages.py
@@ -372,7 +372,7 @@ def update_errata_cache(server_id):
# Return the number of changes
return changed
-def processPackageKeyAssociations(header, md5sum):
+def processPackageKeyAssociations(header, checksum):
provider_sql = rhnSQL.prepare("""
insert into rhnPackageKeyAssociation
(package_id, key_id) values
@@ -399,8 +399,12 @@ def processPackageKeyAssociations(header, md5sum):
lookup_pkgid_sql = rhnSQL.prepare("""
select p.id
- from rhnPackage p, rhnChecksum c
- where c.checksum = :md5sum
+ from rhnPackage p,
+ rhnChecksum c,
+ rhnChecksumType ct
+ where c.checksum = :csum
+ and ct.label = :ctype
+ and c.checksum_type_id = ct.id
and p.checksum_id = c.id
""")
@@ -411,7 +415,7 @@ def processPackageKeyAssociations(header, md5sum):
and key_id = :key_id
""")
- lookup_pkgid_sql.execute(md5sum = md5sum)
+ lookup_pkgid_sql.execute(ctype=checksum[0], csum=checksum[1])
pkg_id = lookup_pkgid_sql.fetchall_dict()
if not pkg_id:
diff --git a/backend/upload_server/handlers/package_push/package_push.py b/backend/upload_server/handlers/package_push/package_push.py
index 61fe26c..96ba828 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -128,7 +128,7 @@ class PackagePush(basePackageUpload.BasePackageUpload):
raise rhnFault(104, "Mismatching information")
package_dict, diff_level = rhnPackageUpload.push_package(header,
- payload_stream, md5sum, force=self.force,
+ payload_stream, checksum, force=self.force,
header_start=header_start, header_end=header_end,
relative_path=self.rel_package_path, org_id=self.org_id)
commit bb144b362ed86953e4ea3c52efbd0c4dc819483c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 15 22:37:58 2009 +0100
removed hexify_string(); not needed on python > 2.3
diff --git a/backend/common/rhnLib.py b/backend/common/rhnLib.py
index eeacfff..e11670b 100644
--- a/backend/common/rhnLib.py
+++ b/backend/common/rhnLib.py
@@ -375,8 +375,8 @@ def getFileChecksum(hashtype, filename=None, fd=None, file=None, buffer_size=Non
Used by rotateFile()
"""
- # python's md5 lib sucks. hexdigest() doesn't show up until 2.0,
- # and there's no way to directly import a file.
+ # python's md5 lib sucks
+ # there's no way to directly import a file.
if buffer_size is None:
buffer_size = 65536
@@ -402,7 +402,7 @@ def getFileChecksum(hashtype, filename=None, fd=None, file=None, buffer_size=Non
file.seek(0, 0)
else:
f.close()
- return hexify_string(m.digest())
+ return m.hexdigest()
def getStringMD5(s):
@@ -412,12 +412,7 @@ def getStringMD5(s):
def getStringChecksum(hashtype, s):
""" compute checksum of an arbitrary string """
ctx = hashlib.new(hashtype, s)
- return hexify_string(ctx.digest())
-
-
-def hexify_string(s):
- """ Used by getStringMD5() and getFileMD5() """
- return ("%02x" * len(s)) % tuple(map(ord, s))
+ return ctx.hexdigest()
def rhn_popen(cmd, progressCallback=None, bufferSize=16384, outputLog=None):
commit 94f3e61e0e723a3ac8234d560b199a48a1442db7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 15 22:35:00 2009 +0100
implement various checksums
diff --git a/backend/common/rhnLib.py b/backend/common/rhnLib.py
index 4a54b04..eeacfff 100644
--- a/backend/common/rhnLib.py
+++ b/backend/common/rhnLib.py
@@ -15,7 +15,6 @@
import os
import sys
-import md5
import pwd
import grp
import time
@@ -25,6 +24,23 @@ import string
import popen2
import select
import urlparse
+try:
+ import hashlib
+except ImportError:
+ import md5
+ import sha
+ from Crypto.Hash import SHA256 as sha256
+ class hashlib:
+ @staticmethod
+ def new(checksum):
+ if checksum == 'md5':
+ return md5.new()
+ elif checksum == 'sha1':
+ return sha.new()
+ elif checksum == 'sha256':
+ return sha256.new()
+ else:
+ raise ValueError, "Incompatible checksum type"
def setHeaderValue(mp_table, name, values):
@@ -352,6 +368,12 @@ def getFileMD5(filename=None, fd=None, file=None, buffer_size=None):
""" Compute a file's md5sum
Used by rotateFile()
"""
+ return getFileChecksum('md5', filename, fd, file, buffer_size)
+
+def getFileChecksum(hashtype, filename=None, fd=None, file=None, buffer_size=None):
+ """ Compute a file's checksum
+ Used by rotateFile()
+ """
# python's md5 lib sucks. hexdigest() doesn't show up until 2.0,
# and there's no way to directly import a file.
@@ -368,7 +390,7 @@ def getFileMD5(filename=None, fd=None, file=None, buffer_size=None):
f = open(filename, "r")
# Rewind it
f.seek(0, 0)
- m = md5.new()
+ m = hashlib.new(hashtype)
while 1:
buffer = f.read(buffer_size)
if not buffer:
@@ -385,7 +407,11 @@ def getFileMD5(filename=None, fd=None, file=None, buffer_size=None):
def getStringMD5(s):
""" compute md5sum of an arbitrary string """
- ctx = md5.new(s)
+ return getStringChecksum(s)
+
+def getStringChecksum(hashtype, s):
+ """ compute checksum of an arbitrary string """
+ ctx = hashlib.new(hashtype, s)
return hexify_string(ctx.digest())
commit c6d11cef56f9b01b7db775d59252725da479c7db
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 15 19:35:42 2009 +0100
merge two similar queries
diff --git a/backend/server/rhnPackageUpload.py b/backend/server/rhnPackageUpload.py
index a8305b7..d2906cf 100644
--- a/backend/server/rhnPackageUpload.py
+++ b/backend/server/rhnPackageUpload.py
@@ -215,11 +215,9 @@ def push_package(header, payload_stream, md5sum, org_id=None, force=None,
log_debug(3, "Original package", orig_path)
#check included to query for source and binary rpms
- if header.is_source:
-
- h_path = rhnSQL.prepare("""
+ h_path_sql = """
select ps.path path
- from rhnpackagesource ps,
+ from %s ps,
rhnChecksum c
where
c.checksum = :md5sum
@@ -227,19 +225,12 @@ def push_package(header, payload_stream, md5sum, org_id=None, force=None,
and (ps.org_id = :org_id or
(ps.org_id is null and :org_id is null)
)
- """)
+ """
+ if header.is_source:
+ h_package_table = 'rhnPackageSource'
else:
- h_path = rhnSQL.prepare("""
- select rp.path path
- from rhnpackage rp,
- rhnChecksum c
- where
- c.checksum = :md5sum
- and rp.checksum_id = c.id
- and (rp.org_id = :org_id or
- (rp.org_id is null and :org_id is null)
- )
- """)
+ h_package_table = 'rhnPackage'
+ h_path = rhnSQL.prepare(h_path_sql % h_package_table)
h_path.execute(md5sum=md5sum, org_id = org_id)
rs_path = h_path.fetchall_dict()
commit 80cdda0445b5095e25cb4ca21173ccfbfa6d6c4a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 15 18:58:18 2009 +0100
cleaned up commented code
diff --git a/backend/upload_server/handlers/package_push/package_push.py b/backend/upload_server/handlers/package_push/package_push.py
index 8775964..61fe26c 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -98,11 +98,6 @@ class PackagePush(basePackageUpload.BasePackageUpload):
nevra = [self.package_name, "", self.package_version,
self.package_release, self.package_arch]
- # XXX need to clean this up
-# self.rel_package_path = rhnPackageUpload.relative_path_from_nevra(
-# nevra, org_id=self.org_id, package_type=self.packaging)
-# self.package_path = os.path.join(CFG.MOUNT_POINT,
-# self.rel_package_path)
return apache.OK
@@ -125,15 +120,6 @@ class PackagePush(basePackageUpload.BasePackageUpload):
header, org_id=self.org_id, checksum=checksum)
self.package_path = os.path.join(CFG.MOUNT_POINT,
self.rel_package_path)
- # XXX need to clean this up
-# relative_path = rhnPackageUpload.relative_path_from_header(header,
-# org_id=self.org_id)
-# log_debug(3, "relative path from mpm header", relative_path,
-# "relative path from HTTP header", self.rel_package_path)
-# if relative_path != self.rel_package_path:
-# log_debug(1, "Mismatching paths", relative_path,
-# self.rel_package_path)
-# raise rhnFault(104, "Mismatching information")
# Verify the md5sum of the bytes we downloaded against the md5sum
# presented by rhnpush in the HTTP headers
if md5sum != self.file_md5sum:
commit bc14fd3b6504f6b39749f2ed7d18559ed9c50579
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 15 18:56:33 2009 +0100
make get_package_path more readable
diff --git a/backend/server/rhnLib.py b/backend/server/rhnLib.py
index a314f75..75a4719 100644
--- a/backend/server/rhnLib.py
+++ b/backend/server/rhnLib.py
@@ -171,25 +171,20 @@ def get_package_path(nevra, org_id, source=0, prepend="", omit_epoch=None,
<prefix>/<org_id>/checksum[:3]/n/e:v-r/a/checksum/n-v-r.a.rpm if not omit_epoch
<prefix>/<org_id>/checksum[:3]/n/v-r/a/checksum/n-v-r.a.rpm if omit_epoch
"""
- name = nevra[0]
- release = nevra[3]
+ name, epoch, version, release, pkgarch = nevra
# dirarch and pkgarch are special-cased for source rpms
if source:
dirarch = 'SRPMS'
- pkgarch = nevra[4]
else:
- dirarch = pkgarch = nevra[4]
+ dirarch = pkgarch
if org_id in ['', None]:
org = "NULL"
else:
org = org_id
- version = nevra[2]
- if not omit_epoch:
- epoch = nevra[1]
- if epoch not in [None, '']:
+ if not omit_epoch and epoch not in [None, '']:
version = str(epoch) + ':' + version
# normpath sanitizes the path (removing duplicated / and such)
template = os.path.normpath(prepend +
commit 02a357232baf4f73d04b7d11b7767c326de41302
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 15 18:51:12 2009 +0100
removed unused imports
diff --git a/backend/server/basePackageUpload.py b/backend/server/basePackageUpload.py
index ad05f93..542fdfa 100644
--- a/backend/server/basePackageUpload.py
+++ b/backend/server/basePackageUpload.py
@@ -19,15 +19,8 @@ import os
import tempfile
from mod_python import apache
-from common import CFG, log_debug, rhnFault, rhn_mpm, rhnLib, UserDictCase
-from common.rhn_rpm import get_header_byte_range
+from common import log_debug, rhnFault, UserDictCase
-from server import rhnSQL
-from server.importlib import importLib, userAuth, mpmSource, backendOracle, \
- packageImport, errataCache
-from server.rhnLib import get_package_path, \
- get_package_path_without_package_name
-from server.rhnServer import server_packages
class BasePackageUpload:
def __init__(self, req):
commit fe14857a4ea6f16af312e6285fbd888ca2da5af5
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 15 18:35:21 2009 +0100
pass whole checksum struct to path functions
checksum = (checksum_type, checksum_string)
path functions:
relative_path_from_header()
relative_path_from_nevra_without_package_name()
relative_path_from_nevra()
get_package_path()
get_package_path_without_package_name()
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 2171eac..868fe6b 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -164,7 +164,7 @@ class RepoSync:
header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_file)
rel_package_path = rhnPackageUpload.relative_path_from_header(
- header, self.channel['org_id'], package.checksum[1])
+ header, self.channel['org_id'], package.checksum)
package_path = os.path.join(CFG.MOUNT_POINT,
rel_package_path)
package_dict, diff_level = rhnPackageUpload.push_package(header,
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index fff8e71..b2cd5dd 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -909,8 +909,9 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
raise RhnSyncException, 'ERROR: incremental dump skipped'
def _get_rel_package_path(self, nevra, org_id, source=0, md5sum=None):
+ checksum = ('md5', md5sum) # FIXME sha256
return get_package_path(nevra, org_id, prepend=CFG.PREPENDED_DIR,
- source=source, md5sum=md5sum)
+ source=source, checksum=checksum)
def _verify_file(self, path, mtime, size, md5sum):
"""Verifies if the file is on the filesystem and matches the mtime and
diff --git a/backend/server/importlib/importLib.py b/backend/server/importlib/importLib.py
index 8bbcdcf..7c63b2b 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -822,8 +822,9 @@ def write_temp_package(packageData, org_id, prepend=""):
header = rhn_mpm.get_package_header(fd=fd)
# Get nevra
nevra = get_nevra(header)
+ checksum = ('md5', pkgmd5sum) # FIXME sha256
relPackagePath = get_package_path(nevra, org_id, header.is_source, prepend,
- pkgmd5sum)
+ checksum)
# And return this information
return fd, header, packageSize, pkgmd5sum, relPackagePath
diff --git a/backend/server/rhnLib.py b/backend/server/rhnLib.py
index 3695630..a314f75 100644
--- a/backend/server/rhnLib.py
+++ b/backend/server/rhnLib.py
@@ -165,11 +165,11 @@ def transpose_to_hash(arr, column_names):
return rh
def get_package_path(nevra, org_id, source=0, prepend="", omit_epoch=None,
- package_type='rpm', md5sum=None):
+ package_type='rpm', checksum=(None,None)):
""" Computes a package path, optionally prepending a prefix
The path will look like
- <prefix>/<org_id>/md5sum[:3]/n/e:v-r/a/md5sum/n-v-r.a.rpm if not omit_epoch
- <prefix>/<org_id>/md5sum[:3]/n/v-r/a/md5sum/n-v-r.a.rpm if omit_epoch
+ <prefix>/<org_id>/checksum[:3]/n/e:v-r/a/checksum/n-v-r.a.rpm if not omit_epoch
+ <prefix>/<org_id>/checksum[:3]/n/v-r/a/checksum/n-v-r.a.rpm if omit_epoch
"""
name = nevra[0]
release = nevra[3]
@@ -194,7 +194,7 @@ def get_package_path(nevra, org_id, source=0, prepend="", omit_epoch=None,
# normpath sanitizes the path (removing duplicated / and such)
template = os.path.normpath(prepend +
"/%s/%s/%s/%s-%s/%s/%s/%s-%s-%s.%s.%s")
- return template % (org, md5sum[:3], name, version, release, dirarch, md5sum,
+ return template % (org, checksum[1][:3], name, version, release, dirarch, checksum[1],
name, nevra[2], release, pkgarch, package_type)
@@ -205,10 +205,10 @@ def get_package_path(nevra, org_id, source=0, prepend="", omit_epoch=None,
# This enables us to append an arbitrary file name that is not restricted to the
# form: name-version-release.arch.type
def get_package_path_without_package_name(nevra, org_id, prepend="",
- md5sum=None):
+ checksum=(None,None)):
"""return a package path without the package name appended"""
return os.path.dirname(get_package_path(nevra, org_id, prepend=prepend,
- md5sum=md5sum))
+ checksum=checksum))
class CallableObj:
diff --git a/backend/server/rhnPackageUpload.py b/backend/server/rhnPackageUpload.py
index 3b1b23c..a8305b7 100644
--- a/backend/server/rhnPackageUpload.py
+++ b/backend/server/rhnPackageUpload.py
@@ -87,7 +87,7 @@ def _authenticate(authobj, channels, null_org, force):
return org_id, force
-def relative_path_from_header(header, org_id, md5sum):
+def relative_path_from_header(header, org_id, checksum=(None,None)):
nevra = importLib.get_nevra(header)
if header.is_source:
#4/18/05 wregglej. if 1051 is in the header's keys, then it's a nosrc package.
@@ -104,13 +104,13 @@ def relative_path_from_header(header, org_id, md5sum):
header["package_name"]:
rel_path = relative_path_from_nevra_without_package_name(nevra, org_id,
- md5sum=md5sum)
+ checksum)
return os.path.join(rel_path, header["package_name"])
return relative_path_from_nevra(nevra,
- org_id=org_id, package_type=header.packaging, md5sum=md5sum)
+ org_id, header.packaging, checksum)
-def relative_path_from_nevra(nevra, org_id, package_type=None, md5sum=None):
+def relative_path_from_nevra(nevra, org_id, package_type=None, checksum=None):
#4/18/05 wregglej. if 1051 is in the header's keys, then it's a nosrc package.
if nevra[4] == 'src' or nevra[4] == 'nosrc':
is_source = 1
@@ -119,13 +119,13 @@ def relative_path_from_nevra(nevra, org_id, package_type=None, md5sum=None):
log_debug(4, nevra, is_source)
return get_package_path(nevra, org_id=org_id, source=is_source,
prepend=CFG.PREPENDED_DIR, omit_epoch=1, package_type=package_type,
- md5sum=md5sum)
+ checksum=checksum)
# bug #161989 - get the relative path from the nevra, but omit the package name
-def relative_path_from_nevra_without_package_name(nevra, org_id, md5sum=None):
+def relative_path_from_nevra_without_package_name(nevra, org_id, checksum):
log_debug(4, nevra, "no package name")
return get_package_path_without_package_name(nevra, org_id,
- prepend=CFG.PREPENDED_DIR, md5sum=md5sum)
+ prepend=CFG.PREPENDED_DIR, checksum=checksum)
def push_package(header, payload_stream, md5sum, org_id=None, force=None,
header_start=None, header_end=None, channels=[], relative_path=None):
diff --git a/backend/upload_server/handlers/package_push/package_push.py b/backend/upload_server/handlers/package_push/package_push.py
index c8283cc..8775964 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -120,8 +120,9 @@ class PackagePush(basePackageUpload.BasePackageUpload):
# Sanity check - removed, the package path can no longer be determined
# without the header
md5sum = rhnLib.getFileMD5(file=temp_stream)
+ checksum = ('md5', md5sum) # FIXME sha256
self.rel_package_path = rhnPackageUpload.relative_path_from_header(
- header, org_id=self.org_id, md5sum=md5sum)
+ header, org_id=self.org_id, checksum=checksum)
self.package_path = os.path.join(CFG.MOUNT_POINT,
self.rel_package_path)
# XXX need to clean this up
commit 971ef796613afbfd2987954275144b0f657903cf
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 15 16:38:40 2009 +0100
determine checksum type used by rpm
diff --git a/backend/common/rhn_rpm.py b/backend/common/rhn_rpm.py
index e1b275e..2a26a28 100644
--- a/backend/common/rhn_rpm.py
+++ b/backend/common/rhn_rpm.py
@@ -33,6 +33,32 @@ for sym, val in rpm.__dict__.items():
globals()[sym] = val
del sym, val
+# need this for rpm-pyhon < 4.6 (e.g. on RHEL5)
+rpm.RPMTAG_FILEDIGESTALGO = 5011
+
+# these values are taken from /usr/include/rpm/rpmpgp.h
+# PGPHASHALGO_MD5 = 1, /*!< MD5 */
+# PGPHASHALGO_SHA1 = 2, /*!< SHA1 */
+# PGPHASHALGO_RIPEMD160 = 3, /*!< RIPEMD160 */
+# PGPHASHALGO_MD2 = 5, /*!< MD2 */
+# PGPHASHALGO_TIGER192 = 6, /*!< TIGER192 */
+# PGPHASHALGO_HAVAL_5_160 = 7, /*!< HAVAL-5-160 */
+# PGPHASHALGO_SHA256 = 8, /*!< SHA256 */
+# PGPHASHALGO_SHA384 = 9, /*!< SHA384 */
+# PGPHASHALGO_SHA512 = 10, /*!< SHA512 */
+PGPHASHALGO = {
+ 1: 'md5',
+ 2: 'sha1',
+ 3: 'ripemd160',
+ 5: 'md2',
+ 6: 'tiger192',
+ 7: 'haval-5-160',
+ 8: 'sha256',
+ 9: 'sha384',
+ 10: 'sha512',
+}
+
+
class InvalidPackageError(Exception):
pass
@@ -156,6 +182,14 @@ class RPM_Header:
def __getattr__(self, name):
return getattr(self.hdr, name)
+ def checksum_type(self):
+ if self.hdr[rpm.RPMTAG_FILEDIGESTALGO] \
+ and PGPHASHALGO.has_key(self.hdr[rpm.RPMTAG_FILEDIGESTALGO]):
+ checksum_type = PGPHASHALGO[self.hdr[rpm.RPMTAG_FILEDIGESTALGO]]
+ else:
+ checksum_type = 'md5'
+ return checksum_type
+
def is_signed(self):
if hasattr(rpm, "RPMTAG_DSAHEADER"):
dsaheader = self.hdr["dsaheader"]
commit 8c329669ddcf8ea007491f2638ae7e3f26a158ca
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 15 11:48:58 2009 +0100
remove rest of md5sum references
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index fcc65ce..2171eac 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -164,14 +164,14 @@ class RepoSync:
header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_file)
rel_package_path = rhnPackageUpload.relative_path_from_header(
- header, org_id=self.channel['org_id'], md5sum=package.checksum[1]) # FIXME sha256
+ header, self.channel['org_id'], package.checksum[1])
package_path = os.path.join(CFG.MOUNT_POINT,
rel_package_path)
package_dict, diff_level = rhnPackageUpload.push_package(header,
payload_stream, package.checksum[1], force=False,
header_start=header_start, header_end=header_end,
relative_path=rel_package_path,
- org_id=self.channel['org_id']) # FIXME sha256
+ org_id=self.channel['org_id'])
temp_file.close()
def associate_package(self, pack):
commit 1e0dfb3d27f9c821e2418ff5c36be460193d623d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Sun Nov 15 11:32:00 2009 +0100
moved getFileMD5 outside of rhnPackageUpload.load_package
don't compute md5sum when we won't use it
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 399e1e2..fcc65ce 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -161,8 +161,7 @@ class RepoSync:
def upload_package(self, package, path):
temp_file = open(path, 'rb')
- # FIXME sha256 - don't compute needless md5sum inside of load_package()
- header, payload_stream, md5sum, header_start, header_end = \
+ header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_file)
rel_package_path = rhnPackageUpload.relative_path_from_header(
header, org_id=self.channel['org_id'], md5sum=package.checksum[1]) # FIXME sha256
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 9a21969..ceee2c3 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -277,11 +277,12 @@ class Packages(RPC_Base):
package_stream.seek(0, 0)
del packageBits
- header, payload_stream, md5sum, header_start, header_end = \
+ header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(package_stream)
relative_path = rhnPackageUpload.relative_path_from_header(
header, org_id=org_id)
+ md5sum = rhnLib.getFileMD5(file=package_stream)
package_dict, diff_level = rhnPackageUpload.push_package(
header, payload_stream, md5sum, org_id=org_id, force=force,
header_start=header_start, header_end=header_end,
diff --git a/backend/server/importlib/headerSource.py b/backend/server/importlib/headerSource.py
index 35753a2..d06c3a0 100644
--- a/backend/server/importlib/headerSource.py
+++ b/backend/server/importlib/headerSource.py
@@ -85,7 +85,7 @@ class rpmPackage(IncompletePackage):
source=None):
f_obj = file(f_path)
import server.rhnPackageUpload as rhnPackageUpload
- header, payload_stream, md5sum, header_start, header_end = \
+ header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(f_obj)
if (source and not header.is_source) or (not source and header.is_source):
raise ValueError("Unexpected RPM package type")
@@ -96,6 +96,7 @@ class rpmPackage(IncompletePackage):
if relpath:
# Strip trailing slashes
path = "%s/%s" % (sanitizePath(relpath), os.path.basename(f_path))
+ md5sum = rhnLib.getFileMD5(file=f_obj)
self.populate(header, size, md5sum, path, org_id, header_start,
header_end, channels)
diff --git a/backend/server/rhnPackageUpload.py b/backend/server/rhnPackageUpload.py
index 41e6a42..3b1b23c 100644
--- a/backend/server/rhnPackageUpload.py
+++ b/backend/server/rhnPackageUpload.py
@@ -298,7 +298,6 @@ def load_package(package_stream):
except rhn_mpm.InvalidPackageError, e:
raise rhnFault(50, "Unable to load package", explain=0)
- md5sum = rhnLib.getFileMD5(file=payload_stream)
payload_stream.seek(0, 0)
if header.packaging == "mpm":
header.header_start = header.header_end = 0
@@ -307,7 +306,7 @@ def load_package(package_stream):
(header_start, header_end) = get_header_byte_range(payload_stream)
payload_stream.seek(0,0)
- return header, payload_stream, md5sum, header_start, header_end
+ return header, payload_stream, header_start, header_end
class AlreadyUploadedError(Exception):
pass
diff --git a/backend/upload_server/handlers/package_push/package_push.py b/backend/upload_server/handlers/package_push/package_push.py
index 2115ada..c8283cc 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -114,11 +114,12 @@ class PackagePush(basePackageUpload.BasePackageUpload):
temp_stream = rhnPackageUpload.write_temp_file(req, 16384)
- header, payload_stream, md5sum, header_start, header_end = \
+ header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_stream)
# Sanity check - removed, the package path can no longer be determined
# without the header
+ md5sum = rhnLib.getFileMD5(file=temp_stream)
self.rel_package_path = rhnPackageUpload.relative_path_from_header(
header, org_id=self.org_id, md5sum=md5sum)
self.package_path = os.path.join(CFG.MOUNT_POINT,
diff --git a/backend/upload_server/handlers/package_upload/package_upload.py b/backend/upload_server/handlers/package_upload/package_upload.py
index b087ca9..185c05f 100644
--- a/backend/upload_server/handlers/package_upload/package_upload.py
+++ b/backend/upload_server/handlers/package_upload/package_upload.py
@@ -70,8 +70,9 @@ class PackageUpload(basePackageUpload.BasePackageUpload):
log_debug(4, "Header length", len(req.headers_in[i]))
temp_stream = rhnPackageUpload.write_temp_file(req, buffer_size)
- header, payload_stream, md5sum, header_start, header_end = \
+ header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_stream)
+ md5sum = rhnLib.getFileMD5(file=temp_stream)
temp_stream.close()
if self.file_md5sum != md5sum:
commit 45f7c7aea4654ad8fae6e592c3e99be42bafc66d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Nov 13 23:15:19 2009 +0100
let spacewalk-repo-sync be sha256 aware - store whatever checksum comes directly from repo
diff --git a/backend/common/rhnException.py b/backend/common/rhnException.py
index a91bd4f..ee9e68c 100644
--- a/backend/common/rhnException.py
+++ b/backend/common/rhnException.py
@@ -229,6 +229,7 @@ maximum membership exceeded"),
504: _("Not an RPM package"),
505: _("Unsigned RPM package"),
506: _("Incompatible package and channel architectures"),
+ 507: _("Incompatible checksum type"),
# 600-699: RHEL5+ EN errors
600: _("Invalid Entitlement Number"),
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index b47d7c8..399e1e2 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -117,10 +117,14 @@ class RepoSync:
self.print_msg("Repo " + self.url + " has " + str(len(packages)) + " packages.")
for pack in packages:
pid = None
- if pack.checksums.has_key('md5sum'):
- """lookup by md5sum"""
- elif pack.checksums.has_key('sha256'):
- """lookup by sha256"""
+ # use the best checksum we know
+ for ctype in ('sha512', 'sha256', 'sha1', 'md5'):
+ if pack.checksums.has_key(ctype):
+ pack.checksum = (ctype, pack.checksums[ctype])
+ break
+ if pack.checksum == None:
+ raise rhnFault(507, "Checksum type: %s; Package: %s" %
+ (string.join(pack.checksums.keys()), pack.file)) # FIXME
if pid == None:
if self.channel_label not in \
rhnPackage.get_channels_for_package([pack.name, \
@@ -138,12 +142,12 @@ class RepoSync:
self.print_msg(str(index+1) + "/" + str(len(to_download)) + " : "+ \
pack.getNVREA())
path = self.plugin.get_package(pack)
- md5 = rhnLib.getFileMD5(filename=path)
- pid = rhnPackage.get_package_for_md5sum(
- self.channel['org_id'], md5)
+ pid = rhnPackage.get_package_for_checksum(
+ self.channel['org_id'],
+ pack.checksum[0], pack.checksum[1])
if pid is None:
self.upload_package(pack, path)
- self.associate_package(pack, md5)
+ self.associate_package(pack)
if self.url.find("file://") < 0:
os.remove(path)
@@ -157,20 +161,21 @@ class RepoSync:
def upload_package(self, package, path):
temp_file = open(path, 'rb')
+ # FIXME sha256 - don't compute needless md5sum inside of load_package()
header, payload_stream, md5sum, header_start, header_end = \
rhnPackageUpload.load_package(temp_file)
rel_package_path = rhnPackageUpload.relative_path_from_header(
- header, org_id=self.channel['org_id'], md5sum=md5sum)
+ header, org_id=self.channel['org_id'], md5sum=package.checksum[1]) # FIXME sha256
package_path = os.path.join(CFG.MOUNT_POINT,
rel_package_path)
package_dict, diff_level = rhnPackageUpload.push_package(header,
- payload_stream, md5sum, force=False,
+ payload_stream, package.checksum[1], force=False,
header_start=header_start, header_end=header_end,
relative_path=rel_package_path,
- org_id=self.channel['org_id'])
+ org_id=self.channel['org_id']) # FIXME sha256
temp_file.close()
- def associate_package(self, pack, md5sum):
+ def associate_package(self, pack):
caller = "server.app.yumreposync"
backend = OracleBackend()
backend.init()
@@ -180,8 +185,7 @@ class RepoSync:
package['release'] = pack.release
package['epoch'] = pack.epoch
package['arch'] = pack.arch
- package['md5sum'] = md5sum
- package['checksum'] = ('md5', md5sum)
+ package['checksum'] = pack.checksum
package['channels'] = [{'label':self.channel_label,
'id':self.channel['id']}]
package['org_id'] = self.channel['org_id']
@@ -221,9 +225,10 @@ class RepoSync:
class ContentPackage:
def __init__(self):
- #map of checksums. Valid keys are 'md5sum' & 'sha256'
+ # map of checksums
self.checksums = {}
-
+ self.checksum = None
+
#unique ID that can be used by plugin
self.unique_id = None
diff --git a/backend/server/importlib/importLib.py b/backend/server/importlib/importLib.py
index dbfde10..8bbcdcf 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -677,8 +677,11 @@ class GenericPackageImport(Import):
self.package_arches[package.arch] = None
# FIXME: needs to be fixed for sha256
- checksum = ('md5',package['md5sum'])
- package['checksum'] = checksum
+ if not package.has_key('checksum'):
+ checksum = ('md5',package['md5sum'])
+ package['checksum'] = checksum
+ else:
+ checksum = package['checksum']
if not self.checksums.has_key(checksum):
self.checksums[checksum] = None
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index 0eb3a61..036bdab 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -87,7 +87,7 @@ class ChannelPackageSubscription(GenericPackageImport):
package['evr_id'],
package['package_arch_id'],
package['org_id'],
- package['md5sum'])
+ package['checksum_id'])
if not uniqdict.has_key(nevrao):
# Uniquify the channel names
diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index b189bd8..bd94799 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -433,17 +433,24 @@ def get_channels_for_package(pkg):
return map(lambda c: c['label'], ret)
def get_package_for_md5sum(org_id, md5sum):
+ return get_package_for_checksum(org_id, 'md5', md5sum)
+
+def get_package_for_checksum(org_id, checksumtype, checksum):
statement = """
select
p.id
from
- rhnPackage p, rhnChecksum c
+ rhnPackage p,
+ rhnChecksum c,
+ rhnChecksumType ct
where p.org_id = :org_id
and p.checksum_id = c.id
- and c.checksum = :md5sum
+ and c.checksum = :checksum
+ and ct.id = c.checksum_type_id
+ and ct.label = :checksumtype
"""
h = rhnSQL.prepare(statement)
- h.execute(org_id=org_id, md5sum=md5sum)
+ h.execute(org_id=org_id, checksum=checksum, checksumtype=checksumtype)
ret = h.fetchone_dict()
if not ret:
return None
commit 0bcd5ba2131c9d5008cbeb849ca3c28c40a5211d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Nov 13 12:21:03 2009 +0100
these really have to be instance rather than class variables
otherwise we end up e.g. with same checksum for all the packages
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index 65ee7ad..b47d7c8 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -220,17 +220,18 @@ class RepoSync:
class ContentPackage:
- #map of checksums. Valid keys are 'md5sum' & 'sha256'
- checksums = {}
+ def __init__(self):
+ #map of checksums. Valid keys are 'md5sum' & 'sha256'
+ self.checksums = {}
- #unique ID that can be used by plugin
- unique_id = None
-
- name = None
- version = None
- release = None
- epoch = None
- arch = None
+ #unique ID that can be used by plugin
+ self.unique_id = None
+
+ self.name = None
+ self.version = None
+ self.release = None
+ self.epoch = None
+ self.arch = None
def setNVREA(self, name, version, release, epoch, arch):
self.name = name
commit a1ee210410223ef0a039550a36ded887d67cdbd7
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Nov 13 16:30:16 2009 +0100
add docstring
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index a2fca26..0eb3a61 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -360,7 +360,7 @@ class PackageImport(ChannelPackageSubscription):
self.__postprocessSolarisPackage(package)
def __postprocessPackage(self, package):
- # Set the ids
+ """ populate the columns foo_id with id numbers from appropriate hashes """
package['package_group'] = self.groups[package['package_group']]
source_rpm = package['source_rpm']
if source_rpm is not None:
commit bfab43b510c59e8de3030dfedc725fa611cce35d
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Nov 13 14:55:08 2009 +0100
allow configuration file to create new checksum
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/checksum_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/checksum_queries.xml
new file mode 100644
index 0000000..20ac534
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/checksum_queries.xml
@@ -0,0 +1,10 @@
+<datasource_modes>
+
+<!-- Lookup and if not exist, create new one -->
+<callable-mode name="create_new_checksum">
+ <query params="checksum_type_in, checksum_in">
+ {:checksumID = call lookup_checksum( :checksum_type_in, :checksum_in)}
+ </query>
+</callable-mode>
+
+</datasource_modes>
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml
index 91f1c25..f11d706 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/file-list.xml
@@ -2,6 +2,7 @@
<template name="Action_queries" filename="xml/Action_queries.xml" />
<template name="Package_queries" filename="xml/Package_queries.xml" />
<template name="Channel_queries" filename="xml/Channel_queries.xml" />
+ <template name="checksum_queries" filename="xml/checksum_queries.xml" />
<template name="package_search_elaborators" filename="xml/package_search_elaborators.xml" />
<template name="package_search_setbuilder" filename="xml/package_search_setbuilder.xml" />
<template name="config_queries" filename="xml/config_queries.xml" />
diff --git a/java/code/src/com/redhat/rhn/domain/common/Checksum.java b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
index 3f1b5db..fdbed65 100644
--- a/java/code/src/com/redhat/rhn/domain/common/Checksum.java
+++ b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
@@ -16,8 +16,6 @@ package com.redhat.rhn.domain.common;
import com.redhat.rhn.domain.BaseDomainHelper;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
/**
* Checksum
* Class for checksums of files, packages and erratas.
diff --git a/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java b/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
index 626e5e9..b7eacbf 100644
--- a/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
@@ -14,12 +14,16 @@
*/
package com.redhat.rhn.domain.common;
+import com.redhat.rhn.common.db.datasource.CallableMode;
+import com.redhat.rhn.common.db.datasource.ModeFactory;
import com.redhat.rhn.common.hibernate.HibernateFactory;
import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import java.util.HashMap;
+import java.util.Map;
+import java.sql.Types;
/**
* TokenFactory
@@ -31,6 +35,29 @@ public class ChecksumFactory extends HibernateFactory {
private static Logger log = Logger.getLogger(ChecksumFactory.class);
/**
+ * Lookup a checksum by id
+ * @param idIn the checksum to search for
+ * @return the Checksum or null if none match
+ */
+ public static Checksum lookupById(Long idIn) {
+ Session session = null;
+ Checksum c = null;
+ try {
+ session = HibernateFactory.getSession();
+ c = (Checksum) session.getNamedQuery("Checksum.findById")
+ .setParameter("id", idIn)
+ //Retrieve from cache if there
+ .setCacheable(true)
+ .uniqueResult();
+ }
+ catch (HibernateException e) {
+ log.error("Hibernate exception: " + e.toString());
+ throw e;
+ }
+ return c;
+ }
+
+ /**
* Lookup a checksum by its hash
* @param hash the checksum to search for
* @return the Checksum or null if none match
@@ -56,6 +83,32 @@ public class ChecksumFactory extends HibernateFactory {
return c;
}
+ /**
+ * Lookup a checksum type by its label
+ * @param label the checksum type to search for
+ * @return the ChecksumType or null if none match
+ */
+ public static ChecksumType lookupChecksumTypeByLabel(String label) {
+ if (label == null) {
+ return null;
+ }
+ Session session = null;
+ ChecksumType ct = null;
+ try {
+ session = HibernateFactory.getSession();
+ ct = (ChecksumType) session.getNamedQuery("ChecksumType.findByLabel")
+ .setParameter("label", label)
+ //Retrieve from cache if there
+ .setCacheable(true)
+ .uniqueResult();
+ }
+ catch (HibernateException e) {
+ log.error("Hibernate exception: " + e.toString());
+ throw e;
+ }
+ return ct;
+ }
+
/**
* Lookup a checksum and if not exists, it is created.
* @param hash to lookup Checksum for
@@ -67,27 +120,30 @@ public class ChecksumFactory extends HibernateFactory {
return null;
}
- Checksum c = lookupByChecksum(hash);
- if (c == null) {
- // Create new checksum
- c = new Checksum();
- HashMap params = new HashMap();
- params.put("label", hashType);
- c.setChecksum(hash);
- c.setChecksumType((ChecksumType)
- singleton.lookupObjectByNamedQuery("ChecksumType.findByLabel", params));
- save(c);
+ // Lookup existing or create new checksum
+ CallableMode m = ModeFactory.getCallableMode("checksum_queries",
+ "create_new_checksum");
+ Map inParams = new HashMap();
+ Map outParams = new HashMap();
+ inParams.put("checksum_in", hash);
+ inParams.put("checksum_type_in", hashType);
+ //Outparam
+ outParams.put("checksumId", new Integer(Types.NUMERIC));
+ Map result = m.execute(inParams, outParams);
+ Long checksumId = (Long) result.get("checksumId");
+ if (checksumId == null) {
+ throw new IllegalArgumentException(
+ "Unknown checksum type: " + hashType + ")");
}
- return c;
+ return lookupById(checksumId);
}
-
/**
* Saves a checksum to the database
* @param checksumIn The Checksum to save.
*/
public static void save(Checksum checksumIn) {
- singleton.saveObject(checksumIn);
+ safeCreate(checksumIn.getChecksum(), checksumIn.getChecksumType().getLabel());
}
/**
diff --git a/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java b/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java
index cefe220..8162498 100644
--- a/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java
+++ b/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java
@@ -16,8 +16,6 @@ package com.redhat.rhn.domain.common;
import com.redhat.rhn.domain.BaseDomainHelper;
-import org.apache.commons.lang.builder.ToStringBuilder;
-
/**
* ArchType
* @version $Rev$
diff --git a/java/code/src/com/redhat/rhn/domain/common/ChecksumTypeException.java b/java/code/src/com/redhat/rhn/domain/common/ChecksumTypeException.java
new file mode 100644
index 0000000..2caebbe
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/common/ChecksumTypeException.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2009 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+
+package com.redhat.rhn.domain.common;
+
+/**
+ * Indicates ChecksumType is not in database. We probably do not know how to
+ * handle such checkum
+ *
+ */
+public class ChecksumTypeException extends Exception {
+
+
+ /////////////////////////
+ // Constructors
+ /////////////////////////
+ /**
+ * Constructor
+ * @param message exception message
+ */
+ public ChecksumTypeException(String message) {
+ super(message);
+ // begin member variable initialization
+ }
+
+ /**
+ * Constructor
+ * @param message exception message
+ * @param cause the cause (which is saved for later retrieval
+ * by the Throwable.getCause() method). (A null value is
+ * permitted, and indicates that the cause is nonexistent or
+ * unknown.)
+ */
+ public ChecksumTypeException(String message , Throwable cause) {
+ super(message, cause);
+ // begin member variable initialization
+ }
+
+ /////////////////////////
+ // Getters/Setters
+ /////////////////////////
+}
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
index a867c85..95ade44 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
@@ -22,7 +22,6 @@ import com.redhat.rhn.common.hibernate.HibernateFactory;
import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.common.util.MD5Crypt;
import com.redhat.rhn.domain.common.Checksum;
-import com.redhat.rhn.domain.common.ChecksumType;
import com.redhat.rhn.domain.common.ChecksumFactory;
import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.server.Server;
@@ -759,14 +758,7 @@ public class ConfigurationFactory extends HibernateFactory {
}
content.setContents(foo);
- // Create new checksum
- Checksum newChecksum = new Checksum();
- HashMap params = new HashMap();
- params.put("label", "md5");
- newChecksum.setChecksum(MD5Crypt.md5Hex(foo));
- newChecksum.setChecksumType((ChecksumType)
- singleton.lookupObjectByNamedQuery("ChecksumType.findByLabel", params));
- ChecksumFactory.save(newChecksum);
+ Checksum newChecksum = ChecksumFactory.safeCreate(MD5Crypt.md5Hex(foo), "md5");
content.setChecksum(newChecksum);
content.setBinary(isBinary);
return content;
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java b/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
index 5e44f61..0976365 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
@@ -206,7 +206,7 @@ public class PackageDto extends BaseDto {
*
* @param checksumTypeIn The checksumtype to set
*/
- public void setChecksumType(String checksumTypeIn) {
+ public void setChecksumtype(String checksumTypeIn) {
this.checksumType = checksumTypeIn;
}
diff --git a/java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java b/java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java
index 77a810a..37c7738 100644
--- a/java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java
+++ b/java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java
@@ -234,7 +234,6 @@ public class ConfigTestUtils extends Assert {
*/
public static ConfigRevision createConfigRevision(ConfigFile file,
ConfigFileType type) {
-
ConfigInfo info = createConfigInfo();
Long revision = new Long(1);
ConfigContent content = createConfigContent();
commit 767d083d3b936579d28ba2e4f7ee2ce7eff4b394
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Nov 13 14:45:30 2009 +0100
rpmlint - add defattr
address:
spacewalk-java.src:277: E: files-attr-not-set
spacewalk-java.src:280: E: files-attr-not-set
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 2f0b057..3c54009 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -270,13 +270,16 @@ fi
%config %{_sysconfdir}/logrotate.d/rhn_web_api
%files lib
-%attr(644, root, root) %{_datadir}/rhn/classes/log4j.properties
-%attr(644, root, root) %{_datadir}/rhn/lib/rhn.jar
+%defattr(644, root, root)
+%{_datadir}/rhn/classes/log4j.properties
+%{_datadir}/rhn/lib/rhn.jar
%files oracle
+%defattr(644, root, root)
%{jardir}/ojdbc14.jar
%files postgresql
+%defattr(644, root, root)
%{jardir}/postgresql-jdbc.jar
%changelog
commit e190997c2c5447e4167ded4c8ea8117309f784cf
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Nov 12 15:32:14 2009 +0100
return hash and type of has as string as representation of the class
diff --git a/java/code/src/com/redhat/rhn/domain/common/Checksum.java b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
index 282a294..3f1b5db 100644
--- a/java/code/src/com/redhat/rhn/domain/common/Checksum.java
+++ b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
@@ -96,11 +96,6 @@ public class Checksum extends BaseDomainHelper {
/** {@inheritDoc} */
public String toString() {
- ToStringBuilder builder = new ToStringBuilder(this);
-
- builder.append("id", id);
- builder.append("checksum", checksum);
-
- return builder.toString();
+ return checksum;
}
}
diff --git a/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java b/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java
index af74027..cefe220 100644
--- a/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java
+++ b/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java
@@ -95,12 +95,6 @@ public class ChecksumType extends BaseDomainHelper {
/** {@inheritDoc} */
public String toString() {
- ToStringBuilder builder = new ToStringBuilder(this);
-
- builder.append("id", id);
- builder.append("label", label);
- builder.append("description", description);
-
- return builder.toString();
+ return label;
}
}
commit 1f8cf3db768f0ddf9562d2fa9ccda5862347e746
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Nov 12 13:51:19 2009 +0100
fix typo in column name
diff --git a/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml b/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
index 2f5a654..eefc001 100644
--- a/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
@@ -13,7 +13,7 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<many-to-one
name="checksumType"
class="com.redhat.rhn.domain.common.ChecksumType"
- column="checksum_id"/>
+ column="checksum_type_id"/>
</class>
commit f75337d6a06a04529e975af8b3309f18fa974250
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Nov 12 13:42:36 2009 +0100
fix typo in column name
diff --git a/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml b/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml
index b1a8c8e..c3c47e2 100644
--- a/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml
@@ -30,7 +30,7 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<many-to-one name="checksum" class="com.redhat.rhn.domain.common.Checksum"
column="checksum_id" />
<many-to-one name="sigchecksum" class="com.redhat.rhn.domain.common.Checksum"
- column="sigchecksum" />
+ column="sigchecksum_id" />
<many-to-one name="org"
class="com.redhat.rhn.domain.org.OrgImpl"
column="org_id"
commit 3e2ede9e0fe0e03c75a0915293ae5a7d478df736
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Nov 12 12:11:24 2009 +0100
sigchecksum is not property, it is relation
diff --git a/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml b/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml
index af87333..b1a8c8e 100644
--- a/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml
@@ -18,7 +18,6 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<property name="payloadSize" type="long" column="payload_size"/>
<property name="buildHost" type="string" column="build_host"/>
<property name="buildTime" type="date" column="build_time"/>
- <property name="sigmd5" type="string" column="sigmd5"/>
<property name="vendor" type="string" column="vendor"/>
<property name="path" type="string" column="path"/>
<property name="cookie" type="string" column="cookie"/>
@@ -30,6 +29,8 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<many-to-one name="checksum" class="com.redhat.rhn.domain.common.Checksum"
column="checksum_id" />
+ <many-to-one name="sigchecksum" class="com.redhat.rhn.domain.common.Checksum"
+ column="sigchecksum" />
<many-to-one name="org"
class="com.redhat.rhn.domain.org.OrgImpl"
column="org_id"
commit b0f83f7750fce277c446f1bd4205e30469b5ee21
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Nov 12 12:09:42 2009 +0100
fixing typo in method name
diff --git a/java/code/src/com/redhat/rhn/domain/common/Checksum.java b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
index 8c09677..282a294 100644
--- a/java/code/src/com/redhat/rhn/domain/common/Checksum.java
+++ b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
@@ -67,7 +67,7 @@ public class Checksum extends BaseDomainHelper {
/**
* @param checksumTypeIn The checksum type to set.
*/
- public void setChecksumtype(ChecksumType checksumTypeIn) {
+ public void setChecksumType(ChecksumType checksumTypeIn) {
this.checksumType = checksumTypeIn;
}
diff --git a/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java b/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
index 29153b8..626e5e9 100644
--- a/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
@@ -74,7 +74,7 @@ public class ChecksumFactory extends HibernateFactory {
HashMap params = new HashMap();
params.put("label", hashType);
c.setChecksum(hash);
- c.setChecksumtype((ChecksumType)
+ c.setChecksumType((ChecksumType)
singleton.lookupObjectByNamedQuery("ChecksumType.findByLabel", params));
save(c);
}
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
index 09aaa56..a867c85 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
@@ -764,7 +764,7 @@ public class ConfigurationFactory extends HibernateFactory {
HashMap params = new HashMap();
params.put("label", "md5");
newChecksum.setChecksum(MD5Crypt.md5Hex(foo));
- newChecksum.setChecksumtype((ChecksumType)
+ newChecksum.setChecksumType((ChecksumType)
singleton.lookupObjectByNamedQuery("ChecksumType.findByLabel", params));
ChecksumFactory.save(newChecksum);
content.setChecksum(newChecksum);
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/ErrataPackageFile.java b/java/code/src/com/redhat/rhn/frontend/dto/ErrataPackageFile.java
index 32e1d85..9a9f18a 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/ErrataPackageFile.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/ErrataPackageFile.java
@@ -79,7 +79,7 @@ public class ErrataPackageFile {
*
* @param checksumTypeIn The checksumtype to set
*/
- public void setChecksumtype(String checksumTypeIn) {
+ public void setChecksumType(String checksumTypeIn) {
this.checksumType = checksumTypeIn;
}
/**
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java b/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
index 0976365..5e44f61 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
@@ -206,7 +206,7 @@ public class PackageDto extends BaseDto {
*
* @param checksumTypeIn The checksumtype to set
*/
- public void setChecksumtype(String checksumTypeIn) {
+ public void setChecksumType(String checksumTypeIn) {
this.checksumType = checksumTypeIn;
}
commit cbfad9afa0d0d7e8b5f02011928a586ba48e95ae
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Nov 12 12:04:04 2009 +0100
removing bogus column from definition
diff --git a/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml b/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
index 3ca4417..2f5a654 100644
--- a/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
@@ -10,7 +10,6 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<generator class="assigned" />
</id>
<property name="checksum" type="string" column="checksum" />
- <property name="description" type="string" column="description" />
<many-to-one
name="checksumType"
class="com.redhat.rhn.domain.common.ChecksumType"
commit 33324241c43363fc33d89529c792c0648ef1839d
Merge: 47e57bd... 9674945...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 12 13:10:09 2009 +0100
Merge branch 'master' into sha256-support3
Conflicts:
backend/satellite_exporter/exporter/exportLib.py
backend/satellite_tools/exporter/exportLib.py
diff --cc backend/satellite_tools/exporter/exportLib.py
index d2000d4,133cfe0..56eede5
--- a/backend/satellite_tools/exporter/exportLib.py
+++ b/backend/satellite_tools/exporter/exportLib.py
@@@ -651,10 -697,11 +701,11 @@@ class ShortPackagesDumper(BaseDumper)
pe.evr.release release,
pe.evr.epoch epoch,
pa.label package_arch,
- p.md5sum,
+ c.checksum md5sum,
+ p.org_id,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa
+ rhnPackageArch pa, rhnChecksum c
where p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
commit 47e57bd13b7f7f51ec61c54dc6899afd3a12542c
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Nov 12 10:52:04 2009 +0100
let use jsp pages new Checksum attributes
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/add_details.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/add_details.jspf
index a3727de..f65110b 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/add_details.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/configuration/files/add_details.jspf
@@ -6,7 +6,7 @@
</tr>
<tr>
<th><bean:message key="filedetails.add_details.jspf.md5" /></th>
- <td>${revision.configContent.md5sum}</td>
+ <td>${revision.configContent.checksum}</td>
</tr>
<c:if test="${!revision.configContent.binary && !revision.directory}">
<tr>
diff --git a/java/code/webapp/WEB-INF/pages/errata/erratapackages.jsp b/java/code/webapp/WEB-INF/pages/errata/erratapackages.jsp
index 69b42b3..e558316 100644
--- a/java/code/webapp/WEB-INF/pages/errata/erratapackages.jsp
+++ b/java/code/webapp/WEB-INF/pages/errata/erratapackages.jsp
@@ -28,7 +28,7 @@
</c:if>
<c:forEach items="${current.packages}" var="pack">
- <tt>${pack.md5sum}</tt>
+ <tt>${pack.checksum}</tt>
<a href="/rhn/software/packages/Details.do?pid=${pack.id}">
<c:out value="${pack.name}"/>
</a>
diff --git a/java/code/webapp/WEB-INF/pages/rhnpackage/packagedetail.jsp b/java/code/webapp/WEB-INF/pages/rhnpackage/packagedetail.jsp
index 5e2e357..911ec0c 100644
--- a/java/code/webapp/WEB-INF/pages/rhnpackage/packagedetail.jsp
+++ b/java/code/webapp/WEB-INF/pages/rhnpackage/packagedetail.jsp
@@ -58,7 +58,7 @@
<tr>
<th><bean:message key="package.jsp.md5sum"/>:</th>
- <td><c:out value="${pack.md5sum}" /></td>
+ <td><c:out value="${pack.checksum}" /></td>
</tr>
<tr>
commit 2c2ede9602fcba8b5e289403e6c2f0543bd9fffa
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Nov 12 10:44:52 2009 +0100
let Config clasess use new Checksum class
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigContent.hbm.xml b/java/code/src/com/redhat/rhn/domain/config/ConfigContent.hbm.xml
index b14e749..d439b81 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigContent.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigContent.hbm.xml
@@ -13,9 +13,10 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
</id>
<property name="contentsBlob" column="contents" type="blob" />
<property name="fileSize" column="file_size" type="long" />
- <property name="md5sum" column="md5sum" type="string" length="64" />
<property name="binary" column="is_binary" type="yes_no" />
<property name="created" column="created" type="timestamp" />
<property name="modified" column="modified" type="timestamp" />
+ <many-to-one name="checksum" class="com.redhat.rhn.domain.common.Checksum"
+ column="checksum_id" />
</class>
</hibernate-mapping>
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigContent.java b/java/code/src/com/redhat/rhn/domain/config/ConfigContent.java
index b2c8700..248cb14 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigContent.java
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigContent.java
@@ -14,6 +14,7 @@
*/
package com.redhat.rhn.domain.config;
+import com.redhat.rhn.domain.common.Checksum;
import com.redhat.rhn.common.hibernate.HibernateFactory;
import com.redhat.rhn.domain.BaseDomainHelper;
@@ -27,7 +28,7 @@ public class ConfigContent extends BaseDomainHelper {
private Long id;
private Long fileSize;
- private String md5sum;
+ private Checksum checksum;
private boolean isBinary;
private Blob contentsBlob;
/**
@@ -112,19 +113,19 @@ public class ConfigContent extends BaseDomainHelper {
}
/**
- * Getter for md5sum
+ * Getter for checksum
* @return String to get
*/
- public String getMd5sum() {
- return this.md5sum;
+ public Checksum getChecksum() {
+ return this.checksum;
}
/**
- * Setter for md5sum
- * @param md5sumIn to set
+ * Setter for checksum
+ * @param checksumIn to set
*/
- public void setMd5sum(String md5sumIn) {
- this.md5sum = md5sumIn;
+ public void setChecksum(Checksum checksumIn) {
+ this.checksum = checksumIn;
}
/**
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
index c20a891..09aaa56 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigurationFactory.java
@@ -21,6 +21,9 @@ import com.redhat.rhn.common.db.datasource.SelectMode;
import com.redhat.rhn.common.hibernate.HibernateFactory;
import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.common.util.MD5Crypt;
+import com.redhat.rhn.domain.common.Checksum;
+import com.redhat.rhn.domain.common.ChecksumType;
+import com.redhat.rhn.domain.common.ChecksumFactory;
import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.server.Server;
import com.redhat.rhn.domain.user.User;
@@ -756,7 +759,15 @@ public class ConfigurationFactory extends HibernateFactory {
}
content.setContents(foo);
- content.setMd5sum(MD5Crypt.md5Hex(foo));
+ // Create new checksum
+ Checksum newChecksum = new Checksum();
+ HashMap params = new HashMap();
+ params.put("label", "md5");
+ newChecksum.setChecksum(MD5Crypt.md5Hex(foo));
+ newChecksum.setChecksumtype((ChecksumType)
+ singleton.lookupObjectByNamedQuery("ChecksumType.findByLabel", params));
+ ChecksumFactory.save(newChecksum);
+ content.setChecksum(newChecksum);
content.setBinary(isBinary);
return content;
}
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
index d8b755e..2109618 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
@@ -113,7 +113,7 @@ public class ConfigRevisionSerializer implements XmlRpcCustomSerializer {
if (!rev.getConfigContent().isBinary()) {
helper.add(CONTENTS, rev.getConfigContent().getContentsString());
}
- helper.add("md5", rev.getConfigContent().getMd5sum());
+ helper.add("md5", rev.getConfigContent().getChecksum().getChecksum());
helper.add(MACRO_START, rev.getDelimStart());
helper.add(MACRO_END, rev.getDelimEnd());
}
diff --git a/java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java b/java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java
index f547dd8..77a810a 100644
--- a/java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java
+++ b/java/code/src/com/redhat/rhn/testing/ConfigTestUtils.java
@@ -23,6 +23,7 @@ import com.redhat.rhn.domain.config.ConfigFileType;
import com.redhat.rhn.domain.config.ConfigInfo;
import com.redhat.rhn.domain.config.ConfigRevision;
import com.redhat.rhn.domain.config.ConfigurationFactory;
+import com.redhat.rhn.domain.common.ChecksumFactory;
import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.server.Server;
import com.redhat.rhn.domain.server.ServerConstants;
@@ -279,7 +280,8 @@ public class ConfigTestUtils extends Assert {
*/
public static ConfigContent createConfigContent(Long fileSize, boolean isBinary) {
ConfigContent cc = ConfigurationFactory.newConfigContent();
- cc.setMd5sum("d41d8cd98f00b204e9800998ecf8427e");
+ cc.setChecksum(ChecksumFactory.safeCreate(
+ "d41d8cd98f00b204e9800998ecf8427e", "md5"));
cc.setContents(new byte[0]);
cc.setFileSize(fileSize);
cc.setBinary(isBinary);
commit 09bd421248517b37141eefcb3532b18185aadbe4
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Nov 12 10:44:27 2009 +0100
let repomd use new Checksum class
diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java
index 93fd852..9594bd9 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java
@@ -186,7 +186,7 @@ public class PrimaryXmlWriter extends RepomdWriter {
attr.addAttribute("type", "md5");
attr.addAttribute("pkgid", "YES");
handler.startElement("checksum", attr);
- handler.addCharacters(sanitize(pkgId, pkgDto.getMd5sum()));
+ handler.addCharacters(sanitize(pkgId, pkgDto.getChecksum()));
handler.endElement("checksum");
handler.addElementWithCharacters("summary", sanitize(pkgId, pkgDto
diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/RepomdWriter.java b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/RepomdWriter.java
index a60c2c8..65fd91b 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/RepomdWriter.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/RepomdWriter.java
@@ -102,7 +102,7 @@ public abstract class RepomdWriter {
PackageDto pkgDto) throws SAXException {
long pkgId = pkgDto.getId().longValue();
SimpleAttributesImpl attr = new SimpleAttributesImpl();
- attr.addAttribute("pkgid", sanitize(pkgId, pkgDto.getMd5sum()));
+ attr.addAttribute("pkgid", sanitize(pkgId, pkgDto.getChecksum()));
attr.addAttribute("name", sanitize(pkgId, pkgDto.getName()));
attr.addAttribute("arch", sanitize(pkgId, pkgDto.getArchLabel()));
handler.startElement("package", attr);
diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/UpdateInfoWriter.java b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/UpdateInfoWriter.java
index 2da38b7..572015c 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/UpdateInfoWriter.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/UpdateInfoWriter.java
@@ -181,7 +181,7 @@ public class UpdateInfoWriter extends RepomdWriter {
attr.clear();
attr.addAttribute("type", "md5");
handler.startElement("sum", attr);
- handler.addCharacters(sanitize(pkgId, pkg.getMd5sum()));
+ handler.addCharacters(sanitize(pkgId, pkg.getChecksum().getChecksum()));
handler.endElement("sum");
handler.endElement("package");
commit f1548c6ed0988e57212d15916972e248db10a0dd
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Nov 12 10:42:00 2009 +0100
fix build and checkstyle errors in Checksums classes
diff --git a/java/code/src/com/redhat/rhn/domain/common/Checksum.java b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
index bfb9ed4..8c09677 100644
--- a/java/code/src/com/redhat/rhn/domain/common/Checksum.java
+++ b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
@@ -67,7 +67,7 @@ public class Checksum extends BaseDomainHelper {
/**
* @param checksumTypeIn The checksum type to set.
*/
- public void setDescription(ChecksumType checksumTypeIn) {
+ public void setChecksumtype(ChecksumType checksumTypeIn) {
this.checksumType = checksumTypeIn;
}
diff --git a/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java b/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
index 237f4e7..29153b8 100644
--- a/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
@@ -15,12 +15,11 @@
package com.redhat.rhn.domain.common;
import com.redhat.rhn.common.hibernate.HibernateFactory;
-import com.redhat.rhn.common.hibernate.LookupException;
-import com.redhat.rhn.common.localization.LocalizationService;
import org.apache.log4j.Logger;
import org.hibernate.HibernateException;
import org.hibernate.Session;
+import java.util.HashMap;
/**
* TokenFactory
@@ -68,16 +67,16 @@ public class ChecksumFactory extends HibernateFactory {
return null;
}
- Checksum c = this.lookupByChecksum(hash)
+ Checksum c = lookupByChecksum(hash);
if (c == null) {
// Create new checksum
c = new Checksum();
HashMap params = new HashMap();
params.put("label", hashType);
- c.setChecksum(hash)
- c.setChecksumType((ChecksumType)
- singleton.lookupObjectByNamedQuery("ChecksumType.findByLabel", params))
- this.save(c);
+ c.setChecksum(hash);
+ c.setChecksumtype((ChecksumType)
+ singleton.lookupObjectByNamedQuery("ChecksumType.findByLabel", params));
+ save(c);
}
return c;
}
@@ -87,7 +86,7 @@ public class ChecksumFactory extends HibernateFactory {
* Saves a checksum to the database
* @param checksumIn The Checksum to save.
*/
- public static void save(Checksum ChecksumIn) {
+ public static void save(Checksum checksumIn) {
singleton.saveObject(checksumIn);
}
diff --git a/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java b/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java
index 08136ff..38055e4 100644
--- a/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java
@@ -286,7 +286,7 @@ public class ErrataFactory extends HibernateFactory {
//Now create the appropriate ErrataFile object
ErrataFile publishedFile = ErrataFactory.createPublishedErrataFile(
ErrataFactory.lookupErrataFileType("RPM"),
- pack.getMd5sum(), pack.getNameEvra());
+ pack.getChecksum().getChecksum(), pack.getNameEvra());
publishedFile.addPackage(pack);
publishedFile.setErrata(errata);
publishedFile.setModified(new Date());
diff --git a/java/code/src/com/redhat/rhn/domain/rhnpackage/test/PackageTest.java b/java/code/src/com/redhat/rhn/domain/rhnpackage/test/PackageTest.java
index 8d7037a..5e656ea 100644
--- a/java/code/src/com/redhat/rhn/domain/rhnpackage/test/PackageTest.java
+++ b/java/code/src/com/redhat/rhn/domain/rhnpackage/test/PackageTest.java
@@ -19,6 +19,7 @@ import com.redhat.rhn.common.db.datasource.WriteMode;
import com.redhat.rhn.common.hibernate.HibernateFactory;
import com.redhat.rhn.common.util.MD5Crypt;
import com.redhat.rhn.domain.channel.Channel;
+import com.redhat.rhn.domain.common.ChecksumFactory;
import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.org.OrgFactory;
import com.redhat.rhn.domain.rhnpackage.ChangeLogEntry;
@@ -130,7 +131,8 @@ public class PackageTest extends RhnBaseTestCase {
p.setPayloadSize(new Long(42));
p.setBuildHost("foo2");
p.setBuildTime(new Date());
- p.setMd5sum(MD5Crypt.crypt(TestUtils.randomString()));
+ p.setChecksum(ChecksumFactory.safeCreate(
+ MD5Crypt.crypt(TestUtils.randomString()), "md5"));
p.setVendor("Rhn-Java");
p.setPayloadFormat("testpayloadformat");
p.setCompat(new Long(0));
@@ -186,14 +188,14 @@ public class PackageTest extends RhnBaseTestCase {
source.setBuildTime(date);
source.setCookie(string);
source.setCreated(date);
- source.setMd5sum(string);
+ source.setChecksum(ChecksumFactory.safeCreate(string, "md5"));
source.setOrg(org);
source.setPackageGroup(PackageGroupTest.createTestPackageGroup());
source.setPackageSize(343L);
source.setPath(string);
source.setPayloadSize(343L);
source.setRpmVersion(string);
- source.setSigmd5(string);
+ source.setSigchecksum(ChecksumFactory.safeCreate(string, "md5"));
source.setSourceRpm(rpm);
source.setVendor(string);
}
commit 0149555286932d101a2e006ae61308db9fe6b742
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Nov 10 17:26:06 2009 +0100
remove saveChecksum from CommonFactory, it is in new class ChecksumFactory
diff --git a/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java b/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java
index 3a32587..959e7fd 100644
--- a/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java
@@ -56,15 +56,6 @@ public class CommonFactory extends HibernateFactory {
}
/**
- * Save a Checksum to the DB.
- *
- * @param checksumIn Checksum to save
- */
- public static void saveChecksum(Checksum checksumIn) {
- singleton.saveObject(checksumIn);
- }
-
- /**
* Save a FileList to the DB.
*
* @param fIn FileList to save
commit c1838d7e251711109d3023f315c29044e504a45b
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Nov 10 17:24:30 2009 +0100
create ChecksumFactory class
diff --git a/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java b/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
new file mode 100644
index 0000000..237f4e7
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/common/ChecksumFactory.java
@@ -0,0 +1,110 @@
+/**
+ * Copyright (c) 2009 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.domain.common;
+
+import com.redhat.rhn.common.hibernate.HibernateFactory;
+import com.redhat.rhn.common.hibernate.LookupException;
+import com.redhat.rhn.common.localization.LocalizationService;
+
+import org.apache.log4j.Logger;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+
+/**
+ * TokenFactory
+ * @version $Rev$
+ */
+public class ChecksumFactory extends HibernateFactory {
+
+ private static ChecksumFactory singleton = new ChecksumFactory();
+ private static Logger log = Logger.getLogger(ChecksumFactory.class);
+
+ /**
+ * Lookup a checksum by its hash
+ * @param hash the checksum to search for
+ * @return the Checksum or null if none match
+ */
+ public static Checksum lookupByChecksum(String hash) {
+ if (hash == null) {
+ return null;
+ }
+ Session session = null;
+ Checksum c = null;
+ try {
+ session = HibernateFactory.getSession();
+ c = (Checksum) session.getNamedQuery("Checksum.findByChecksum")
+ .setParameter("checksum", hash)
+ //Retrieve from cache if there
+ .setCacheable(true)
+ .uniqueResult();
+ }
+ catch (HibernateException e) {
+ log.error("Hibernate exception: " + e.toString());
+ throw e;
+ }
+ return c;
+ }
+
+ /**
+ * Lookup a checksum and if not exists, it is created.
+ * @param hash to lookup Checksum for
+ * @param hashType to lookup Checksum for
+ * @return Checksum
+ */
+ public static Checksum safeCreate(String hash, String hashType) {
+ if (hash == null || hashType == null) {
+ return null;
+ }
+
+ Checksum c = this.lookupByChecksum(hash)
+ if (c == null) {
+ // Create new checksum
+ c = new Checksum();
+ HashMap params = new HashMap();
+ params.put("label", hashType);
+ c.setChecksum(hash)
+ c.setChecksumType((ChecksumType)
+ singleton.lookupObjectByNamedQuery("ChecksumType.findByLabel", params))
+ this.save(c);
+ }
+ return c;
+ }
+
+
+ /**
+ * Saves a checksum to the database
+ * @param checksumIn The Checksum to save.
+ */
+ public static void save(Checksum ChecksumIn) {
+ singleton.saveObject(checksumIn);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected Logger getLogger() {
+ return log;
+ }
+
+ /**
+ * Delete a checksum
+ * @param checksum to delete
+ */
+ public static void removeChecksum(Checksum checksum) {
+ singleton.removeObject(checksum);
+
+ }
+
+}
commit 9adf8731e0fd5e64bacb93a8685d0617f68d9476
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Tue Nov 10 17:24:37 2009 +0100
making java changes compilable and checkstyle compliant
diff --git a/java/code/src/com/redhat/rhn/domain/common/Checksum.java b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
index b17ff61..bfb9ed4 100644
--- a/java/code/src/com/redhat/rhn/domain/common/Checksum.java
+++ b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
@@ -15,7 +15,6 @@
package com.redhat.rhn.domain.common;
import com.redhat.rhn.domain.BaseDomainHelper;
-import com.redhat.rhn.domain.common.ChecksumType;
import org.apache.commons.lang.builder.ToStringBuilder;
@@ -61,7 +60,7 @@ public class Checksum extends BaseDomainHelper {
/**
* @return Returns the type of checksum.
*/
- public String getChecksumType() {
+ public ChecksumType getChecksumType() {
return checksumType;
}
@@ -81,9 +80,9 @@ public class Checksum extends BaseDomainHelper {
return false;
}
- Checksum checksum = (Checksum) o;
+ Checksum other = (Checksum) o;
- if (id != null ? !id.equals(checksum.id) : checksum.id != null) {
+ if (id != null ? !id.equals(other.id) : other.id != null) {
return false;
}
diff --git a/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java b/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java
index ff3e2a4..3a32587 100644
--- a/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java
@@ -16,7 +16,6 @@ package com.redhat.rhn.domain.common;
import com.redhat.rhn.common.conf.Config;
import com.redhat.rhn.common.hibernate.HibernateFactory;
-import com.redhat.rhn.domain.common.Checksum;
import com.redhat.rhn.domain.org.Org;
import org.apache.commons.codec.binary.Hex;
diff --git a/java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java b/java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java
index 3ac9212..6852052 100644
--- a/java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java
+++ b/java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java
@@ -257,14 +257,14 @@ public class Package extends BaseDomainHelper {
/**
* @return Returns the checksum.
*/
- public String getChecksum() {
+ public Checksum getChecksum() {
return checksum;
}
/**
* @param checksumIn The checksum to set.
*/
- public void setChecksum(String checksumIn) {
+ public void setChecksum(Checksum checksumIn) {
this.checksum = checksumIn;
}
diff --git a/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.java b/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.java
index 967b15b..0138972 100644
--- a/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.java
+++ b/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.java
@@ -49,7 +49,7 @@ public class PackageSource extends BaseDomainHelper {
/**
* @return Returns the sig checksum.
*/
- public String getSigchecksum() {
+ public Checksum getSigchecksum() {
return sigchecksum;
}
@@ -147,7 +147,7 @@ public class PackageSource extends BaseDomainHelper {
/**
* @return Returns the checksum.
*/
- public String getChecksum() {
+ public Checksum getChecksum() {
return checksum;
}
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java b/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
index e95b2f3..0976365 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
@@ -31,7 +31,7 @@ public class PackageDto extends BaseDto {
private String epoch;
private String archLabel;
private String checksum;
- private String checksumType
+ private String checksumType;
private Long cid;
private String channelName;
private String summary;
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackageHelper.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackageHelper.java
index 2bfe4d4..c09dfcd 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackageHelper.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackageHelper.java
@@ -95,7 +95,8 @@ public class PackageHelper {
addEntry(pkgMap, "checksum",
StringUtils.defaultString(pkg.getChecksum().getChecksum()));
addEntry(pkgMap, "checksum_type",
- StringUtils.defaultString(pkg.getChecksum().getChecksumType().getLabel()));
+ StringUtils.defaultString(
+ pkg.getChecksum().getChecksumType().getLabel()));
addEntry(pkgMap, "vendor",
StringUtils.defaultString(pkg.getVendor()));
addEntry(pkgMap, "summary",
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackagesHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackagesHandler.java
index 61a0bee..e4b7c05 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackagesHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackagesHandler.java
@@ -218,7 +218,8 @@ public class PackagesHandler extends BaseHandler {
row.put("size", file.get("file_size"));
row.put("linkto", StringUtils.defaultString((String) file.get("linkto")));
row.put("checksum", StringUtils.defaultString((String) file.get("checksum")));
- row.put("checksum_type", StringUtils.defaultString((String) file.get("checksumtype")));
+ row.put("checksum_type", StringUtils.defaultString(
+ (String) file.get("checksumtype")));
// Determine the file_type
if (file.get("checksum") != null) {
commit 8a891534513da68e62d340a8be6b2732f98070e9
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Nov 10 14:47:13 2009 +0100
allow Checksum to be created and saved
diff --git a/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml b/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
index 17cbb08..3ca4417 100644
--- a/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
@@ -5,7 +5,6 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<hibernate-mapping>
<class name="com.redhat.rhn.domain.common.Checksum"
table="rhnChecksum" mutable="false">
- <cache usage="read-only"/>
<id name="id" type="long" column="id">
<meta attribute="scope-set">protected</meta>
<generator class="assigned" />
diff --git a/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java b/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java
index 959e7fd..ff3e2a4 100644
--- a/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/common/CommonFactory.java
@@ -16,6 +16,7 @@ package com.redhat.rhn.domain.common;
import com.redhat.rhn.common.conf.Config;
import com.redhat.rhn.common.hibernate.HibernateFactory;
+import com.redhat.rhn.domain.common.Checksum;
import com.redhat.rhn.domain.org.Org;
import org.apache.commons.codec.binary.Hex;
@@ -56,6 +57,15 @@ public class CommonFactory extends HibernateFactory {
}
/**
+ * Save a Checksum to the DB.
+ *
+ * @param checksumIn Checksum to save
+ */
+ public static void saveChecksum(Checksum checksumIn) {
+ singleton.saveObject(checksumIn);
+ }
+
+ /**
* Save a FileList to the DB.
*
* @param fIn FileList to save
commit 3e416d31d36c86876fcbfef9bddc78dbd47e7332
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Nov 10 13:44:41 2009 +0100
code clenup - query package_files is defined in Package_queries.xml and code use query from that file
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/General_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/General_queries.xml
index 6661e89..a103629 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/General_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/General_queries.xml
@@ -1,19 +1,5 @@
<datasource_modes>
-<mode name="package_files">
- <query params="pid">
-SELECT C.name,
- F.file_size,
- F.md5, F.file_mode,
- F.linkto,
- TO_CHAR(F.mtime, 'YYYY-MM-DD HH24:MI:SS') AS MTIME
- FROM rhnPackageFile F, rhnPackageCapability C
- WHERE F.package_id = :pid
- AND F.capability_id = C.id
-ORDER BY UPPER(C.name)
- </query>
-</mode>
-
<mode name="kickstarts_for_org" class="com.redhat.rhn.frontend.dto.kickstart.KickstartDto">
<query params="org_id">
SELECT KS.id, KS.org_id, KS.label, KS.is_org_default,
commit 3b29777cbac08312e9acba4ba8d905e82df93b12
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Nov 10 13:43:07 2009 +0100
code cleanup - query selected_configfiles is not used anywhere in code
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
index e964f2f..d2edaad 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
@@ -644,38 +644,6 @@ SELECT S.id, S.name, count(DISTINCT CF.config_file_name_id) AS config_file_coun
</query>
</mode>
-<mode name="selected_configfiles">
- <query params="set_label, user_id">
-SELECT CR.id,
- CCon.md5sum,
- CFN.path,
- CR.revision,
- NVL2((SELECT 1 FROM rhnConfigFile CFt WHERE CFT.latest_config_revision_id = CR.id), 'Y', 'N') LATEST,
- TO_CHAR(CCon.created, 'YYYY-MM-DD HH24:MI:SS') AS CREATED,
- CASE CCT.label WHEN 'local_override' THEN '(system override)' ELSE CC.name END AS CONFIG_CHANNEL_NAME,
- CC.label AS CONFIG_CHANNEL_LABEL,
- CC.id AS CONFIG_CHANNEL_ID
- FROM rhnConfigChannelType CCT,
- rhnConfigChannel CC,
- rhnConfigFileName CFN,
- rhnConfigFile CF,
- rhnConfigContent CCon,
- rhnConfigRevision CR,
- rhnSet S
- WHERE S.user_id = :user_id
- AND S.label = :set_label
- AND S.element = CR.id
- AND CR.config_file_id = CF.id
- AND CF.config_channel_id = CC.id
- AND CC.confchan_type_id = CCT.id
- AND CCon.id = CR.config_content_id
- AND CCT.label IN ('normal', 'local_override')
- AND CFN.id = CF.config_file_name_id
- AND rhn_config_channel.get_user_chan_access(CC.id, :user_id) = 1
-ORDER BY CFN.path
- </query>
-</mode>
-
<mode name="global_configfiles_for_user" class="com.redhat.rhn.frontend.dto.ConfigFileDto">
<query params="org_id, user_id">
SELECT CF.id, CFN.path
commit e45c9e5b860e4d8a20c3da3110aa45433030f7e8
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Nov 10 13:34:10 2009 +0100
replace md5sum with generic checksum in Package and Errata classes
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
index a70d6f0..5806da0 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
@@ -206,7 +206,7 @@ ORDER BY MIN(ordering)
<query params="channel_label, download_type, org_id" >
SELECT RD.name AS DOWNLOAD_NAME,
RF.path AS DOWNLOAD_PATH,
- RF.md5sum AS DOWNLOAD_CHECKSUM,
+ CS.checksum AS DOWNLOAD_CHECKSUM,
RF.file_size AS DOWNLOAD_SIZE,
RF.id AS FILE_ID,
RF.id AS ID, -- for datasource, needs ID for elaborator
@@ -216,7 +216,8 @@ SELECT RD.name AS DOWNLOAD_NAME,
rhnDownloadType DT,
rhnAvailableChannels AC,
rhnChannelDownloads CD,
- rhnChannel C
+ rhnChannel C,
+ rhnChecksum CS
WHERE AC.org_id = :org_id
AND RD.id = CD.downloads_id
AND CD.channel_id = C.id
@@ -225,6 +226,7 @@ SELECT RD.name AS DOWNLOAD_NAME,
AND DT.id = RD.download_type
AND DT.label = :download_type
AND RF.id = RD.file_id
+ AND RF.checksum_id = CS.id
ORDER BY RD.ordering
</query>
<elaborator multiple="t">
@@ -263,17 +265,18 @@ ORDER BY MIN(ordering)
SELECT DISTINCT RF.id AS ID,
RD.name AS DOWNLOAD_NAME,
RF.path AS DOWNLOAD_PATH,
- RF.md5sum AS DOWNLOAD_CHECKSUM,
+ CS.checksum AS DOWNLOAD_CHECKSUM,
RF.file_size AS DOWNLOAD_SIZE,
- RF.id AS FILE_ID,
+ RF.id AS FILE_ID,
RD.category AS CATEGORY,
- RD.ordering AS ORDERING
+ RD.ordering AS ORDERING
FROM rhnFile RF,
rhnDownloads RD,
rhnDownloadType DT,
rhnChannelDownloads CD,
- rhnAvailableChannels AC,
- rhnChannel C
+ rhnAvailableChannels AC,
+ rhnChannel C,
+ rhnChecksum CS
WHERE AC.org_id = :org_id
AND C.id = AC.channel_id
AND C.label = :channel_label
@@ -282,6 +285,7 @@ SELECT DISTINCT RF.id AS ID,
AND DT.id = RD.download_type
AND DT.label = :download_type
AND RF.id = RD.file_id
+ AND RF.checksum_id = CS.id
ORDER BY RD.ordering
</query>
<elaborator multiple="t">
@@ -1143,7 +1147,7 @@ GROUP BY C.id, C.name
<mode name="channel_errata_packages" class="com.redhat.rhn.frontend.dto.PackageDto">
<query params="eid, cid">
- SELECT P.id, P.md5sum,
+ SELECT P.id, CS.checksum, CST.label checksumtype,
PN.name || '-' || PE.version
|| '-' || PE.release || (CASE WHEN PE.epoch IS NULL THEN '' ELSE ':' || PE.epoch END)
|| '-' || PA.label name
@@ -1152,7 +1156,9 @@ GROUP BY C.id, C.name
rhnErrataPackage EP on EP.package_id = CP.package_id inner join
rhnPackageName PN on P.name_id = PN.id inner join
rhnPackageEvr PE on P.evr_id = PE.id inner join
- rhnPackageArch PA on P.package_arch_id = PA.id
+ rhnPackageArch PA on P.package_arch_id = PA.id inner join
+ rhnChecksum CS on P.checksum_id = CS.id inner join
+ rhnChecksumType CST on CS.checksum_type_id = CST.id
where CP.channel_id = :cid
and EP.errata_id = :eid
ORDER by name
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
index 2c7696f..45c248f 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
@@ -1102,18 +1102,23 @@ ORDER BY UPPER(EK.keyword)
<mode name="errata_packages" class="com.redhat.rhn.frontend.dto.ErrataPackageFile">
<query params="eid, org_id">
SELECT DISTINCT EFP.package_id,
- EF.md5sum,
+ CS.checksum,
+ CST.label AS CHECKSUMTYPE,
EF.filename AS FILENAME,
C.name AS CHANNEL_NAME
FROM rhnChannel C,
rhnErrataFilePackage EFP,
rhnErrataFileChannel EFC,
- rhnErrataFile EF
+ rhnErrataFile EF,
+ rhnChecksum CS,
+ rhnChecksumType CST
WHERE EF.errata_id = :eid
AND EF.id = EFC.errata_file_id (+)
AND EF.id = EFP.errata_file_id (+)
AND EFC.channel_id IN (SELECT AC.channel_id FROM rhnAvailableChannels AC WHERE AC.org_id = :org_id)
AND EFC.channel_id = C.id
+ AND EF.checksum_id = CS.id
+ AND CS.checksum_type_id = CST.id
ORDER BY C.name, EF.filename DESC
</query>
</mode>
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml
index 2820e0b..7b68962 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Package_queries.xml
@@ -86,13 +86,17 @@ ORDER BY UPPER(C.name), C.version
<query params="pid">
SELECT C.name,
F.file_size,
- F.md5,
+ CS.checksum,
+ CST.label checksumtype,
F.file_mode,
F.linkto,
TO_CHAR(F.mtime, 'YYYY-MM-DD HH24:MI:SS') AS MTIME
- FROM rhnPackageFile F, rhnPackageCapability C
+ FROM rhnPackageFile F, rhnPackageCapability C,
+ rhnChecksum CS, rhnChecksumType CST
WHERE F.package_id = :pid
AND F.capability_id = C.id
+ AND F.checksum_id = CS.id
+ AND CS.checksum_type_id = CST.id
ORDER BY UPPER(C.name)
</query>
</mode>
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
index a293d7b..cffddc0 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
@@ -555,9 +555,10 @@ FROM
SELECT /*+ ORDERED */ p.id, pn.name as name, pevr.epoch as epoch,
pevr.version as version, pevr.release as release,
p.summary, p.description, pa.label as arch_label,
- p.md5sum, p.build_time, p.path, p.package_size, p.payload_size,
+ p.build_time, p.path, p.package_size, p.payload_size,
p.copyright, p.vendor, p.build_host, p.header_start, p.header_end,
- srpm.name as source_rpm, pg.name as package_group_name
+ srpm.name as source_rpm, pg.name as package_group_name,
+ cs.checksum, cst.label as checksumtype
FROM
rhnChannelPackage cp,
rhnPackage p
@@ -565,13 +566,17 @@ FROM
LEFT OUTER JOIN rhnSourceRpm srpm ON p.source_rpm_id = srpm.id,
rhnPackageName pn,
rhnPackageEvr pevr,
- rhnPackageArch pa
+ rhnPackageArch pa,
+ rhnChecksum cs,
+ rhnChecksumType cst
WHERE
cp.package_id = p.id
AND p.name_id = pn.id
AND p.evr_id = pevr.id
AND p.package_arch_id = pa.id
AND cp.channel_id = :channel_id
+ AND p.checksum_id = cs.id
+ AND cs.checksum_type_id = cst.id
ORDER by 1
</query>
</mode>
diff --git a/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java b/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java
index 3e41435..af74027 100644
--- a/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java
+++ b/java/code/src/com/redhat/rhn/domain/common/ChecksumType.java
@@ -99,6 +99,7 @@ public class ChecksumType extends BaseDomainHelper {
builder.append("id", id);
builder.append("label", label);
+ builder.append("description", description);
return builder.toString();
}
diff --git a/java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrataFile.hbm.xml b/java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrataFile.hbm.xml
index 1a19b74..d2e7db5 100644
--- a/java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrataFile.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/errata/impl/PublishedErrataFile.hbm.xml
@@ -10,7 +10,8 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<param name="sequence">RHN_ERRATAFILE_ID_SEQ</param>
</generator>
</id>
- <property name="checksum" type="string" length="64" column="md5sum" />
+ <many-to-one name="checksum" class="com.redhat.rhn.domain.common.Checksum"
+ column="checksum_id" />
<property name="fileName" type="string" length="1024" />
<property name="created" column="created" type="timestamp"
insert="false" update="false"/>
diff --git a/java/code/src/com/redhat/rhn/domain/errata/impl/UnpublishedErrataFile.hbm.xml b/java/code/src/com/redhat/rhn/domain/errata/impl/UnpublishedErrataFile.hbm.xml
index 881eea4..c9f9663 100644
--- a/java/code/src/com/redhat/rhn/domain/errata/impl/UnpublishedErrataFile.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/errata/impl/UnpublishedErrataFile.hbm.xml
@@ -10,7 +10,8 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<param name="sequence">RHN_ERRATAFILE_ID_SEQ</param>
</generator>
</id>
- <property name="checksum" type="string" length="64" column="md5sum" />
+ <many-to-one name="checksum" class="com.redhat.rhn.domain.common.Checksum"
+ column="checksum_id" />
<property name="fileName" type="string" length="1024" />
<property name="created" column="created" type="timestamp"
insert="false" update="false"/>
diff --git a/java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java b/java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java
index feb20bd..3ac9212 100644
--- a/java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java
+++ b/java/code/src/com/redhat/rhn/domain/rhnpackage/Package.java
@@ -26,6 +26,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
import com.redhat.rhn.common.util.StringUtil;
import com.redhat.rhn.domain.BaseDomainHelper;
import com.redhat.rhn.domain.channel.Channel;
+import com.redhat.rhn.domain.common.Checksum;
import com.redhat.rhn.domain.errata.impl.PublishedErrata;
import com.redhat.rhn.domain.errata.impl.UnpublishedErrata;
import com.redhat.rhn.domain.org.Org;
@@ -45,7 +46,7 @@ public class Package extends BaseDomainHelper {
private Long payloadSize;
private String buildHost;
private Date buildTime;
- private String md5sum;
+ private Checksum checksum;
private String vendor;
private String payloadFormat;
private Long compat;
@@ -254,17 +255,17 @@ public class Package extends BaseDomainHelper {
}
/**
- * @return Returns the md5sum.
+ * @return Returns the checksum.
*/
- public String getMd5sum() {
- return md5sum;
+ public String getChecksum() {
+ return checksum;
}
/**
- * @param m The md5sum to set.
+ * @param checksumIn The checksum to set.
*/
- public void setMd5sum(String m) {
- this.md5sum = m;
+ public void setChecksum(String checksumIn) {
+ this.checksum = checksumIn;
}
/**
diff --git a/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml b/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml
index 883ecbd..af87333 100644
--- a/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.hbm.xml
@@ -18,7 +18,6 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<property name="payloadSize" type="long" column="payload_size"/>
<property name="buildHost" type="string" column="build_host"/>
<property name="buildTime" type="date" column="build_time"/>
- <property name="md5sum" type="string" column="md5sum"/>
<property name="sigmd5" type="string" column="sigmd5"/>
<property name="vendor" type="string" column="vendor"/>
<property name="path" type="string" column="path"/>
@@ -29,7 +28,8 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<property name="modified" column="modified" type="timestamp"
insert="false" update="false"/>
-
+ <many-to-one name="checksum" class="com.redhat.rhn.domain.common.Checksum"
+ column="checksum_id" />
<many-to-one name="org"
class="com.redhat.rhn.domain.org.OrgImpl"
column="org_id"
diff --git a/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.java b/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.java
index 14003ee..967b15b 100644
--- a/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.java
+++ b/java/code/src/com/redhat/rhn/domain/rhnpackage/PackageSource.java
@@ -15,6 +15,7 @@
package com.redhat.rhn.domain.rhnpackage;
import com.redhat.rhn.domain.BaseDomainHelper;
+import com.redhat.rhn.domain.common.Checksum;
import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.rpm.SourceRpm;
@@ -34,8 +35,8 @@ public class PackageSource extends BaseDomainHelper {
private Long payloadSize;
private String buildHost;
private Date buildTime;
- private String md5sum;
- private String sigmd5;
+ private Checksum checksum;
+ private Checksum sigchecksum;
private String vendor;
private String path;
private String cookie;
@@ -46,17 +47,17 @@ public class PackageSource extends BaseDomainHelper {
private SourceRpm sourceRpm;
/**
- * @return Returns the sigmd5.
+ * @return Returns the sig checksum.
*/
- public String getSigmd5() {
- return sigmd5;
+ public String getSigchecksum() {
+ return sigchecksum;
}
/**
- * @param sigmd5In The sigmd5 to set.
+ * @param sigchecksumIn The sigchecksum to set.
*/
- public void setSigmd5(String sigmd5In) {
- this.sigmd5 = sigmd5In;
+ public void setSigchecksum(Checksum sigchecksumIn) {
+ this.sigchecksum = sigchecksumIn;
}
/**
@@ -144,17 +145,17 @@ public class PackageSource extends BaseDomainHelper {
}
/**
- * @return Returns the md5sum.
+ * @return Returns the checksum.
*/
- public String getMd5sum() {
- return md5sum;
+ public String getChecksum() {
+ return checksum;
}
/**
- * @param m The md5sum to set.
+ * @param checksumIn The checksum to set.
*/
- public void setMd5sum(String m) {
- this.md5sum = m;
+ public void setChecksum(Checksum checksumIn) {
+ this.checksum = checksumIn;
}
/**
diff --git a/java/code/src/com/redhat/rhn/domain/rhnpackage/Package_satellite.hbm.xml b/java/code/src/com/redhat/rhn/domain/rhnpackage/Package_satellite.hbm.xml
index a3a7d52..e0ec9fd 100644
--- a/java/code/src/com/redhat/rhn/domain/rhnpackage/Package_satellite.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/rhnpackage/Package_satellite.hbm.xml
@@ -20,7 +20,6 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<property name="payloadSize" type="long" column="payload_size"/>
<property name="buildHost" type="string" column="build_host"/>
<property name="buildTime" type="date" column="build_time"/>
- <property name="md5sum" type="string" column="md5sum"/>
<property name="vendor" type="string" column="vendor"/>
<property name="payloadFormat" type="string" column="payload_format"/>
<property name="compat" type="long" column="compat"/>
@@ -31,7 +30,7 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<property name="lastModified" type="date" column="last_modified"/>
<property name="created" type="date" column="created"/>
<property name="modified" type="date" column="modified"/>
-
+
<set name="changeLog" cascade="save-update,delete" inverse="true">
<key column="package_id" />
<one-to-many class="com.redhat.rhn.domain.rhnpackage.ChangeLogEntry" />
@@ -110,6 +109,8 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+ <many-to-one name="checksum" class="com.redhat.rhn.domain.common.Checksum"
+ column="checksum_id" />
<many-to-one name="org"
class="com.redhat.rhn.domain.org.OrgImpl"
column="org_id"
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/ErrataPackageFile.java b/java/code/src/com/redhat/rhn/frontend/dto/ErrataPackageFile.java
index 7d40f8f..32e1d85 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/ErrataPackageFile.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/ErrataPackageFile.java
@@ -21,7 +21,8 @@ package com.redhat.rhn.frontend.dto;
*/
public class ErrataPackageFile {
private Long packageId;
- private String md5sum;
+ private String checksum;
+ private String checksumType;
private String filename;
private String channelName;
@@ -51,16 +52,35 @@ public class ErrataPackageFile {
this.filename = filenameIn;
}
/**
- * @return Returns the md5sum.
+ *
+ * @return Returns the checksum
*/
- public String getMd5sum() {
- return md5sum;
+ public String getChecksum() {
+ return checksum;
}
+
+ /**
+ *
+ * @param checksumIn The checksum to set
+ */
+ public void setChecksum(String checksumIn) {
+ this.checksum = checksumIn;
+ }
+
+ /**
+ *
+ * @return Returns the checksum type
+ */
+ public String getChecksumType() {
+ return checksumType;
+ }
+
/**
- * @param md5sumIn The md5sum to set.
+ *
+ * @param checksumTypeIn The checksumtype to set
*/
- public void setMd5sum(String md5sumIn) {
- this.md5sum = md5sumIn;
+ public void setChecksumtype(String checksumTypeIn) {
+ this.checksumType = checksumTypeIn;
}
/**
* @return Returns the packageId.
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java b/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
index daf7be2..e95b2f3 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/PackageDto.java
@@ -30,7 +30,8 @@ public class PackageDto extends BaseDto {
private String release;
private String epoch;
private String archLabel;
- private String md5sum;
+ private String checksum;
+ private String checksumType
private Long cid;
private String channelName;
private String summary;
@@ -179,18 +180,34 @@ public class PackageDto extends BaseDto {
/**
*
- * @return Returns the md5sum
+ * @return Returns the checksum
*/
- public String getMd5sum() {
- return md5sum;
+ public String getChecksum() {
+ return checksum;
}
/**
*
- * @param md5sumIn The md5sum to set
+ * @param checksumIn The checksum to set
*/
- public void setMd5sum(String md5sumIn) {
- this.md5sum = md5sumIn;
+ public void setChecksum(String checksumIn) {
+ this.checksum = checksumIn;
+ }
+
+ /**
+ *
+ * @return Returns the checksum type
+ */
+ public String getChecksumType() {
+ return checksumType;
+ }
+
+ /**
+ *
+ * @param checksumTypeIn The checksumtype to set
+ */
+ public void setChecksumtype(String checksumTypeIn) {
+ this.checksumType = checksumTypeIn;
}
/**
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java
index d972fcd..7b8638f 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/errata/ErrataHandler.java
@@ -597,7 +597,7 @@ public class ErrataHandler extends BaseHandler {
* providing this package.")
* #prop("string", "build_host")
* #prop("string", "description")
- * #prop("string", "md5sum")
+ * #prop("string", "checksum")
* #prop("string", "vendor")
* #prop("string", "summary")
* #prop("string", "cookie")
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackageHelper.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackageHelper.java
index 98051ef..2bfe4d4 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackageHelper.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackageHelper.java
@@ -92,8 +92,10 @@ public class PackageHelper {
StringUtils.defaultString(pkg.getBuildHost()));
addEntry(pkgMap, "description",
StringUtils.defaultString(pkg.getDescription()));
- addEntry(pkgMap, "md5sum",
- StringUtils.defaultString(pkg.getMd5sum()));
+ addEntry(pkgMap, "checksum",
+ StringUtils.defaultString(pkg.getChecksum().getChecksum()));
+ addEntry(pkgMap, "checksum_type",
+ StringUtils.defaultString(pkg.getChecksum().getChecksumType().getLabel()));
addEntry(pkgMap, "vendor",
StringUtils.defaultString(pkg.getVendor()));
addEntry(pkgMap, "summary",
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackagesHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackagesHandler.java
index f1563ac..61a0bee 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackagesHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/PackagesHandler.java
@@ -81,7 +81,8 @@ public class PackagesHandler extends BaseHandler {
* #prop_array("string", "label", "Channel label providing this package.")
* #prop("string", "build_host")
* #prop("string", "description")
- * #prop("string", "md5sum")
+ * #prop("string", "checksum")
+ * #prop("string", "checksum_type")
* #prop("string", "vendor")
* #prop("string", "summary")
* #prop("string", "cookie")
@@ -188,7 +189,8 @@ public class PackagesHandler extends BaseHandler {
* #prop("string", "path")
* #prop("string", "type")
* #prop("string", "last_modified_date")
- * #prop("string", "md5sum")
+ * #prop("string", "checksum")
+ * #prop("string", "checksum_type")
* #prop("int", "size")
* #prop("string", "linkto")
* #struct_end()
@@ -215,10 +217,11 @@ public class PackagesHandler extends BaseHandler {
row.put("last_modified_date", file.get("mtime"));
row.put("size", file.get("file_size"));
row.put("linkto", StringUtils.defaultString((String) file.get("linkto")));
- row.put("md5sum", StringUtils.defaultString((String) file.get("md5")));
+ row.put("checksum", StringUtils.defaultString((String) file.get("checksum")));
+ row.put("checksum_type", StringUtils.defaultString((String) file.get("checksumtype")));
// Determine the file_type
- if (file.get("md5") != null) {
+ if (file.get("checksum") != null) {
row.put("type", "file");
}
else {
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/test/PackageHelperTest.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/test/PackageHelperTest.java
index cddf51c..ea6a98e 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/test/PackageHelperTest.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/packages/test/PackageHelperTest.java
@@ -46,7 +46,8 @@ public class PackageHelperTest extends RhnBaseTestCase {
assertKey(map, "arch_label", pkg.getPackageArch().getLabel());
assertKey(map, "build_host", pkg.getBuildHost());
assertKey(map, "description", pkg.getDescription());
- assertKey(map, "md5sum", pkg.getMd5sum());
+ assertKey(map, "checksum", pkg.getChecksum().getChecksum());
+ assertKey(map, "checksum_type", pkg.getChecksum().getChecksumType().getLabel());
assertKey(map, "vendor", pkg.getVendor());
assertKey(map, "summary", pkg.getSummary());
assertKey(map, "cookie", pkg.getCookie());
commit 7180ef0eeed4fdc09276e608d9b15b71636f631a
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Tue Nov 10 13:02:12 2009 +0100
Creating new domain class for table rhnChecksum
diff --git a/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml b/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
new file mode 100644
index 0000000..17cbb08
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/common/Checksum.hbm.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-mapping
+PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class name="com.redhat.rhn.domain.common.Checksum"
+ table="rhnChecksum" mutable="false">
+ <cache usage="read-only"/>
+ <id name="id" type="long" column="id">
+ <meta attribute="scope-set">protected</meta>
+ <generator class="assigned" />
+ </id>
+ <property name="checksum" type="string" column="checksum" />
+ <property name="description" type="string" column="description" />
+ <many-to-one
+ name="checksumType"
+ class="com.redhat.rhn.domain.common.ChecksumType"
+ column="checksum_id"/>
+
+ </class>
+
+ <query name="Checksum.findById">
+ <![CDATA[from com.redhat.rhn.domain.common.Checksum as t where t.id = :id]]>
+ </query>
+ <query name="Checksum.findByChecksum">
+ <![CDATA[from com.redhat.rhn.domain.common.Checksum as t where t.checksum = :checksum]]>
+ </query>
+</hibernate-mapping>
diff --git a/java/code/src/com/redhat/rhn/domain/common/Checksum.java b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
new file mode 100644
index 0000000..b17ff61
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/common/Checksum.java
@@ -0,0 +1,107 @@
+/**
+ * Copyright (c) 2009 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.domain.common;
+
+import com.redhat.rhn.domain.BaseDomainHelper;
+import com.redhat.rhn.domain.common.ChecksumType;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * Checksum
+ * Class for checksums of files, packages and erratas.
+ * @version $Rev$
+ */
+public class Checksum extends BaseDomainHelper {
+
+ private Long id;
+ private String checksum;
+ private ChecksumType checksumType;
+
+ /**
+ * @return Returns the id.
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * @param idIn The id to set.
+ */
+ public void setId(Long idIn) {
+ this.id = idIn;
+ }
+
+ /**
+ * @return Returns the checksum.
+ */
+ public String getChecksum() {
+ return checksum;
+ }
+
+ /**
+ * @param checksumIn The checksum to set.
+ */
+ public void setChecksum(String checksumIn) {
+ this.checksum = checksumIn;
+ }
+
+ /**
+ * @return Returns the type of checksum.
+ */
+ public String getChecksumType() {
+ return checksumType;
+ }
+
+ /**
+ * @param checksumTypeIn The checksum type to set.
+ */
+ public void setDescription(ChecksumType checksumTypeIn) {
+ this.checksumType = checksumTypeIn;
+ }
+
+ /** {@inheritDoc} */
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ Checksum checksum = (Checksum) o;
+
+ if (id != null ? !id.equals(checksum.id) : checksum.id != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /** {@inheritDoc} */
+ public int hashCode() {
+ return id != null ? id.hashCode() : 0;
+ }
+
+ /** {@inheritDoc} */
+ public String toString() {
+ ToStringBuilder builder = new ToStringBuilder(this);
+
+ builder.append("id", id);
+ builder.append("checksum", checksum);
+
+ return builder.toString();
+ }
+}
commit bc2cc590d2e5a63284144530a7dbec39a547e945
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 10 16:11:38 2009 +0100
comment out dead SRPM import code for now
diff --git a/backend/server/importlib/errataImport.py b/backend/server/importlib/errataImport.py
index ef4820b..434bf57 100644
--- a/backend/server/importlib/errataImport.py
+++ b/backend/server/importlib/errataImport.py
@@ -90,9 +90,9 @@ class ErrataImport(GenericPackageImport):
self._processPackage(package)
if not package in self.packages:
self.packages.append(package)
- elif f['file_type'] == 'SRPM':
- # XXX misa: do something here
- pass
+ #elif f['file_type'] == 'SRPM':
+ # # XXX misa: do something here
+ # pass
def _preprocessErratumFileChannels(self, erratum):
for f in (erratum['files'] or []):
commit 348c0eef987f19fb894a5b1a5457db7b0e36f068
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Nov 10 16:00:52 2009 +0100
more checksum changes for rhnErrataFile
diff --git a/backend/server/importlib/errataImport.py b/backend/server/importlib/errataImport.py
index 1437546..ef4820b 100644
--- a/backend/server/importlib/errataImport.py
+++ b/backend/server/importlib/errataImport.py
@@ -79,11 +79,17 @@ class ErrataImport(GenericPackageImport):
def _preprocessErratumFiles(self, erratum):
for f in (erratum['files'] or []):
+ checksum = ('md5', f['md5sum']) # FIXME sha256
+ f['checksum'] = checksum
+ if not self.checksums.has_key(checksum):
+ self.checksums[checksum] = None
+
if f['file_type'] == 'RPM':
package = f.get('pkgobj')
if package:
- self.packages.append(package)
self._processPackage(package)
+ if not package in self.packages:
+ self.packages.append(package)
elif f['file_type'] == 'SRPM':
# XXX misa: do something here
pass
@@ -251,6 +257,7 @@ class ErrataImport(GenericPackageImport):
def _fix_erratum_file_packages(self, erratum):
for ef in erratum['files']:
+ ef['checksum_id'] = self.checksums[ef['checksum']]
if ef['file_type'] == 'RPM':
package = ef.get('pkgobj')
if not package:
commit 06c37069b89768f642ed6e82be4e23a25a13ce38
Merge: 7b0477e... 307f663...
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Nov 9 15:48:23 2009 +0100
Merge branch 'master' into s3
commit 7b0477e6985ac7b149c38df2c96490bbec8b8012
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Nov 5 10:09:31 2009 +0100
checksum changes for rhnErrataFile
diff --git a/backend/server/importlib/backendOracle.py b/backend/server/importlib/backendOracle.py
index 7c3983b..d97b625 100644
--- a/backend/server/importlib/backendOracle.py
+++ b/backend/server/importlib/backendOracle.py
@@ -212,10 +212,10 @@ class OracleBackend(Backend):
'id' : DBint(),
'errata_id' : DBint(),
'type' : DBint(),
- 'md5sum' : DBstring(64),
+ 'checksum_id' : DBint(),
'filename' : DBstring(1024),
},
- pk = ['errata_id', 'filename'],
+ pk = ['errata_id', 'filename', 'checksum_id'],
attribute = 'files',
defaultSeverity = 4,
sequenceColumn = 'id',
commit 0e963e754a7b621b50536259fff1e851ae6de317
Merge: e595f5c... 3dab836...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Nov 2 14:32:52 2009 +0100
Merge branch 'master' into sha256-support3
commit e595f5ccb7be58e0c3a91a6e35321cba3a243214
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Nov 2 14:26:43 2009 +0100
_postprocessPackage packages in errata (e.g lookup checksum_ids)
also changed append to packages with replace because we don't want old
structure w/out nevra and checksum info there
diff --git a/backend/server/importlib/errataImport.py b/backend/server/importlib/errataImport.py
index cee28a5..1437546 100644
--- a/backend/server/importlib/errataImport.py
+++ b/backend/server/importlib/errataImport.py
@@ -226,7 +226,9 @@ class ErrataImport(GenericPackageImport):
# Skip it
continue
+ oldpackage = package.copy()
self._postprocessPackageNEVRA(package)
+ self._postprocessPackage(package)
# Check the uniqueness
nevrao = tuple(get_nevrao(package))
@@ -240,7 +242,9 @@ class ErrataImport(GenericPackageImport):
# And put this package both in the local and in the global hash
packageHash[nevrao] = package
- self.packages.append(package)
+ # replace old package with new
+ idx = self.packages.index(oldpackage)
+ self.packages[idx] = package
erratum['packages'] = packageHash
commit 9c9f63cb3ddd3c43212f934255145180dbe2218b
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 30 09:50:08 2009 +0100
fixed errata sync part of satellite-sync
diff --git a/backend/server/importlib/importLib.py b/backend/server/importlib/importLib.py
index 856fe58..dbfde10 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -676,6 +676,11 @@ class GenericPackageImport(Import):
if not self.package_arches.has_key(package.arch):
self.package_arches[package.arch] = None
+ # FIXME: needs to be fixed for sha256
+ checksum = ('md5',package['md5sum'])
+ package['checksum'] = checksum
+ if not self.checksums.has_key(checksum):
+ self.checksums[checksum] = None
def _postprocessPackageNEVRA(self, package):
arch = self.package_arches[package.arch]
@@ -697,6 +702,8 @@ class GenericPackageImport(Import):
package['name_id'], package['evr_id'], package['package_arch_id'] = nevra
package['nevra_id'] = nevra_dict[nevra]
+ def _postprocessPackage(self, package):
+ package['checksum_id'] = self.checksums[package['checksum']]
# Exceptions
class ImportException(Exception):
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index 8c4932a..a2fca26 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -71,7 +71,8 @@ class ChannelPackageSubscription(GenericPackageImport):
if package.ignored:
continue
self._postprocessPackageNEVRA(package)
- package['checksum_id'] = self.checksums[package['checksum']]
+ #package['checksum_id'] = self.checksums[package['checksum']]
+ self._postprocessPackage(package)
if not CFG.ENABLE_NVREA:
# nvrea disabled, skip md5sum
nevrao = (
@@ -179,11 +180,11 @@ class ChannelPackageSubscription(GenericPackageImport):
# Replace the channel list with the uniquified list
package.channels = channels
- # FIXME: needs to be fixed for sha256
- checksum = ('md5',package['md5sum'])
- package['checksum'] = checksum
- if not self.checksums.has_key(checksum):
- self.checksums[checksum] = None
+# # FIXME: needs to be fixed for sha256
+# checksum = ('md5',package['md5sum'])
+# package['checksum'] = checksum
+# if not self.checksums.has_key(checksum):
+# self.checksums[checksum] = None
# Copies the channels from one package to the other
def __copyChannels(self, sourcePackage, destPackage):
commit a018a72a68b4bdafeadba3f02b3f5767ac6f9729
Merge: 31235dc... 5e04bd6...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 27 16:38:30 2009 +0100
Merge branch 'master' into sha256-support3
commit 31235dc0a3ab1e46079e3f5f569fd1a3e9325906
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 27 16:06:46 2009 +0100
fixed satellite-sync (reverted checksum changes in blacklistImport)
Traceback (most recent call last):
File "/usr/share/rhn/satellite_tools/xmlSource.py", line 132, in process
self.__parser.parse(self.__stream)
File "/usr/lib64/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 109, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib64/python2.4/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib64/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 216, in feed
self._parser.Parse(data, isFinal)
File "/usr/lib64/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 314, in
+end_element
self._cont_handler.endElement(name)
File "/usr/share/rhn/satellite_tools/xmlSource.py", line 225, in endElement
self.__container.endElement(element)
File "/usr/share/rhn/satellite_tools/xmlSource.py", line 800, in endElement
self.endContainerCallback()
File "/usr/share/rhn/satellite_tools/diskImportLib.py", line 283, in endContainerCallback
importer.run()
File "/usr/share/rhn/server/importlib/importLib.py", line 627, in run
self.fix()
File "/usr/share/rhn/server/importlib/blacklistImport.py", line 49, in fix
entry['checksum_id'] = self.checksums[entry['checksum']]
File "/usr/lib64/python2.4/UserDict.py", line 17, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'checksum'
diff --git a/backend/server/importlib/blacklistImport.py b/backend/server/importlib/blacklistImport.py
index 9b8b74a..5eda6b3 100644
--- a/backend/server/importlib/blacklistImport.py
+++ b/backend/server/importlib/blacklistImport.py
@@ -24,7 +24,6 @@ class BlacklistObsoletesImport(Import):
Import.__init__(self, batch, backend)
self.names = {}
self.evrs = {}
- self.checksums = {}
self.package_arches = {}
def preprocess(self):
@@ -41,12 +40,10 @@ class BlacklistObsoletesImport(Import):
def fix(self):
self.backend.lookupPackageNames(self.names)
self.backend.lookupEVRs(self.evrs)
- self.backend.lookupChecksums(self.checksums)
self.backend.lookupPackageArches(self.package_arches)
for entry in self.batch:
entry['name_id'] = self.names[entry['name']]
entry['evr_id'] = self.evrs[entry['evr']]
- entry['checksum_id'] = self.checksums[entry['checksum']]
entry['package_arch_id'] = self.package_arches[entry['package-arch']]
entry['ignore_name_id'] = self.names[entry['ignored-name']]
commit d04ef1d1e9f9e53bb43e4549e8824b649c6369d5
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 27 14:45:27 2009 +0100
added checksum support to spacewalk-repo-sync
Traceback (most recent call last):
File "/usr/share/rhn/satellite_tools/reposync.py", line 146, in import_packages
self.associate_package(pack, md5)
File "/usr/share/rhn/satellite_tools/reposync.py", line 193, in associate_package
self._importer_run(package, caller, backend)
File "/usr/share/rhn/satellite_tools/reposync.py", line 201, in _importer_run
importer.run()
File "/usr/share/rhn/server/importlib/importLib.py", line 628, in run
self.submit()
File "/usr/share/rhn/server/importlib/packageImport.py", line 115, in submit
self.backend.lookupPackages(self.batch)
File "/usr/share/rhn/server/importlib/backend.py", line 535, in lookupPackages
self.__lookupObjectCollection(packages, 'rhnPackage', ignore_missing)
File "/usr/share/rhn/server/importlib/backend.py", line 1774, in __lookupObjectCollection
h = lookup.query(object)
File "/usr/share/rhn/server/importlib/backendLib.py", line 221, in query
key, values = self._selectQueryKey(values)
File "/usr/share/rhn/server/importlib/backendLib.py", line 202, in _selectQueryKey
hash[col] = value[col]
File "/usr/lib64/python2.4/UserDict.py", line 17, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'checksum_id'
diff --git a/backend/satellite_tools/reposync.py b/backend/satellite_tools/reposync.py
index b1b57e6..5b90b03 100644
--- a/backend/satellite_tools/reposync.py
+++ b/backend/satellite_tools/reposync.py
@@ -183,6 +183,7 @@ class RepoSync:
package['epoch'] = pack.epoch
package['arch'] = pack.arch
package['md5sum'] = md5sum
+ package['checksum'] = ('md5', md5sum)
package['channels'] = [{'label':self.channel_label,
'id':self.channel['id']}]
package['org_id'] = self.channel['org_id']
commit 71ed3da579a627266c9e19dddfe19fedca1e81c3
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 27 14:34:29 2009 +0100
moved checksum code from PackageImport to ChannelPackageSubscription
this fixed broken spacewalk-repo-sync after rhnChecksum change
Traceback (most recent call last):
File "/usr/share/rhn/satellite_tools/reposync.py", line 146, in import_packages
self.associate_package(pack, md5)
File "/usr/share/rhn/satellite_tools/reposync.py", line 193, in associate_package
self._importer_run(package, caller, backend)
File "/usr/share/rhn/satellite_tools/reposync.py", line 201, in _importer_run
importer.run()
File "/usr/share/rhn/server/importlib/importLib.py", line 628, in run
self.submit()
File "/usr/share/rhn/server/importlib/packageImport.py", line 115, in submit
self.backend.lookupPackages(self.batch)
File "/usr/share/rhn/server/importlib/backend.py", line 535, in lookupPackages
self.__lookupObjectCollection(packages, 'rhnPackage', ignore_missing)
File "/usr/share/rhn/server/importlib/backend.py", line 1774, in __lookupObjectCollection
h = lookup.query(object)
File "/usr/share/rhn/server/importlib/backendLib.py", line 221, in query
key, values = self._selectQueryKey(values)
File "/usr/share/rhn/server/importlib/backendLib.py", line 202, in _selectQueryKey
hash[col] = value[col]
File "/usr/lib64/python2.4/UserDict.py", line 17, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'checksum_id'
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index 189e88b..8c4932a 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -71,6 +71,7 @@ class ChannelPackageSubscription(GenericPackageImport):
if package.ignored:
continue
self._postprocessPackageNEVRA(package)
+ package['checksum_id'] = self.checksums[package['checksum']]
if not CFG.ENABLE_NVREA:
# nvrea disabled, skip md5sum
nevrao = (
@@ -177,6 +178,12 @@ class ChannelPackageSubscription(GenericPackageImport):
self.channels[channelName] = None
# Replace the channel list with the uniquified list
package.channels = channels
+
+ # FIXME: needs to be fixed for sha256
+ checksum = ('md5',package['md5sum'])
+ package['checksum'] = checksum
+ if not self.checksums.has_key(checksum):
+ self.checksums[checksum] = None
# Copies the channels from one package to the other
def __copyChannels(self, sourcePackage, destPackage):
@@ -234,12 +241,6 @@ class PackageImport(ChannelPackageSubscription):
# XXX
package['copyright'] = package['license']
- # FIXME: needs to be fixed for sha256
- checksum = ('md5',package['md5sum'])
- package['checksum'] = checksum
- if not self.checksums.has_key(checksum):
- self.checksums[checksum] = None
-
# Creates all the data structures needed to insert capabilities
for tag in ('provides', 'requires', 'conflicts', 'obsoletes'):
depList = package[tag]
commit ad6e557d1de575325d1b495fde38fc273c41bef6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 26 13:31:42 2009 +0100
fixed indentation
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index c63c0a7..189e88b 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -373,9 +373,9 @@ class PackageImport(ChannelPackageSubscription):
for entry in package[tag]:
nv = entry['capability']
entry['capability_id'] = self.capabilities[nv]
- fileList = package['files']
- for f in fileList:
- f['checksum_id'] = self.checksums[f['checksum']]
+ fileList = package['files']
+ for f in fileList:
+ f['checksum_id'] = self.checksums[f['checksum']]
def __postprocessSolarisPackage(self, package):
# set solaris patch packages for a solaris patch
commit 6df3775d478837bedb5855c2963e5e5f9908efcf
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Oct 14 14:38:10 2009 +0200
fixed error message #501
diff --git a/backend/common/rhnException.py b/backend/common/rhnException.py
index a6a54fc..a91bd4f 100644
--- a/backend/common/rhnException.py
+++ b/backend/common/rhnException.py
@@ -223,7 +223,7 @@ maximum membership exceeded"),
# 500-599: Package Uploader errors
500: _("Missing HTTP header information"),
- 501: _("The package's md5sum signature does not match the header one"),
+ 501: _("The package's checksum signature does not match the header one"),
502: _("Header information does not match package metainformation"),
503: _("Package with a different signature already uploaded"),
504: _("Not an RPM package"),
diff --git a/backend/po/server.pot b/backend/po/server.pot
index b8be17e..33f28ff 100644
--- a/backend/po/server.pot
+++ b/backend/po/server.pot
@@ -938,7 +938,7 @@ msgid "Missing HTTP header information"
msgstr ""
#: ../common/rhnException.py:196
-msgid "The package's md5sum signature does not match the header one"
+msgid "The package's checksum signature does not match the header one"
msgstr ""
#: ../common/rhnException.py:197
commit 456824bd0289b267448cfface9fd3e177c92e834
Merge: 34c461a... 877f662...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 26 13:09:36 2009 +0100
Merge branch 'master' into sha256-support3
commit 34c461a45bd9ce3534b778ad4ca2fde0ef5cf335
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 26 13:05:19 2009 +0100
checksum_id can be NULL in rhnPackageFile
e.g. for symlinks
diff --git a/schema/spacewalk/common/tables/rhnPackageFile.sql b/schema/spacewalk/common/tables/rhnPackageFile.sql
index 8ec9bea..7c80243 100644
--- a/schema/spacewalk/common/tables/rhnPackageFile.sql
+++ b/schema/spacewalk/common/tables/rhnPackageFile.sql
@@ -31,7 +31,7 @@ CREATE TABLE rhnPackageFile
rdev NUMBER NOT NULL,
file_size NUMBER NOT NULL,
mtime DATE NOT NULL,
- checksum_id NUMBER NOT NULL
+ checksum_id NUMBER
CONSTRAINT rhn_package_file_chsum_fk
REFERENCES rhnChecksum (id),
linkto VARCHAR2(256),
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-4-rhnPackageFile-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-4-rhnPackageFile-checksum.sql
deleted file mode 100644
index b197ad7..0000000
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-4-rhnPackageFile-checksum.sql
+++ /dev/null
@@ -1 +0,0 @@
-alter table rhnPackageFile modify checksum_id NUMBER NOT NULL;
commit 99df8a1a71c74048454c5630a9c19797a9562d42
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 26 12:45:55 2009 +0100
changed checksum code for rhnPackageFile
diff --git a/backend/server/importlib/backendOracle.py b/backend/server/importlib/backendOracle.py
index dc1c282..7c3983b 100644
--- a/backend/server/importlib/backendOracle.py
+++ b/backend/server/importlib/backendOracle.py
@@ -91,18 +91,19 @@ class OracleBackend(Backend):
'rdev' : DBint(),
'file_size' : DBint(),
'mtime' : DBdateTime(),
- 'md5' : DBstring(32),
+ 'checksum_id' : DBint(),
'linkto' : DBstring(256),
'flags' : DBint(),
'verifyflags' : DBint(),
'lang' : DBstring(32),
},
- pk = ['package_id', 'capability_id'],
+ pk = ['package_id', 'capability_id', 'checksum_id'],
attribute = 'files',
severityHash = {
'mtime' : 0,
'file_size' : 4,
- 'md5' : 4,
+ # FIXME: sha256
+ #'md5' : 4,
},
),
Table('rhnPackage',
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index 4cc39a8..c63c0a7 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -264,6 +264,10 @@ class PackageImport(ChannelPackageSubscription):
f['capability'] = nv
if not self.capabilities.has_key(nv):
self.capabilities[nv] = None
+ fchecksum = ('md5', f['md5'])
+ f['checksum'] = fchecksum
+ if not self.checksums.has_key(fchecksum):
+ self.checksums[fchecksum] = None
# Uniquify changelog entries
changelogs = {}
@@ -369,6 +373,9 @@ class PackageImport(ChannelPackageSubscription):
for entry in package[tag]:
nv = entry['capability']
entry['capability_id'] = self.capabilities[nv]
+ fileList = package['files']
+ for f in fileList:
+ f['checksum_id'] = self.checksums[f['checksum']]
def __postprocessSolarisPackage(self, package):
# set solaris patch packages for a solaris patch
commit 01c475dffaeeb82e9bededdd554d6f96a1e3305d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 26 11:53:58 2009 +0100
fixed ORA-00904: "P"."CHECKSUM_ID": invalid identifier
Traceback (most recent call last):
File "/usr/share/rhn/server/apacheUploadServer.py", line 107, in _wrapper
ret = function(req)
File "/usr/share/rhn/upload_server/handlers/package_push/package_push.py", line 145,
+in handler
relative_path=self.rel_package_path, org_id=self.org_id)
File "/usr/share/rhn/server/rhnPackageUpload.py", line 271, in push_package
server_packages.processPackageKeyAssociations(header, md5sum)
File "/usr/share/rhn/server/rhnServer/server_packages.py", line 416, in
+processPackageKeyAssociations
lookup_pkgid_sql.execute(md5sum = md5sum)
File "/usr/share/rhn/server/rhnSQL/sql_base.py", line 168, in execute
return apply(self._execute_wrapper, (self._execute, ) + p, kw)
File "/usr/share/rhn/server/rhnSQL/driver_cx_Oracle.py", line 108, in _execute_wrapper
raise apply(sql_base.SQLStatementPrepareError, args)
SQLStatementPrepareError: ('ORA-00904: "P"."CHECKSUM_ID": invalid identifier\n', 904,
+'select id from rhnPackage, rhnChecksum c where c.checksum = :md5sum and p.checksum_id
+= c.id')
diff --git a/backend/server/rhnServer/server_packages.py b/backend/server/rhnServer/server_packages.py
index 97280cb..e020d6e 100644
--- a/backend/server/rhnServer/server_packages.py
+++ b/backend/server/rhnServer/server_packages.py
@@ -400,8 +400,8 @@ def processPackageKeyAssociations(header, md5sum):
""")
lookup_pkgid_sql = rhnSQL.prepare("""
- select id
- from rhnPackage, rhnChecksum c
+ select p.id
+ from rhnPackage p, rhnChecksum c
where c.checksum = :md5sum
and p.checksum_id = c.id
""")
commit b4261f748940a3a34d2747162cda348fe0589be1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 23 16:43:13 2009 +0200
fixing rhnpush error: ORA-00904: "MD5SUM": invalid identifier
diff --git a/backend/server/importlib/backend.py b/backend/server/importlib/backend.py
index 8f6d6d5..6ebb597 100644
--- a/backend/server/importlib/backend.py
+++ b/backend/server/importlib/backend.py
@@ -1977,12 +1977,12 @@ class Backend:
apply(h.executemany, (), params)
def validate_pks(self):
- # If nevra is enabled use md5sum as primary key
+ # If nevra is enabled use checksum as primary key
tbs = self.tables['rhnPackage']
if CFG.ENABLE_NVREA:
- # Add md5sum as a primarykey if nevra is enabled
- if 'md5sum' not in tbs.pk:
- tbs.pk.append('md5sum')
+ # Add checksum as a primarykey if nevra is enabled
+ if 'checksum_id' not in tbs.pk:
+ tbs.pk.append('checksum_id')
# Returns a tuple for the hash's values
def build_key(hash, fields):
diff --git a/backend/server/importlib/backendOracle.py b/backend/server/importlib/backendOracle.py
index 4dac3f2..dc1c282 100644
--- a/backend/server/importlib/backendOracle.py
+++ b/backend/server/importlib/backendOracle.py
@@ -131,7 +131,8 @@ class OracleBackend(Backend):
'header_end' : DBint(),
'last_modified' : DBdateTime(),
},
- pk = ['org_id', 'name_id', 'evr_id', 'package_arch_id'],
+ pk = ['org_id', 'name_id', 'evr_id', 'package_arch_id',
+ 'checksum_id'],
nullable = ['org_id'],
severityHash = {
'path' : 1,
commit 963c5fc3e31c6257cb5f54cb8c56bc8831141eb5
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 23 14:53:11 2009 +0200
fixing rhnpush error: ORA-00904: "MD5SUM": invalid identifier
diff --git a/backend/server/importlib/backendOracle.py b/backend/server/importlib/backendOracle.py
index 0204a33..4dac3f2 100644
--- a/backend/server/importlib/backendOracle.py
+++ b/backend/server/importlib/backendOracle.py
@@ -121,7 +121,7 @@ class OracleBackend(Backend):
'build_host' : DBstring(256),
'build_time' : DBdateTime(),
'source_rpm_id' : DBint(),
- 'md5sum' : DBstring(64),
+ 'checksum_id' : DBint(),
'vendor' : DBstring(64),
'payload_format': DBstring(32),
'path' : DBstring(1000),
@@ -135,7 +135,8 @@ class OracleBackend(Backend):
nullable = ['org_id'],
severityHash = {
'path' : 1,
- 'md5sum' : 2,
+ # FIXME: sha256
+ #'md5sum' : 2,
'package_size' : 2,
'build_time' : 3,
'build_host' : 3,
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index a4e3f13..4cc39a8 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -236,6 +236,7 @@ class PackageImport(ChannelPackageSubscription):
# FIXME: needs to be fixed for sha256
checksum = ('md5',package['md5sum'])
+ package['checksum'] = checksum
if not self.checksums.has_key(checksum):
self.checksums[checksum] = None
@@ -361,6 +362,8 @@ class PackageImport(ChannelPackageSubscription):
else:
source_rpm = ''
package['source_rpm_id'] = source_rpm
+ package['checksum_id'] = self.checksums[package['checksum']]
+
# Postprocess the dependency information
for tag in ('provides', 'requires', 'conflicts', 'obsoletes', 'files'):
for entry in package[tag]:
commit 1a935d42e3677972cc7ef910407c96284f68db36
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 23 14:36:26 2009 +0200
fixing rhnpush error: ORA-00904: "MD5SUM": invalid identifier
diff --git a/backend/server/importlib/importLib.py b/backend/server/importlib/importLib.py
index 6d7b7c9..856fe58 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -670,9 +670,6 @@ class GenericPackageImport(Import):
if not self.evrs.has_key(package.evr):
self.evrs[package.evr] = None
- if not self.checksums.has_key(package.checksum):
- self.checksums[package.checksum] = None
-
if not self.names.has_key(package.name):
self.names[package.name] = None
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index a56476c..a4e3f13 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -234,6 +234,11 @@ class PackageImport(ChannelPackageSubscription):
# XXX
package['copyright'] = package['license']
+ # FIXME: needs to be fixed for sha256
+ checksum = ('md5',package['md5sum'])
+ if not self.checksums.has_key(checksum):
+ self.checksums[checksum] = None
+
# Creates all the data structures needed to insert capabilities
for tag in ('provides', 'requires', 'conflicts', 'obsoletes'):
depList = package[tag]
commit 1eefff54e2c094b1a49a4bc518a66323d680b49e
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 23 13:05:32 2009 +0200
fixing rhnpush error: ORA-00904: "MD5SUM": invalid identifier
Traceback (most recent call last):
File "/usr/share/rhn/server/apacheUploadServer.py", line 107, in _wrapper
ret = function(req)
File "/usr/share/rhn/upload_server/handlers/package_push/package_push.py", line 145,
+in handler
relative_path=self.rel_package_path, org_id=self.org_id)
File "/usr/share/rhn/server/rhnPackageUpload.py", line 168, in push_package
importer.run()
File "/usr/share/rhn/server/importlib/importLib.py", line 628, in run
self.submit()
File "/usr/share/rhn/server/importlib/packageImport.py", line 308, in submit
transactional=self.transactional)
File "/usr/share/rhn/server/importlib/backend.py", line 744, in processPackages
transactional=transactional)
File "/usr/share/rhn/server/importlib/backend.py", line 1493, in
+__processObjectCollection__
h = lookup.query(object)
File "/usr/share/rhn/server/importlib/backendLib.py", line 223, in query
apply(statement.execute, (), values)
File "/usr/share/rhn/server/rhnSQL/sql_base.py", line 168, in execute
return apply(self._execute_wrapper, (self._execute, ) + p, kw)
File "/usr/share/rhn/server/rhnSQL/driver_cx_Oracle.py", line 108, in _execute_wrapper
raise apply(sql_base.SQLStatementPrepareError, args)
SQLStatementPrepareError: ('ORA-00904: "MD5SUM": invalid identifier\n', 904, 'select *
+from rhnPackage where org_id = :org_id and name_id = :name_id and evr_id = :evr_id and
+package_arch_id = :package_arch_id and md5sum = :md5sum')
diff --git a/backend/server/importlib/backend.py b/backend/server/importlib/backend.py
index fb99660..8f6d6d5 100644
--- a/backend/server/importlib/backend.py
+++ b/backend/server/importlib/backend.py
@@ -458,6 +458,18 @@ class Backend:
if row:
evrHash[evr] = row['id']
+ def lookupChecksums(self, checksumHash):
+ if not checksumHash:
+ return
+ sql = "select lookup_checksum(:ctype, :csum) id from dual"
+ h = self.dbmodule.prepare(sql)
+ for k in checksumHash.keys():
+ ctype, csum = k
+ h.execute(ctype=ctype, csum=csum)
+ row = h.fetchone_dict()
+ if row:
+ checksumHash[k] = row['id']
+
def lookupPackageNEVRAs(self, nevraHash):
sql = "select LOOKUP_PACKAGE_NEVRA(:name, :evr, :arch) id from dual"
h = self.dbmodule.prepare(sql)
diff --git a/backend/server/importlib/blacklistImport.py b/backend/server/importlib/blacklistImport.py
index 5eda6b3..9b8b74a 100644
--- a/backend/server/importlib/blacklistImport.py
+++ b/backend/server/importlib/blacklistImport.py
@@ -24,6 +24,7 @@ class BlacklistObsoletesImport(Import):
Import.__init__(self, batch, backend)
self.names = {}
self.evrs = {}
+ self.checksums = {}
self.package_arches = {}
def preprocess(self):
@@ -40,10 +41,12 @@ class BlacklistObsoletesImport(Import):
def fix(self):
self.backend.lookupPackageNames(self.names)
self.backend.lookupEVRs(self.evrs)
+ self.backend.lookupChecksums(self.checksums)
self.backend.lookupPackageArches(self.package_arches)
for entry in self.batch:
entry['name_id'] = self.names[entry['name']]
entry['evr_id'] = self.evrs[entry['evr']]
+ entry['checksum_id'] = self.checksums[entry['checksum']]
entry['package_arch_id'] = self.package_arches[entry['package-arch']]
entry['ignore_name_id'] = self.names[entry['ignored-name']]
diff --git a/backend/server/importlib/errataImport.py b/backend/server/importlib/errataImport.py
index b7b9c0d..cee28a5 100644
--- a/backend/server/importlib/errataImport.py
+++ b/backend/server/importlib/errataImport.py
@@ -108,6 +108,7 @@ class ErrataImport(GenericPackageImport):
self.backend.lookupPackageNames(self.names)
self.backend.lookupEVRs(self.evrs)
+ self.backend.lookupChecksums(self.checksums)
self.backend.lookupPackageArches(self.package_arches)
for erratum in self.batch:
diff --git a/backend/server/importlib/importLib.py b/backend/server/importlib/importLib.py
index ab9138c..6d7b7c9 100644
--- a/backend/server/importlib/importLib.py
+++ b/backend/server/importlib/importLib.py
@@ -658,6 +658,7 @@ class GenericPackageImport(Import):
# Packages have to be pre-processed
self.names = {}
self.evrs = {}
+ self.checksums = {}
self.package_arches = {}
self.channels = {}
self.channel_package_arch_compat = {}
@@ -669,6 +670,9 @@ class GenericPackageImport(Import):
if not self.evrs.has_key(package.evr):
self.evrs[package.evr] = None
+ if not self.checksums.has_key(package.checksum):
+ self.checksums[package.checksum] = None
+
if not self.names.has_key(package.name):
self.names[package.name] = None
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index e1f84c6..a56476c 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -63,6 +63,7 @@ class ChannelPackageSubscription(GenericPackageImport):
self.backend.lookupChannelPackageArchCompat(self.channel_package_arch_compat)
self.backend.lookupPackageNames(self.names)
self.backend.lookupEVRs(self.evrs)
+ self.backend.lookupChecksums(self.checksums)
# Fix the package information up, and uniquify the packages too
uniqdict = {}
@@ -375,6 +376,7 @@ class PackageImport(ChannelPackageSubscription):
evrs = {}
names = {}
archs = {}
+ checksums = {}
for pkgDict, pkgInfoObj in package['solaris_patch_packages']:
@@ -386,10 +388,12 @@ class PackageImport(ChannelPackageSubscription):
pkgDict['evr'] = evr
evrs[evr] = None
+ checksums[pkgDict['checksum']] = None
names[pkgDict['name']] = None
archs[pkgDict['arch']] = None
self.backend.lookupEVRs(evrs)
+ self.backend.lookupChecksums(checksums)
self.backend.lookupPackageNames(names)
self.backend.lookupPackageArches(archs)
@@ -420,6 +424,7 @@ class PackageImport(ChannelPackageSubscription):
def __postprocessSolarisPatchSetMembers(self, package):
evrs = {}
+ checksums = {}
names = {}
for patchDict, patchObj in package['solaris_patch_set_members']:
@@ -432,9 +437,11 @@ class PackageImport(ChannelPackageSubscription):
patchDict['evr'] = evr
evrs[evr] = None
+ checksums[patchDict['checksum']] = None
names[patchDict['name']] = None
self.backend.lookupEVRs(evrs)
+ self.backend.lookupChecksums(self.checksums)
self.backend.lookupPackageNames(names)
nevras = {}
commit a9c7a0db550e63b5726ab557995e8ffc1eb68625
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 14:24:06 2009 +0200
fixed typo
diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index 53bf379..b189bd8 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -440,7 +440,7 @@ def get_package_for_md5sum(org_id, md5sum):
rhnPackage p, rhnChecksum c
where p.org_id = :org_id
and p.checksum_id = c.id
- and p.checksum = :md5sum
+ and c.checksum = :md5sum
"""
h = rhnSQL.prepare(statement)
h.execute(org_id=org_id, md5sum=md5sum)
commit d34abf2e6a3848a9a630833c52323480a4a1f9b8
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:40:45 2009 +0200
fixed inserts in server/rhnKickstart.py to reflect new rhnChecksum table
diff --git a/backend/server/rhnKickstart.py b/backend/server/rhnKickstart.py
index f0b8cb7..aa3b8d2 100644
--- a/backend/server/rhnKickstart.py
+++ b/backend/server/rhnKickstart.py
@@ -96,11 +96,11 @@ class Kickstart:
' , ' + str(ks_file['md5sum']) + ' , ' + str(ks_file['file_size']) + \
' , ' + ks_file['last_modified'])
- # FIXME: this insert should go to rhnKSTreeFile and rhnChecksum
insert_file_q = rhnSQL.prepare("""
insert into rhnKSTreeFile
- (kstree_id, relative_filename, md5sum, file_size, last_modified)
- values (:kstree_id, :relative_filename, :md5sum, :file_size, :last_modified)
+ (kstree_id, relative_filename, checksum_id, file_size, last_modified)
+ values (:kstree_id, :relative_filename, lookup_checksum('md5', :md5sum),
+ :file_size, :last_modified)
""")
insert_file_q.execute(kstree_id = self.id,
relative_filename = ks_file['relative_path'],
commit 2567598a1bd171319e241e0158bc012e440efbae
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:38:42 2009 +0200
fixed inserts in server/configFilesHandler.py to reflect new rhnChecksum table
diff --git a/backend/server/configFilesHandler.py b/backend/server/configFilesHandler.py
index a823bb3..1b5576e 100644
--- a/backend/server/configFilesHandler.py
+++ b/backend/server/configFilesHandler.py
@@ -229,20 +229,18 @@ class ConfigFilesHandler(rhnHandler):
and checksum_id = c.id
""")
- # FIXME: this insert have to go both to rhnConfigContent and rhnChecksum
_query_insert_content = rhnSQL.Statement("""
insert into rhnConfigContent
- (id, md5sum, file_size, contents, is_binary)
- values (:config_content_id, :md5sum, :file_size, empty_blob(),
- :is_binary)
+ (id, checksum_id, file_size, contents, is_binary)
+ values (:config_content_id, lookup_checksum('md5', :md5sum),
+ :file_size, empty_blob(), :is_binary)
""")
- # FIXME: this insert have to go both to rhnConfigContent and rhnChecksum
_query_insert_null_content = rhnSQL.Statement("""
insert into rhnConfigContent
- (id, md5sum, file_size, contents, is_binary)
- values (:config_content_id, :md5sum, :file_size, NULL,
- :is_binary)
+ (id, checksum_id, file_size, contents, is_binary)
+ values (:config_content_id, lookup_checksum('md5', :md5sum),
+ :file_size, NULL, :is_binary)
""")
_query_get_content_row = rhnSQL.Statement("""
commit 1274a3d70af3e1cde328636d60cbfb205c9a272c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 15 14:02:04 2009 +0200
new lookup_checksum function
diff --git a/schema/spacewalk/oracle/procs/lookup_checksum.sql b/schema/spacewalk/oracle/procs/lookup_checksum.sql
new file mode 100644
index 0000000..d025b38
--- /dev/null
+++ b/schema/spacewalk/oracle/procs/lookup_checksum.sql
@@ -0,0 +1,50 @@
+--
+-- Copyright (c) 2009 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_CHECKSUM(checksum_type_in IN VARCHAR2, checksum_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ checksum_id NUMBER;
+BEGIN
+ if checksum_in is null then
+ return null;
+ end if;
+
+ SELECT c.id
+ INTO checksum_id
+ FROM rhnChecksum c,
+ rhnChecksumType t
+ WHERE c.checksum = checksum_in
+ AND c.checksum_type_id = t.id;
+
+ RETURN checksum_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ INSERT INTO rhnChecksum (id, checksum_type_id, checksum)
+ VALUES (rhnChecksum_seq.nextval,
+ (select id from rhnChecksumType where label = checksum_type_in),
+ checksum_in)
+ RETURNING id INTO checksum_id;
+ COMMIT;
+ RETURN checksum_id;
+END;
+/
+SHOW ERRORS
+
commit 1eb7e558eb5767ddc9cf739bef36e0261f9eec7f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Oct 14 16:34:43 2009 +0200
fixed list of yum repo checksums in Create Software Channel
diff --git a/java/code/src/com/redhat/rhn/domain/common/ChecksumType.hbm.xml b/java/code/src/com/redhat/rhn/domain/common/ChecksumType.hbm.xml
index dea8be7..a95f1eb 100644
--- a/java/code/src/com/redhat/rhn/domain/common/ChecksumType.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/common/ChecksumType.hbm.xml
@@ -21,7 +21,7 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
</query>
<query name="ChecksumType.loadAllForYum">
<![CDATA[from com.redhat.rhn.domain.common.ChecksumType as t
- where t.label = 'sha-256' or t.label = 'sha1']]>
+ where t.label like 'sha%']]>
</query>
<query name="ChecksumType.findById">
<![CDATA[from com.redhat.rhn.domain.common.ChecksumType as t where t.id = :id]]>
commit 23f45c9fab1239b4504bd3c0b7e91e2d19c7bce8
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:31:57 2009 +0200
changes in server/rhnServer/server_packages.py to reflect new rhnChecksum table
diff --git a/backend/server/rhnServer/server_packages.py b/backend/server/rhnServer/server_packages.py
index b5a5156..97280cb 100644
--- a/backend/server/rhnServer/server_packages.py
+++ b/backend/server/rhnServer/server_packages.py
@@ -401,8 +401,9 @@ def processPackageKeyAssociations(header, md5sum):
lookup_pkgid_sql = rhnSQL.prepare("""
select id
- from rhnPackage
- where md5sum = :md5sum
+ from rhnPackage, rhnChecksum c
+ where c.checksum = :md5sum
+ and p.checksum_id = c.id
""")
lookup_pkgkey_sql = rhnSQL.prepare("""
commit d09334a2b205de3ffd44caff799ccf9fe09dabc9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:30:53 2009 +0200
changes in server/rhnPackage.py to reflect new rhnChecksum table
diff --git a/backend/server/rhnPackageUpload.py b/backend/server/rhnPackageUpload.py
index 46b57a7..41e6a42 100644
--- a/backend/server/rhnPackageUpload.py
+++ b/backend/server/rhnPackageUpload.py
@@ -219,9 +219,11 @@ def push_package(header, payload_stream, md5sum, org_id=None, force=None,
h_path = rhnSQL.prepare("""
select ps.path path
- from rhnpackagesource ps
+ from rhnpackagesource ps,
+ rhnChecksum c
where
- ps.md5sum = :md5sum
+ c.checksum = :md5sum
+ and ps.checksum_id = c.id
and (ps.org_id = :org_id or
(ps.org_id is null and :org_id is null)
)
@@ -229,9 +231,11 @@ def push_package(header, payload_stream, md5sum, org_id=None, force=None,
else:
h_path = rhnSQL.prepare("""
select rp.path path
- from rhnpackage rp
+ from rhnpackage rp,
+ rhnChecksum c
where
- rp.md5sum = :md5sum
+ c.checksum = :md5sum
+ and rp.checksum_id = c.id
and (rp.org_id = :org_id or
(rp.org_id is null and :org_id is null)
)
@@ -249,8 +253,8 @@ def push_package(header, payload_stream, md5sum, org_id=None, force=None,
h_upd = rhnSQL.prepare("""
update rhnpackage
set path = :path
- where
- md5sum = :md5sum
+ where checksum_id = (
+ select id from rhnChecksum where checksum = :md5sum)
""")
h_upd.execute(path=relative_path, md5sum=md5sum)
commit 78c52aee7d7047161c10611adbd04e943135d70b
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:22:22 2009 +0200
changes in server/rhnPackage.py to reflect new rhnChecksum table
diff --git a/backend/server/rhnPackage.py b/backend/server/rhnPackage.py
index 0b7ac08..53bf379 100644
--- a/backend/server/rhnPackage.py
+++ b/backend/server/rhnPackage.py
@@ -437,9 +437,10 @@ def get_package_for_md5sum(org_id, md5sum):
select
p.id
from
- rhnPackage p
+ rhnPackage p, rhnChecksum c
where p.org_id = :org_id
- and p.md5sum = :md5sum
+ and p.checksum_id = c.id
+ and p.checksum = :md5sum
"""
h = rhnSQL.prepare(statement)
h.execute(org_id=org_id, md5sum=md5sum)
commit 7442280bb29fdef40becb3121b0245529c6c63f7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:20:21 2009 +0200
changes in server/rhnKickstart.py to reflect new rhnChecksum table
diff --git a/backend/server/rhnKickstart.py b/backend/server/rhnKickstart.py
index ad404ae..f0b8cb7 100644
--- a/backend/server/rhnKickstart.py
+++ b/backend/server/rhnKickstart.py
@@ -40,9 +40,11 @@ class Kickstart:
SELECT
relative_filename,
file_size,
- md5sum,
+ c.checksum md5sum,
TO_CHAR(last_modified, 'YYYY-MM-DD HH24:MI:SS') AS LAST_MODIFIED
- FROM rhnKSTreeFile WHERE kstree_id = :tree_id
+ FROM rhnKSTreeFile, rhnChecksum c
+ WHERE kstree_id = :tree_id
+ AND checksum_id = c.id
""")
files_query.execute(tree_id = tree_id)
@@ -94,6 +96,7 @@ class Kickstart:
' , ' + str(ks_file['md5sum']) + ' , ' + str(ks_file['file_size']) + \
' , ' + ks_file['last_modified'])
+ # FIXME: this insert should go to rhnKSTreeFile and rhnChecksum
insert_file_q = rhnSQL.prepare("""
insert into rhnKSTreeFile
(kstree_id, relative_filename, md5sum, file_size, last_modified)
commit 024ab11c58678d66b8ce1b7dffee079a67fa3bd6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:18:20 2009 +0200
changes in server/repomd/mapper.py to reflect new rhnChecksum table
diff --git a/backend/server/repomd/mapper.py b/backend/server/repomd/mapper.py
index 3522db1..e43eda1 100644
--- a/backend/server/repomd/mapper.py
+++ b/backend/server/repomd/mapper.py
@@ -196,7 +196,7 @@ class SqlPackageMapper:
pevr.release,
pevr.epoch,
pa.label arch,
- p.md5sum,
+ c.checksum md5sum,
p.summary,
p.description,
p.vendor,
@@ -217,7 +217,8 @@ class SqlPackageMapper:
rhnPackageEVR pevr,
rhnPackageArch pa,
rhnPackageGroup pg,
- rhnSourceRPM sr
+ rhnSourceRPM sr,
+ rhnChecksum c
where
p.id = :package_id
and p.name_id = pn.id
@@ -225,6 +226,7 @@ class SqlPackageMapper:
and p.package_arch_id = pa.id
and p.package_group = pg.id
and p.source_rpm_id = sr.id
+ and p.checksum_id = c.id
""")
self.filelist_sql = rhnSQL.prepare("""
commit a0da0d9983d9c27d51f2ee16c1aa3798e880f0e8
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:12:38 2009 +0200
changed queries in server/importlib/backend.py[D to new rhnChecksum table
diff --git a/backend/server/importlib/backend.py b/backend/server/importlib/backend.py
index fffc7b4..fb99660 100644
--- a/backend/server/importlib/backend.py
+++ b/backend/server/importlib/backend.py
@@ -384,12 +384,14 @@ class Backend:
return None
sql = """
- select ef.md5sum
+ select c.checksum md5sum
from rhnErrataFile ef,
- rhnErrata e
+ rhnErrata e,
+ rhnChecksum c
where ef.filename = :filename
and e.advisory_name = :aname
and ef.errata_id = e.id
+ and ef.checksum_id = c.id
"""
h = self.dbmodule.prepare(sql)
@@ -1808,19 +1810,21 @@ class Backend:
pe.evr.release release,
pa.label arch,
p.org_id,
- p.md5sum
+ cc.checksum md5sum
from rhnChannel c,
rhnChannelPackage cp,
rhnPackage p,
rhnPackageName pn,
rhnPackageEVR pe,
- rhnPackageArch pa
+ rhnPackageArch pa,
+ rhnChecksum cc
where c.label = :label
and p.package_arch_id = pa.id
and cp.channel_id = c.id
and cp.package_id = p.id
and p.name_id = pn.id
and p.evr_id = pe.id
+ and p.checksum_id = pc.id
"""
h = self.dbmodule.prepare(query)
h.execute(label=channel)
@@ -1966,7 +1970,7 @@ class Backend:
if CFG.ENABLE_NVREA:
# Add md5sum as a primarykey if nevra is enabled
if 'md5sum' not in tbs.pk:
- tbs.pk.append('md5sum')
+ tbs.pk.append('md5sum')
# Returns a tuple for the hash's values
def build_key(hash, fields):
commit cbcc8ee585a80f7c01958a3d0b99c49839217f30
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:09:05 2009 +0200
changed queries in server/handlers/xp/rhnlint.py to new rhnChecksum table
diff --git a/backend/server/handlers/xp/rhnlint.py b/backend/server/handlers/xp/rhnlint.py
index f67736f..5f6608a 100644
--- a/backend/server/handlers/xp/rhnlint.py
+++ b/backend/server/handlers/xp/rhnlint.py
@@ -285,17 +285,18 @@ def testMD5sums(info, results):
header = package['header']
filename = package['filename']
query = """
- select pn.name || '-' || pe.evr.as_vre_simple() nvre, p.md5sum md5sum,
+ select pn.name || '-' || pe.evr.as_vre_simple() nvre, c.checksum md5sum,
p.org_id org_id, p.build_host buildhost, p.build_time buildtime
from rhnPackageArch pa, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackage p
+ rhnPackage p, rhnChecksum c
where pn.name = :name
and pe.version = :version
and pe.release = :release
and pe.epoch %s
and pn.id = p.name_id
and pe.id = p.evr_id
- and p.md5sum != :md5sum
+ and p.checksum_id = c.id
+ and c.checksum != :md5sum
and (p.org_id is null or p.org_id = :org_id)
and pa.label = :arch
and p.package_arch_id = pa.id
commit b04bda8b28ffb980275c86da28877d47718b49cc
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:06:00 2009 +0200
changed queries in server/handlers/config_mgmt/rhn_config_management.py to new rhnChecksum table
diff --git a/backend/server/handlers/config_mgmt/rhn_config_management.py b/backend/server/handlers/config_mgmt/rhn_config_management.py
index 90a9983..71d60dd 100644
--- a/backend/server/handlers/config_mgmt/rhn_config_management.py
+++ b/backend/server/handlers/config_mgmt/rhn_config_management.py
@@ -253,7 +253,7 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
cc.label config_channel,
ccont.contents file_contents,
ccont.is_binary,
- ccont.md5sum,
+ c.checksum md5sum,
cr.delim_start, cr.delim_end,
cr.revision,
cf.modified,
@@ -267,6 +267,7 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
rhnConfigRevision cr,
rhnConfigFile cf,
rhnConfigContent ccont,
+ rhnChecksum c,
rhnConfigFileType cft
where cf.config_channel_id = cc.id
and cc.label = :config_channel
@@ -277,13 +278,14 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
and cf.latest_config_revision_id = cr.id
and cr.config_content_id = ccont.id
and cr.config_file_type_id = cft.id
+ and ccont.checksum_id = c.id
""")
_query_get_file_revision = rhnSQL.Statement("""
select :path path,
cc.label config_channel,
ccont.contents file_contents,
ccont.is_binary,
- ccont.md5sum,
+ c.checksum md5sum,
cr.delim_start, cr.delim_end,
cr.revision,
cf.modified,
@@ -297,6 +299,7 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
rhnConfigRevision cr,
rhnConfigFile cf,
rhnConfigContent ccont,
+ rhnChecksum c,
rhnConfigFileType cft
where cf.config_channel_id = cc.id
and cc.label = :config_channel
@@ -307,6 +310,7 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
and cr.revision = :revision
and cr.config_content_id = ccont.id
and cr.config_file_type_id = cft.id
+ and ccont.checksum_id = c.id
""")
commit 104d0049c69def3aaeddf49474ceb6b72a7d2452
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:04:11 2009 +0200
changed queries in server/handlers/config/rhn_config_management.py to new rhnChecksum table
diff --git a/backend/server/handlers/config/rhn_config_management.py b/backend/server/handlers/config/rhn_config_management.py
index 47834bd..a03a2c1 100644
--- a/backend/server/handlers/config/rhn_config_management.py
+++ b/backend/server/handlers/config/rhn_config_management.py
@@ -161,7 +161,7 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
cc.label config_channel,
ccont.contents file_contents,
ccont.is_binary is_binary,
- ccont.md5sum,
+ c.checksum md5sum,
cr.delim_start, cr.delim_end,
cr.revision,
cf.modified,
@@ -175,6 +175,7 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
rhnConfigInfo ci,
rhnConfigRevision cr,
rhnConfigContent ccont,
+ rhnChecksum c,
rhnServerConfigChannel scc,
rhnConfigFile cf,
rhnConfigFileType cft,
@@ -189,6 +190,7 @@ class ConfigManagement(configFilesHandler.ConfigFilesHandler):
and cr.config_content_id = ccont.id
and cr.config_file_type_id = cft.id
and cct.id = cc.confchan_type_id
+ and ccont.checksum_id = c.id
order by cct.priority, scc.position
""")
commit 64bd36ef1c88fe5165b5630e8f3a4c22b4b3b886
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 11:03:20 2009 +0200
changed queries in server/handlers/app/packages.py to new rhnChecksum table
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 7747978..9a21969 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -344,7 +344,7 @@ class Packages(RPC_Base):
md5sum_exists = 0
if package.has_key('md5sum') and CFG.ENABLE_NVREA:
md5sum_exists = 1
- _md5sum_sql_filter = """and p.md5sum =: md5sum"""
+ _md5sum_sql_filter = """and c.checksum = :md5sum"""
h = rhnSQL.prepare(self._get_pkg_info_query % \
_md5sum_sql_filter)
@@ -453,13 +453,14 @@ class Packages(RPC_Base):
_get_pkg_info_query = """
select
- p.md5sum md5sum,
+ c.checksum md5sum,
p.path path
from
rhnPackageEVR pe,
rhnPackageName pn,
rhnPackage p,
- rhnPackageArch pa
+ rhnPackageArch pa,
+ rhnChecksum c
where
pn.name = :pkg_name
and ( pe.epoch = :pkg_epoch or
@@ -474,6 +475,7 @@ class Packages(RPC_Base):
and p.evr_id = pe.id
and p.package_arch_id = pa.id
and pa.label = :pkg_arch
+ and p.checksum_id = c.id
%s
"""
@@ -487,7 +489,7 @@ class Packages(RPC_Base):
_md5sum_sql_filter = ""
if pkg_info.has_key('md5sum') and CFG.ENABLE_NVREA:
md5sum_exists = 1
- _md5sum_sql_filter = """and p.md5sum =: md5sum"""
+ _md5sum_sql_filter = """and c.checksum = :md5sum"""
h = rhnSQL.prepare(self._get_pkg_info_query % _md5sum_sql_filter)
@@ -586,16 +588,18 @@ class Packages(RPC_Base):
statement = """
select
ps.path path,
- ps.md5sum md5sum
+ c.checksum md5sum
from
rhnSourceRpm sr,
- rhnPackageSource ps
+ rhnPackageSource ps,
+ rhnChecksum c
where
sr.name = :name
and ps.source_rpm_id = sr.id
and ( ps.org_id = :orgid or
( ps.org_id is null and :orgid is null )
)
+ and ps.checksum_id = c.id
"""
h = rhnSQL.prepare(statement)
row_list = {}
@@ -640,14 +644,16 @@ class Packages(RPC_Base):
ps.rpm_version version,
ps.path,
ps.package_size,
- ps.md5sum
+ c.checksum md5sum
from
rhnSourceRpm sr,
- rhnPackageSource ps
+ rhnPackageSource ps,
+ rhnChecksum c
where
ps.source_rpm_id = :sri
and ps.source_rpm_id = sr.id
+ and ps.checksum_id = c.id
"""
h = rhnSQL.prepare(statement)
h.execute(sri=int(source_rpm_id))
commit 0d570c68ab3e19f60e246a0b81a71cb0dde22805
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 10:58:08 2009 +0200
changed queries in server/configFilesHandler.py to new rhnChecksum table
diff --git a/backend/server/configFilesHandler.py b/backend/server/configFilesHandler.py
index f00a937..a823bb3 100644
--- a/backend/server/configFilesHandler.py
+++ b/backend/server/configFilesHandler.py
@@ -222,12 +222,14 @@ class ConfigFilesHandler(rhnHandler):
return result
_query_content_lookup = rhnSQL.Statement("""
- select id, md5sum, file_size, contents, is_binary
- from rhnConfigContent
- where md5sum = :md5sum
+ select id, c.checksum md5sum, file_size, contents, is_binary
+ from rhnConfigContent, rhnChecksum c
+ where c.checksum = :md5sum
and file_size = :file_size
+ and checksum_id = c.id
""")
+ # FIXME: this insert have to go both to rhnConfigContent and rhnChecksum
_query_insert_content = rhnSQL.Statement("""
insert into rhnConfigContent
(id, md5sum, file_size, contents, is_binary)
@@ -235,6 +237,7 @@ class ConfigFilesHandler(rhnHandler):
:is_binary)
""")
+ # FIXME: this insert have to go both to rhnConfigContent and rhnChecksum
_query_insert_null_content = rhnSQL.Statement("""
insert into rhnConfigContent
(id, md5sum, file_size, contents, is_binary)
commit 9833df35f075761877d583dd3c451900888cf321
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 10:55:27 2009 +0200
changed queries in server/action_extra_data/packages.py to new rhnChecksum table
diff --git a/backend/server/action_extra_data/packages.py b/backend/server/action_extra_data/packages.py
index 7aca67c..6e6c294 100644
--- a/backend/server/action_extra_data/packages.py
+++ b/backend/server/action_extra_data/packages.py
@@ -40,7 +40,7 @@ insert into rhnServerActionVerifyResult (
package_evr_id,
package_arch_id,
package_capability_id,
- attribute, size_differs, mode_differs, md5_differs,
+ attribute, size_differs, mode_differs, checksum_differs,
devnum_differs, readlink_differs, uid_differs,
gid_differs, mtime_differs
)
commit c02eca895241322305cf3a5a5576b6f4b23ba935
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 10:54:12 2009 +0200
changed queries in server/action/configfiles.py to new rhnChecksum table
diff --git a/backend/server/action/configfiles.py b/backend/server/action/configfiles.py
index db91ca7..480431f 100644
--- a/backend/server/action/configfiles.py
+++ b/backend/server/action/configfiles.py
@@ -115,7 +115,7 @@ _query_get_files = rhnSQL.Statement("""
cc.label config_channel,
ccont.contents file_contents,
ccont.is_binary is_binary,
- ccont.md5sum,
+ c.checksum md5sum,
cr.delim_start,
cr.delim_end,
cr.revision,
@@ -127,6 +127,7 @@ _query_get_files = rhnSQL.Statement("""
from
rhnConfigFileState cfs,
rhnConfigContent ccont,
+ rhnChecksum c,
rhnConfigChannel cc,
rhnConfigFileName cfn,
rhnConfigInfo ci,
@@ -145,6 +146,7 @@ _query_get_files = rhnSQL.Statement("""
and cfs.label = 'alive'
and cr.config_content_id = ccont.id
and cr.config_file_type_id = cft.id
+ and ccont.checksum_id = c.id
""")
def _get_files(server_id, action_id):
commit 350c19d777f2149047a3f9ddcd4fbe5db2e0fa06
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 10:52:21 2009 +0200
changed queries in updatePackages.py to new rhnChecksum table
diff --git a/backend/satellite_tools/updatePackages.py b/backend/satellite_tools/updatePackages.py
index 35a07ba..734fefb 100644
--- a/backend/satellite_tools/updatePackages.py
+++ b/backend/satellite_tools/updatePackages.py
@@ -104,19 +104,20 @@ def get_new_pkg_path(nvrea, org_id, prepend="", omit_epoch=None,
_get_path_query = """
select id, md5sum, path, epoch, new_path
from (
- select rhnPackage.id, rhnPackage.md5sum, rhnPackage.path, rhnPackageEvr.epoch,
- decode(rhnPackage.org_id, null, 'NULL', rhnPackage.org_id) || '/' || substr(md5sum, 1, 3)
+ select rhnPackage.id, rhnChecksum.checksum md5sum, rhnPackage.path, rhnPackageEvr.epoch,
+ decode(rhnPackage.org_id, null, 'NULL', rhnPackage.org_id) || '/' || substr(rhnChecksum.checksum, 1, 3)
|| '/' || rhnPackageName.name
|| '/' || decode(rhnPackageEvr.epoch, null, '', rhnPackageEvr.epoch || ':')
|| rhnPackageEvr.version || '-' || rhnPackageEvr.release
|| '/' || rhnPackageArch.label
- || '/' || rhnPackage.md5sum
+ || '/' || rhnChecksum.checksum
|| substr(rhnPackage.path, instr(rhnPackage.path, '/', -1))
as new_path
- from rhnPackage, rhnPackagename, rhnPackageEvr, rhnPackageArch
+ from rhnPackage, rhnPackagename, rhnPackageEvr, rhnPackageArch, rhnChecksum
where rhnPackage.name_id = rhnPackageName.id
and rhnPackage.evr_id = rhnPackageEvr.id
and rhnPackage.package_arch_id = rhnPackageArch.id
+ and rhnPackage.checksum_id = rhnChecksum.id
)
where '/' || new_path <> nvl(substr(path, -length(new_path) - 1), 'x')
"""
commit 99a7f4445505ec9b4c68cce8ba00de02cf204b21
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 10:48:20 2009 +0200
changed queries in satsync.py to new rhnChecksum table
diff --git a/backend/satellite_tools/satsync.py b/backend/satellite_tools/satsync.py
index cbc6ece..fff8e71 100644
--- a/backend/satellite_tools/satsync.py
+++ b/backend/satellite_tools/satsync.py
@@ -831,15 +831,16 @@ Please contact your RHN representative""" % (generation, sat_cert.generation))
self._diff_packages()
_query_compare_packages = """
- select p.id, p.md5sum, p.path, p.package_size,
+ select p.id, c.checksum md5sum, p.path, p.package_size,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
- from rhnPackage p
+ from rhnPackage p, rhnChecksum c
where p.name_id = lookup_package_name(:name)
and p.evr_id = lookup_evr(:epoch, :version, :release)
and p.package_arch_id = lookup_package_arch(:arch)
and (p.org_id = :org_id or
(p.org_id is null and :org_id is null))
- and p.md5sum =: md5sum
+ and p.checksum_id = c.id
+ and c.checksum =: md5sum
"""
# XXX the "is null" condition will have to change in multiorg satellites
def _diff_packages(self):
commit 6fecc688a0a421af709d9826e21116365491b268
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 10:40:15 2009 +0200
changed queries in exporter/exportLib.py to new rhnChecksum table
diff --git a/backend/satellite_tools/exporter/exportLib.py b/backend/satellite_tools/exporter/exportLib.py
index cd88b52..d2000d4 100644
--- a/backend/satellite_tools/exporter/exportLib.py
+++ b/backend/satellite_tools/exporter/exportLib.py
@@ -520,7 +520,7 @@ class PackagesDumper(BaseDumper):
p.build_host,
TO_CHAR(p.build_time, 'YYYYMMDDHH24MISS') build_time,
sr.name source_rpm,
- p.md5sum,
+ c.checksum md5sum,
p.vendor,
p.payload_format,
p.compat,
@@ -531,13 +531,15 @@ class PackagesDumper(BaseDumper):
p.header_end,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr
+ rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c
where p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
and p.package_group = pg.id
and p.source_rpm_id = sr.id
and p.path is not null
+ and p.checksum_id = c.id
and rownum < 3
""")
h.execute()
@@ -554,7 +556,7 @@ class _PackageDumper(BaseRowDumper):
def set_attributes(self):
attrs = ["name", "version", "release", "package_arch",
"package_group", "rpm_version", "package_size", "payload_size",
- "build_host", "source_rpm", "md5sum", "payload_format",
+ "build_host", "source_rpm", "md5sum", "payload_format",
"compat", "cookie"]
dict = {
'id' : "rhn-package-%s" % self._row['id'],
@@ -621,10 +623,12 @@ class _PackageDumper(BaseRowDumper):
pc.name, pf.device, pf.inode, pf.file_mode, pf.username,
pf.groupname, pf.rdev, pf.file_size,
TO_CHAR(mtime, 'YYYYMMDDHH24MISS') mtime,
- pf.md5, pf.linkto, pf.flags, pf.verifyflags, pf.lang
- from rhnPackageFile pf, rhnPackageCapability pc
+ c.checksum md5, pf.linkto, pf.flags, pf.verifyflags, pf.lang
+ from rhnPackageFile pf, rhnPackageCapability pc,
+ rhnChecksum c
where pf.capability_id = pc.id
and pf.package_id = :package_id
+ and pf.checksum_id = c.id
""")
h.execute(package_id=self._row['id'])
arr.append(_PackageFilesDumper(self._writer, data_iterator=h))
@@ -647,14 +651,15 @@ class ShortPackagesDumper(BaseDumper):
pe.evr.release release,
pe.evr.epoch epoch,
pa.label package_arch,
- p.md5sum,
+ c.checksum md5sum,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa
+ rhnPackageArch pa, rhnChecksum c
where p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
and p.path is not null
+ and p.checksum_id = c.id
and rownum < 3
""")
h.execute()
@@ -694,16 +699,19 @@ class SourcePackagesDumper(BaseDumper):
ps.payload_size,
ps.build_host,
TO_CHAR(ps.build_time, 'YYYYMMDDHH24MISS') build_time,
- ps.sigmd5,
+ sig.checksum sigmd5,
ps.vendor,
ps.cookie,
ps.package_size,
- ps.md5sum,
+ c.checksum md5sum,
TO_CHAR(ps.last_modified, 'YYYYMMDDHH24MISS') last_modified
- from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr
+ from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c, rhnChecksum sig
where ps.package_group = pg.id
and ps.source_rpm_id = sr.id
and ps.path is not null
+ and ps.checksum_id = c.id
+ and ps.sigchecksum_id = sig.id
and rownum < 3
""")
h.execute()
@@ -895,13 +903,15 @@ class _ErratumDumper(BaseRowDumper):
h.execute(errata_id=self._row['id'])
arr.append(_ErratumBuglistDumper(self._writer, data_iterator=h))
_query_errata_file_info = """
- select ef.id errata_file_id, ef.md5sum,
+ select ef.id errata_file_id, c.checksum md5sum,
ef.filename, eft.label type,
efp.package_id, efps.package_id source_package_id
from rhnErrataFile ef, rhnErrataFileType eft,
- rhnErrataFilePackage efp, rhnErrataFilePackageSource efps
+ rhnErrataFilePackage efp, rhnErrataFilePackageSource efps,
+ rhnChecksum c
where ef.errata_id = :errata_id
and ef.type = eft.id
+ and ef.checksum_id = c.id
%s
and ef.id = efp.errata_file_id (+)
and ef.id = efps.errata_file_id (+)
@@ -1305,11 +1315,12 @@ class _KickstartableTreeDumper(BaseRowDumper):
kstree_id = self._row['id']
h = rhnSQL.prepare("""
select relative_filename "relative-path",
- md5sum,
+ c.checksum md5sum,
file_size "file-size",
TO_CHAR(last_modified, 'YYYYMMDDHH24MISS') "last-modified"
- from rhnKSTreeFile
+ from rhnKSTreeFile, rhnChecksum c
where kstree_id = :kstree_id
+ and p.checksum_id = c.id
""")
h.execute(kstree_id=kstree_id)
return ArrayIterator([_KickstartFilesDumper(self._writer, h)])
@@ -1357,7 +1368,7 @@ def packages_cursor(package_id, sources=0):
p.build_host,
TO_CHAR(p.build_time, 'YYYYMMDDHH24MISS') build_time,
sr.name source_rpm,
- p.md5sum,
+ c.checksum md5sum,
p.vendor,
p.payload_format,
p.compat,
@@ -1367,7 +1378,8 @@ def packages_cursor(package_id, sources=0):
p.copyright,
p.cookie
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr
+ rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c
where p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
@@ -1375,6 +1387,7 @@ def packages_cursor(package_id, sources=0):
and p.source_rpm_id = sr.id
and p.path is not null
and p.id = :package_id
+ and p.checksum_id = c.id
""")
h.execute(package_id=package_id)
return h
@@ -1390,16 +1403,19 @@ def _source_packages_cursor(package_id):
ps.payload_size,
ps.build_host,
TO_CHAR(ps.build_time, 'YYYYMMDDHH24MISS') build_time,
- ps.sigmd5,
+ sig.checksum sigmd5,
ps.vendor,
ps.cookie,
ps.package_size,
- ps.md5sum
- from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr
+ c.checksum md5sum
+ from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c, rhnChecksum sig
where ps.package_group = pg.id
and ps.source_rpm_id = sr.id
and ps.path is not null
and ps.id = :package_id
+ and ps.checksum_id = c.id
+ and ps.sigchecksum_id = sig.id
""")
h.execute(package_id=package_id)
return h
commit 1281f7a94f534db73743d2c8452c4d517173bad9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Oct 20 10:32:53 2009 +0200
changed queries in disk_dumper/iss.py to new rhnChecksum table
diff --git a/backend/satellite_tools/disk_dumper/iss.py b/backend/satellite_tools/disk_dumper/iss.py
index 89e267f..d464780 100644
--- a/backend/satellite_tools/disk_dumper/iss.py
+++ b/backend/satellite_tools/disk_dumper/iss.py
@@ -211,20 +211,22 @@ class Dumper(dumper.XML_Dumper):
try:
if self.start_date:
self.brpm_query = rhnSQL.Statement("""
- select rcp.package_id id, rp.path path, rp.md5sum md5sum,
+ select rcp.package_id id, rp.path path, c.checksum md5sum,
TO_CHAR(rp.last_modified, 'YYYYMMDDHH24MISS') last_modified
- from rhnChannelPackage rcp, rhnPackage rp
+ from rhnChannelPackage rcp, rhnPackage rp, rhnChecksum c
where rcp.package_id = rp.id
and rcp.channel_id = :channel_id
and rp.last_modified >= TO_DATE(:start_date, 'YYYYMMDDHH24MISS')
and rp.last_modified <= TO_DATE(:end_date, 'YYYYMMDDHH24MISS')
+ and rp.checksum_id = c.id
""")
else:
self.brpm_query = rhnSQL.Statement("""
- select rcp.package_id id, rp.path path, rp.md5sum md5sum
- from rhnChannelPackage rcp, rhnPackage rp
+ select rcp.package_id id, rp.path path, c.checksum md5sum
+ from rhnChannelPackage rcp, rhnPackage rp, rhnChecksum c
where rcp.package_id = rp.id
and rcp.channel_id = :channel_id
+ and rp.checksum_id = c.id
""")
brpm_data = rhnSQL.prepare(self.brpm_query)
@@ -414,27 +416,31 @@ class Dumper(dumper.XML_Dumper):
if self.start_date:
self.kickstart_files_query = rhnSQL.Statement("""
select rktf.relative_filename "relative-path",
- rktf.md5sum, rktf.file_size "file-size",
+ c.checksum md5sum, rktf.file_size "file-size",
TO_CHAR(rktf.last_modified, 'YYYYMMDDHH24MISS') "last-modified",
rkt.base_path "base-path",
rkt.label label,
TO_CHAR(rkt.modified, 'YYYYMMDDHH24MISS') "modified"
- from rhnKSTreeFile rktf, rhnKickstartableTree rkt
+ from rhnKSTreeFile rktf, rhnKickstartableTree rkt,
+ rhnChecksum c
where rktf.kstree_id = :kstree_id
and rkt.id = rktf.kstree_id
and rkt.modified >= TO_DATE(:start_date, 'YYYYMMDDHH24MISS')
and rkt.modified <= TO_DATE(:end_date, 'YYYYMMDDHH24MISS')
+ and rktf.checksum_id = c.id
""")
else:
self.kickstart_files_query = rhnSQL.Statement("""
select rktf.relative_filename "relative-path",
- rktf.md5sum, rktf.file_size "file-size",
+ c.checksum md5sum, rktf.file_size "file-size",
TO_CHAR(rktf.last_modified, 'YYYYMMDDHH24MISS') "last-modified",
rkt.base_path "base-path",
rkt.label label
- from rhnKSTreeFile rktf, rhnKickstartableTree rkt
+ from rhnKSTreeFile rktf, rhnKickstartableTree rkt,
+ rhnChecksum c
where rktf.kstree_id = :kstree_id
and rkt.id = rktf.kstree_id
+ and rktf.checksum_id = c.id
""")
kickstart_files = rhnSQL.prepare(self.kickstart_files_query)
self.kickstart_files = []
commit 7f2de614e7026ca2acf27853839612a3275207ed
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 19 16:42:07 2009 +0200
changed queries in disk_dumper/dumper.py to new rhnChecksum table
diff --git a/backend/satellite_tools/disk_dumper/dumper.py b/backend/satellite_tools/disk_dumper/dumper.py
index e1e00c6..f4d0b0b 100644
--- a/backend/satellite_tools/disk_dumper/dumper.py
+++ b/backend/satellite_tools/disk_dumper/dumper.py
@@ -926,15 +926,16 @@ class ShortPackagesDumper(CachedDumper, exportLib.ShortPackagesDumper):
pe.evr.release release,
pe.evr.epoch epoch,
pa.label package_arch,
- p.md5sum,
+ c.checksum md5sum,
p.package_size,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa
+ rhnPackageArch pa, rhnChecksum c
where p.id = :package_id
and p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
+ and p.checksum_id = c.id
""")
CachedDumper.__init__(self, writer, statement=h, params=packages)
@@ -968,7 +969,7 @@ class PackagesDumper(CachedDumper, exportLib.PackagesDumper):
p.build_host,
TO_CHAR(p.build_time, 'YYYYMMDDHH24MISS') build_time,
sr.name source_rpm,
- p.md5sum,
+ c.checksum md5sum,
p.vendor,
p.payload_format,
p.compat,
@@ -979,13 +980,15 @@ class PackagesDumper(CachedDumper, exportLib.PackagesDumper):
p.cookie,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr
+ rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c
where p.id = :package_id
and p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
and p.package_group = pg.id
and p.source_rpm_id = sr.id
+ and p.checksum_id = c.id
""")
CachedDumper.__init__(self, writer, statement=h, params=packages)
@@ -1009,16 +1012,19 @@ class SourcePackagesDumper(CachedDumper, exportLib.SourcePackagesDumper):
ps.payload_size,
ps.build_host,
TO_CHAR(ps.build_time, 'YYYYMMDDHH24MISS') build_time,
- ps.sigmd5,
+ sig.checksum sigmd5,
ps.vendor,
ps.cookie,
ps.package_size,
- ps.md5sum,
+ c.checksum md5sum,
TO_CHAR(ps.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr
+ rhnChecksum c, rhnChecksum sig
where ps.id = :package_id
and ps.package_group = pg.id
and ps.source_rpm_id = sr.id
+ and ps.checksum_id = c.id
+ and ps.sigchecksum_id = sig.id
""")
CachedDumper.__init__(self, writer, statement=h, params=packages)
commit 010fbc4272653b8ddef6e197eaa4dbdf838c3205
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 19 16:39:30 2009 +0200
changed queries in exportLib.py to new rhnChecksum table
diff --git a/backend/satellite_exporter/exporter/exportLib.py b/backend/satellite_exporter/exporter/exportLib.py
index d0e2d82..1b1f8a3 100644
--- a/backend/satellite_exporter/exporter/exportLib.py
+++ b/backend/satellite_exporter/exporter/exportLib.py
@@ -558,7 +558,7 @@ class PackagesDumper(BaseDumper):
p.build_host,
TO_CHAR(p.build_time, 'YYYYMMDDHH24MISS') build_time,
sr.name source_rpm,
- p.md5sum,
+ c.checksum md5sum,
p.vendor,
p.payload_format,
p.compat,
@@ -569,13 +569,15 @@ class PackagesDumper(BaseDumper):
p.header_end,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr
+ rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c
where p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
and p.package_group = pg.id
and p.source_rpm_id = sr.id
and p.path is not null
+ and p.checksum_id = c.id
and rownum < 3
""")
h.execute()
@@ -658,10 +660,11 @@ class _PackageDumper(BaseRowDumper):
pc.name, pf.device, pf.inode, pf.file_mode, pf.username,
pf.groupname, pf.rdev, pf.file_size,
TO_CHAR(mtime, 'YYYYMMDDHH24MISS') mtime,
- pf.md5, pf.linkto, pf.flags, pf.verifyflags, pf.lang
- from rhnPackageFile pf, rhnPackageCapability pc
+ c.checksum md5, pf.linkto, pf.flags, pf.verifyflags, pf.lang
+ from rhnPackageFile pf, rhnPackageCapability pc, rhnChecksum c
where pf.capability_id = pc.id
and pf.package_id = :package_id
+ and pf.checksum_id = c.id
""")
h.execute(package_id=self._row['id'])
arr.append(_PackageFilesDumper(self._writer, data_iterator=h))
@@ -684,15 +687,16 @@ class ShortPackagesDumper(BaseDumper):
pe.evr.release release,
pe.evr.epoch epoch,
pa.label package_arch,
- p.md5sum,
+ c.checksum md5sum,
p.org_id,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa
+ rhnPackageArch pa, rhnChecksum c
where p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
and p.path is not null
+ and p.checksum_id = c.id
and rownum < 3
""")
h.execute()
@@ -731,16 +735,19 @@ class SourcePackagesDumper(BaseDumper):
ps.payload_size,
ps.build_host,
TO_CHAR(ps.build_time, 'YYYYMMDDHH24MISS') build_time,
- ps.sigmd5,
+ sig.checksum sigmd5,
ps.vendor,
ps.cookie,
ps.package_size,
- ps.md5sum,
+ c.checksum md5sum,
TO_CHAR(ps.last_modified, 'YYYYMMDDHH24MISS') last_modified
- from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr
+ from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c, rhnChecksum sig
where ps.package_group = pg.id
and ps.source_rpm_id = sr.id
and ps.path is not null
+ and ps.checksum_id = c.id
+ and ps.sigchecksum_id = sig.id
and rownum < 3
""")
h.execute()
@@ -941,13 +948,15 @@ class _ErratumDumper(BaseRowDumper):
h.execute(errata_id=self._row['id'])
arr.append(_ErratumBuglistDumper(self._writer, data_iterator=h))
_query_errata_file_info = """
- select ef.id errata_file_id, ef.md5sum,
+ select ef.id errata_file_id, c.checksum md5sum,
ef.filename, eft.label type,
efp.package_id, efps.package_id source_package_id
from rhnErrataFile ef, rhnErrataFileType eft,
- rhnErrataFilePackage efp, rhnErrataFilePackageSource efps
+ rhnErrataFilePackage efp, rhnErrataFilePackageSource efps,
+ rhnChecksum c
where ef.errata_id = :errata_id
and ef.type = eft.id
+ and ef.checksum_id = c.id
%s
and ef.id = efp.errata_file_id (+)
and ef.id = efps.errata_file_id (+)
@@ -1359,11 +1368,12 @@ class _KickstartableTreeDumper(BaseRowDumper):
kstree_id = self._row['id']
h = rhnSQL.prepare("""
select relative_filename "relative-path",
- md5sum,
+ c.checksum md5sum,
file_size "file-size",
TO_CHAR(last_modified, 'YYYYMMDDHH24MISS') "last-modified"
- from rhnKSTreeFile
+ from rhnKSTreeFile, rhnChecksum c
where kstree_id = :kstree_id
+ and p.checksum_id = c.id
""")
h.execute(kstree_id=kstree_id)
return ArrayIterator([_KickstartFilesDumper(self._writer, h)])
@@ -1410,7 +1420,7 @@ def packages_cursor(package_id, sources=0):
p.build_host,
TO_CHAR(p.build_time, 'YYYYMMDDHH24MISS') build_time,
sr.name source_rpm,
- p.md5sum,
+ c.checksum md5sum,
p.vendor,
p.payload_format,
p.compat,
@@ -1420,7 +1430,8 @@ def packages_cursor(package_id, sources=0):
p.copyright,
p.cookie
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr
+ rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c
where p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
@@ -1428,6 +1439,7 @@ def packages_cursor(package_id, sources=0):
and p.source_rpm_id = sr.id
and p.path is not null
and p.id = :package_id
+ and p.checksum_id = c.id
""")
h.execute(package_id=package_id)
return h
@@ -1443,16 +1455,19 @@ def _source_packages_cursor(package_id):
ps.payload_size,
ps.build_host,
TO_CHAR(ps.build_time, 'YYYYMMDDHH24MISS') build_time,
- ps.sigmd5,
+ sig.checksum sigmd5,
ps.vendor,
ps.cookie,
ps.package_size,
- ps.md5sum
- from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr
+ c.checksum md5sum
+ from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c, rhnChecksum sig
where ps.package_group = pg.id
and ps.source_rpm_id = sr.id
and ps.path is not null
and ps.id = :package_id
+ and ps.checksum_id = c.id
+ and ps.sigchecksum_id = sig.id
""")
h.execute(package_id=package_id)
return h
commit c639fac87f50bcc67e35373238657e0f0ac9a4f3
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 19 16:29:52 2009 +0200
changed queries in dumper.py to new rhnChecksum table
diff --git a/backend/satellite_exporter/exporter/dumper.py b/backend/satellite_exporter/exporter/dumper.py
index b505dea..e790237 100644
--- a/backend/satellite_exporter/exporter/dumper.py
+++ b/backend/satellite_exporter/exporter/dumper.py
@@ -778,15 +778,16 @@ class ShortPackagesDumper(CachedDumper, exportLib.ShortPackagesDumper):
pe.evr.release release,
pe.evr.epoch epoch,
pa.label package_arch,
- p.md5sum,
+ c.checksum md5sum,
p.package_size,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa
+ rhnPackageArch pa, rhnChecksum c
where p.id = :package_id
and p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
+ and p.checksum_id = c.id
""")
CachedDumper.__init__(self, writer, statement=h, params=packages)
@@ -820,7 +821,7 @@ class PackagesDumper(CachedDumper, exportLib.PackagesDumper):
p.build_host,
TO_CHAR(p.build_time, 'YYYYMMDDHH24MISS') build_time,
sr.name source_rpm,
- p.md5sum,
+ c.checksum md5sum,
p.vendor,
p.payload_format,
p.compat,
@@ -831,13 +832,15 @@ class PackagesDumper(CachedDumper, exportLib.PackagesDumper):
p.cookie,
TO_CHAR(p.last_modified, 'YYYYMMDDHH24MISS') last_modified
from rhnPackage p, rhnPackageName pn, rhnPackageEVR pe,
- rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr
+ rhnPackageArch pa, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c
where p.id = :package_id
and p.name_id = pn.id
and p.evr_id = pe.id
and p.package_arch_id = pa.id
and p.package_group = pg.id
and p.source_rpm_id = sr.id
+ and p.checksum_id = c.id
""")
CachedDumper.__init__(self, writer, statement=h, params=packages)
@@ -861,16 +864,19 @@ class SourcePackagesDumper(CachedDumper, exportLib.SourcePackagesDumper):
ps.payload_size,
ps.build_host,
TO_CHAR(ps.build_time, 'YYYYMMDDHH24MISS') build_time,
- ps.sigmd5,
+ sig.checksum sigmd5,
ps.vendor,
ps.cookie,
ps.package_size,
- ps.md5sum,
+ c.checksum md5sum,
TO_CHAR(ps.last_modified, 'YYYYMMDDHH24MISS') last_modified
- from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr
+ from rhnPackageSource ps, rhnPackageGroup pg, rhnSourceRPM sr,
+ rhnChecksum c, rhnChecksum sig
where ps.id = :package_id
and ps.package_group = pg.id
and ps.source_rpm_id = sr.id
+ and ps.checksum_id = c.id
+ and ps.sigchecksum_id = sig.id
""")
CachedDumper.__init__(self, writer, statement=h, params=packages)
commit 5f797cd32f1fc7cc764d415b9d6c43dbf9fc4889
Merge: 51a2a03... 68957b0...
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 16:28:01 2009 +0200
Merge branch 'master' into sha256-support2
commit 51a2a030467dddc38e30748ca4eb65cedef5b7f6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 14:58:18 2009 +0200
fixed syntax error
diff --git a/schema/spacewalk/common/tables/rhnErrataFile.sql b/schema/spacewalk/common/tables/rhnErrataFile.sql
index 6865788..f6dbe7e 100644
--- a/schema/spacewalk/common/tables/rhnErrataFile.sql
+++ b/schema/spacewalk/common/tables/rhnErrataFile.sql
@@ -24,7 +24,7 @@ CREATE TABLE rhnErrataFile
type NUMBER NOT NULL
CONSTRAINT rhn_erratafile_type_fk
REFERENCES rhnErrataFileType (id),
- checksum_id NUMBER NOT NULL,
+ checksum_id NUMBER NOT NULL
CONSTRAINT rhn_erratafile_chsum_fk
REFERENCES rhnChecksum (id),
filename VARCHAR2(1024) NOT NULL,
diff --git a/schema/spacewalk/common/tables/rhnErrataFileTmp.sql b/schema/spacewalk/common/tables/rhnErrataFileTmp.sql
index 8d734f8..0656f82 100644
--- a/schema/spacewalk/common/tables/rhnErrataFileTmp.sql
+++ b/schema/spacewalk/common/tables/rhnErrataFileTmp.sql
@@ -24,7 +24,7 @@ CREATE TABLE rhnErrataFileTmp
type NUMBER NOT NULL
CONSTRAINT rhn_erratafiletmp_type_fk
REFERENCES rhnErrataFileType (id),
- checksum_id NUMBER NOT NULL,
+ checksum_id NUMBER NOT NULL
CONSTRAINT rhn_erratafiletmp_chsum_fk
REFERENCES rhnChecksum (id),
filename VARCHAR2(128) NOT NULL,
diff --git a/schema/spacewalk/common/tables/rhnFile.sql b/schema/spacewalk/common/tables/rhnFile.sql
index b2c8b00..2f17a3f 100644
--- a/schema/spacewalk/common/tables/rhnFile.sql
+++ b/schema/spacewalk/common/tables/rhnFile.sql
@@ -24,7 +24,7 @@ CREATE TABLE rhnFile
REFERENCES web_customer (id)
ON DELETE CASCADE,
file_size NUMBER NOT NULL,
- checksum_id NUMBER NOT NULL,
+ checksum_id NUMBER NOT NULL
CONSTRAINT rhn_file_chsum_fk
REFERENCES rhnChecksum (id),
path VARCHAR2(1000) NOT NULL,
diff --git a/schema/spacewalk/common/tables/rhnPackage.sql b/schema/spacewalk/common/tables/rhnPackage.sql
index 223eab8..0c4427d 100644
--- a/schema/spacewalk/common/tables/rhnPackage.sql
+++ b/schema/spacewalk/common/tables/rhnPackage.sql
@@ -45,7 +45,7 @@ CREATE TABLE rhnPackage
source_rpm_id NUMBER
CONSTRAINT rhn_package_srcrpmid_fk
REFERENCES rhnSourceRPM (id),
- checksum_id NUMBER NOT NULL,
+ checksum_id NUMBER NOT NULL
CONSTRAINT rhn_package_chsum_fk
REFERENCES rhnChecksum (id),
vendor VARCHAR2(64) NOT NULL,
diff --git a/schema/spacewalk/common/tables/rhnPackageFile.sql b/schema/spacewalk/common/tables/rhnPackageFile.sql
index 896b872..8ec9bea 100644
--- a/schema/spacewalk/common/tables/rhnPackageFile.sql
+++ b/schema/spacewalk/common/tables/rhnPackageFile.sql
@@ -31,7 +31,7 @@ CREATE TABLE rhnPackageFile
rdev NUMBER NOT NULL,
file_size NUMBER NOT NULL,
mtime DATE NOT NULL,
- checksum_id NUMBER NOT NULL,
+ checksum_id NUMBER NOT NULL
CONSTRAINT rhn_package_file_chsum_fk
REFERENCES rhnChecksum (id),
linkto VARCHAR2(256),
commit 3013c7807542756983ea69474002c8ebb58ac593
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 14:43:45 2009 +0200
added table dependencies (rhnChecksum/rhnChecksumType)
diff --git a/schema/spacewalk/common/tables/tables.deps b/schema/spacewalk/common/tables/tables.deps
index 5668da7..1128cec 100644
--- a/schema/spacewalk/common/tables/tables.deps
+++ b/schema/spacewalk/common/tables/tables.deps
@@ -42,14 +42,14 @@ rhnActionVerifyResult :: rhnAction rhnPackageName rhnPackageEVR \
rhnPackageCapability
rhnActivationKey :: rhnRegToken rhnKickstartSession
rhnArchTypeActions :: rhnArchType rhnActionType
-rhnAppInstallSession :: rhnAppInstallInstance
+rhnAppInstallSession :: rhnAppInstallInstance rhnChecksum
rhnAppInstallSessionData :: rhnAppInstallSession
rhnBlacklistObsoletes :: rhnChannel rhnPackageName rhnChannelPackage \
rhnPackage
rhnCache :: rhnCacheKey
rhnCacheTimestamps :: rhnCacheKey rhnCache
rhnChannel :: web_customer rhnChannelArch rhnChannelProduct \
- rhnProductName rhnChecksumType
+ rhnProductName rhnChecksum
rhnChannelArch :: rhnArchType
rhnChannelDownloads :: rhnChannel rhnDownloads
rhnChannelComps :: rhnChannel
@@ -67,8 +67,10 @@ rhnChannelPermission :: rhnChannelPermissionRole rhnChannel web_contac
rhnChannelRelationship :: rhnRelationshipType rhnChannel
rhnChannelTrust :: rhnChannel
rhnChannelContentSource :: rhnChannel rhnContentSourceType
+rhnChecksum :: rhnChecksumType
rhnClientCapability :: rhnClientCapabilityName
rhnClientOptionVersionMap :: rhnClientConfigOption rhnPackageEVR
+rhnConfigContent :: rhnChecksum
rhnConfigFile :: rhnConfigChannel rhnConfigFileState rhnConfigFileName
rhnConfigFile_foreignkeys :: rhnConfigRevision
rhnConfigChannel :: web_customer rhnConfigChannelType
@@ -86,16 +88,16 @@ rhnDumpSnapshotChannelPkgSrc :: rhnDumpSnapshotChannel rhnPackageSource
rhnDumpSnapshotChannelKSTree :: rhnDumpSnapshotChannel rhnKickstartableTree
rhnEmailAddress :: rhnEmailAddressState web_contact
rhnEntitlementQueue :: web_customer
-rhnErrata :: web_customer rhnErrataSeverity
+rhnErrata :: rhnChecksum web_customer rhnErrataSeverity
rhnErrataBuglist :: rhnErrata
rhnErrataBuglistTmp :: rhnErrataTmp
rhnErrataCVE :: rhnErrata rhnCVE
rhnErrataCVETmp :: rhnErrataTmp rhnCVE
-rhnErrataFile :: rhnErrata rhnErrataFileType
+rhnErrataFile :: rhnChecksum rhnErrata rhnErrataFileType
rhnErrataFileChannel :: rhnChannel rhnErrataFile rhnChannelErrata
rhnErrataFilePackage :: rhnPackage rhnErrataFile rhnErrataPackage
rhnErrataFilePackageSource :: rhnErrataFile rhnPackageSource rhnErrataPackage
-rhnErrataFileTmp :: rhnErrataTmp rhnErrataFileType
+rhnErrataFileTmp :: rhnChecksum rhnErrataTmp rhnErrataFileType
rhnErrataFileChannelTmp :: rhnErrataFileTmp rhnChannel
rhnErrataFilePackageTmp :: rhnErrataFileTmp rhnChannel
rhnErrataKeyword :: rhnErrata
@@ -106,7 +108,7 @@ rhnErrataRelationship :: rhnRelationshipType rhnErrata
rhnErrataRelationshipTmp :: rhnRelationshipType rhnErrataTmp rhnErrata
rhnErrataClonedTmp :: rhnErrataTmp
rhnErrataTmp :: web_customer
-rhnFile :: web_customer
+rhnFile :: web_customer rhnChecksum
rhnFileLocation :: rhnFile
rhnGrailComponents :: rhnUserGroupType
rhnGrailComponentChoices :: web_contact
@@ -124,7 +126,8 @@ rhnKickstartSession :: rhnKSData web_customer rhnServer rhnAction \
rhnKickstartSessionState rhnServerProfile \
rhnKickstartVirtualizationType
rhnKickstartSessionHistory :: rhnKickstartSession rhnKickstartSessionState
-rhnKSTreeFile :: rhnKickstartableTree rhnChannelErrata rhnErrata
+rhnKSTreeFile :: rhnKickstartableTree rhnChannelErrata rhnErrata \
+ rhnChecksum
rhnKSRawData :: rhnKSData
rhnKickstartTimezone :: rhnKSInstallType
rhnMessage :: rhnMessageType rhnMessagePriority
@@ -137,13 +140,14 @@ rhnOrgState :: rhnOrgAvailableStates web_customer
rhnOrgStateTransitions :: rhnOrgAvailableStates
rhnOrgQuota :: web_customer
rhnPackage :: rhnPackageName rhnPackageEVR rhnPackageArch \
- rhnPackageGroup rhnSourceRPM web_customer
+ rhnPackageGroup rhnSourceRPM web_customer \
+ rhnChecksum
rhnPackageArch :: rhnArchType
rhnPackageDeltaElement :: rhnPackageDelta rhnTransactionPackage
rhnPackageEVR :: evr_t
rhnPackageChangelog :: rhnPackage
rhnPackageConflicts :: rhnPackage rhnPackageCapability
-rhnPackageFile :: rhnPackage rhnPackageCapability
+rhnPackageFile :: rhnChecksum rhnPackage rhnPackageCapability
rhnPackageKeyAssociation :: rhnPackageKey rhnPackage
rhnPackageKey :: rhnPackageKeyType rhnPackageProvider
rhnPackageObsoletes :: rhnPackage rhnPackageCapability
@@ -151,7 +155,8 @@ rhnPackageNEVRA :: rhnPackageName rhnPackageEVR rhnPackageArch
rhnPackageProvides :: rhnPackage rhnPackageCapability
rhnPackageRequires :: rhnPackage rhnPackageCapability
rhnPackageSenseMap :: rhnPackageSense
-rhnPackageSource :: web_customer rhnSourceRPM rhnFile rhnPackageGroup
+rhnPackageSource :: web_customer rhnSourceRPM rhnFile rhnPackageGroup \
+ rhnChecksum
rhnPackageSyncBlacklist :: rhnPackageName web_customer
rhnPathChannelMap :: rhnChannel
rhnProduct :: rhnProductLine
commit fe13851acb231881573f419c35d7cb96a5ee6e25
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 14:22:09 2009 +0200
upgrade script for rhnServerActionVerifyResult
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/019-1-rhnServerActionVerifyResult-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/019-1-rhnServerActionVerifyResult-checksum.sql
new file mode 100644
index 0000000..7cf3f9a
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/019-1-rhnServerActionVerifyResult-checksum.sql
@@ -0,0 +1,7 @@
+alter table rhnServerActionVerifyResult
+ rename column md5_differs to checksum_differs;
+alter table rhnServerActionVerifyResult
+ drop constraint rhn_sactionvr_md5_ck;
+alter table rhnServerActionVerifyResult
+ add constraint rhn_sactionvr_chsum_ck
+ CHECK (checksum_differs in ( 'Y' , 'N' , '?' ));
commit 724235eedee4138c8f0162876f718d167cd43835
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 13:57:52 2009 +0200
upgrade script for rhnPackageSource
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-1-rhnPackageSource-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-1-rhnPackageSource-checksum.sql
new file mode 100644
index 0000000..1c6c5de
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-1-rhnPackageSource-checksum.sql
@@ -0,0 +1,6 @@
+alter table rhnPackageSource add sigchecksum_id NUMBER
+ CONSTRAINT rhn_pkgsrc_sigchsum_fk
+ REFERENCES rhnChecksum (id);
+alter table rhnPackageSource add checksum_id NUMBER
+ CONSTRAINT rhn_pkgsrc_chsum_fk
+ REFERENCES rhnChecksum (id);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-2-rhnPackageSource-data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-2-rhnPackageSource-data.sql
new file mode 100644
index 0000000..5f0342d
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-2-rhnPackageSource-data.sql
@@ -0,0 +1,21 @@
+insert into rhnChecksum (id, checksum_type_id, checksum)
+ (select s.id, md5.id, s.sigmd5
+ from rhnPackageSource s,
+ (select id from rhnChecksumType where label = 'md5') md5
+ );
+
+update rhnPackageSource s
+ set sigchecksum_id = (select c.id from rhnChecksum c where c.checksum = s.sigmd5);
+
+commit;
+
+insert into rhnChecksum (id, checksum_type_id, checksum)
+ (select s.id, md5.id, s.md5sum
+ from rhnPackageSource s,
+ (select id from rhnChecksumType where label = 'md5') md5
+ );
+
+update rhnPackageSource s
+ set checksum_id = (select c.id from rhnChecksum c where c.checksum = s.md5sum);
+
+commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-3-rhnPackageSource-md5.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-3-rhnPackageSource-md5.sql
new file mode 100644
index 0000000..191f6e2
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-3-rhnPackageSource-md5.sql
@@ -0,0 +1,2 @@
+alter table rhnPackageSource drop column sigmd5;
+alter table rhnPackageSource drop column md5sum;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-4-rhnPackageSource-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-4-rhnPackageSource-checksum.sql
new file mode 100644
index 0000000..06510f3
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/017-4-rhnPackageSource-checksum.sql
@@ -0,0 +1,2 @@
+alter table rhnPackageSource modify sigchecksum_id NUMBER NOT NULL;
+alter table rhnPackageSource modify checksum_id NUMBER NOT NULL;
commit e42fef5648e28bc59e2f601431cc47820c62d42d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 13:52:31 2009 +0200
upgrade script for rhnAppInstallSession
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-1-rhnAppInstallSession-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-1-rhnAppInstallSession-checksum.sql
new file mode 100644
index 0000000..c8e87a7
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-1-rhnAppInstallSession-checksum.sql
@@ -0,0 +1,3 @@
+alter table rhnAppInstallSession add checksum_id NUMBER
+ CONSTRAINT rhn_appinst_session_chsum_fk
+ REFERENCES rhnChecksum (id);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-2-rhnAppInstallSession-data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-2-rhnAppInstallSession-data.sql
new file mode 100644
index 0000000..c6bc5aa
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-2-rhnAppInstallSession-data.sql
@@ -0,0 +1,11 @@
+insert into rhnChecksum (id, checksum_type_id, checksum)
+ (select s.id, md5.id, s.md5sum
+ from rhnAppInstallSession s,
+ (select id from rhnChecksumType where label = 'md5') md5
+ );
+
+update rhnAppInstallSession s
+ set checksum_id = (select c.id from rhnChecksum c where c.checksum = s.md5sum);
+
+commit;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-3-rhnAppInstallSession-md5.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-3-rhnAppInstallSession-md5.sql
new file mode 100644
index 0000000..714be2b
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-3-rhnAppInstallSession-md5.sql
@@ -0,0 +1 @@
+alter table rhnAppInstallSession drop column md5sum;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-4-rhnAppInstallSession-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-4-rhnAppInstallSession-checksum.sql
new file mode 100644
index 0000000..ede722c
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/018-4-rhnAppInstallSession-checksum.sql
@@ -0,0 +1 @@
+alter table rhnAppInstallSession modify checksum_id NUMBER NOT NULL;
commit 9c72cc0f2654c9d35190b2d68c20c103848eac3c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 13:48:57 2009 +0200
upgrade script for rhnConfigContent
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-1-rhnConfigContent-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-1-rhnConfigContent-checksum.sql
new file mode 100644
index 0000000..09824b5
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-1-rhnConfigContent-checksum.sql
@@ -0,0 +1,3 @@
+alter table rhnConfigContent add checksum_id NUMBER
+ CONSTRAINT rhn_confcontent_chsum_fk
+ REFERENCES rhnChecksum (id);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-2-rhnConfigContent-data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-2-rhnConfigContent-data.sql
new file mode 100644
index 0000000..2bd13b0
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-2-rhnConfigContent-data.sql
@@ -0,0 +1,11 @@
+insert into rhnChecksum (id, checksum_type_id, checksum)
+ (select cc.id, md5.id, cc.md5sum
+ from rhnConfigContent cc,
+ (select id from rhnChecksumType where label = 'md5') md5
+ );
+
+update rhnConfigContent cc
+ set checksum_id = (select c.id from rhnChecksum c where c.checksum = cc.md5sum);
+
+commit;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-3-rhnConfigContent-md5.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-3-rhnConfigContent-md5.sql
new file mode 100644
index 0000000..81b835f
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-3-rhnConfigContent-md5.sql
@@ -0,0 +1 @@
+alter table rhnConfigContent drop column md5sum;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-4-rhnConfigContent-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-4-rhnConfigContent-checksum.sql
new file mode 100644
index 0000000..2af6aa0
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/016-4-rhnConfigContent-checksum.sql
@@ -0,0 +1 @@
+alter table rhnConfigContent modify checksum_id NUMBER NOT NULL;
commit 8f9e1ceacdfa78f1924a3418ce633317e68798dd
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 13:44:59 2009 +0200
upgrade script for rhnKSTreeFile
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-1-rhnKSTreeFile-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-1-rhnKSTreeFile-checksum.sql
new file mode 100644
index 0000000..4c695d0
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-1-rhnKSTreeFile-checksum.sql
@@ -0,0 +1,3 @@
+alter table rhnKSTreeFile add checksum_id NUMBER
+ CONSTRAINT rhn_kstreefile_chsum_fk
+ REFERENCES rhnChecksum (id);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-2-rhnKSTreeFile-data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-2-rhnKSTreeFile-data.sql
new file mode 100644
index 0000000..2e41006
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-2-rhnKSTreeFile-data.sql
@@ -0,0 +1,11 @@
+insert into rhnChecksum (id, checksum_type_id, checksum)
+ (select k.id, md5.id, k.md5sum
+ from rhnKSTreeFile k,
+ (select id from rhnChecksumType where label = 'md5') md5
+ );
+
+update rhnKSTreeFile k
+ set checksum_id = (select c.id from rhnChecksum c where c.checksum = k.md5sum);
+
+commit;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-3-rhnKSTreeFile-md5.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-3-rhnKSTreeFile-md5.sql
new file mode 100644
index 0000000..3915149
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-3-rhnKSTreeFile-md5.sql
@@ -0,0 +1 @@
+alter table rhnKSTreeFile drop column md5sum;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-4-rhnKSTreeFile-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-4-rhnKSTreeFile-checksum.sql
new file mode 100644
index 0000000..cf47171
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/015-4-rhnKSTreeFile-checksum.sql
@@ -0,0 +1 @@
+alter table rhnKSTreeFile modify checksum_id NUMBER NOT NULL;
commit 58e66b297aadbe6ad44e1262f1156020d4452ef3
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 13:40:42 2009 +0200
upgrade script for rhnErrataFileTmp
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-1-rhnErrataFileTmp-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-1-rhnErrataFileTmp-checksum.sql
new file mode 100644
index 0000000..2cbc875
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-1-rhnErrataFileTmp-checksum.sql
@@ -0,0 +1,3 @@
+alter table rhnErrataFileTmp add checksum_id NUMBER
+ CONSTRAINT rhn_erratafiletmp_chsum_fk
+ REFERENCES rhnChecksum (id);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-2-rhnErrataFileTmp-data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-2-rhnErrataFileTmp-data.sql
new file mode 100644
index 0000000..d7bac43
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-2-rhnErrataFileTmp-data.sql
@@ -0,0 +1,11 @@
+insert into rhnChecksum (id, checksum_type_id, checksum)
+ (select e.id, md5.id, e.md5sum
+ from rhnErrataFileTmp e,
+ (select id from rhnChecksumType where label = 'md5') md5
+ );
+
+update rhnErrataFileTmp e
+ set checksum_id = (select c.id from rhnChecksum c where c.checksum = e.md5sum);
+
+commit;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-3-rhnErrataFileTmp-md5.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-3-rhnErrataFileTmp-md5.sql
new file mode 100644
index 0000000..fb6685a
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-3-rhnErrataFileTmp-md5.sql
@@ -0,0 +1 @@
+alter table rhnErrataFileTmp drop column md5sum;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-4-rhnErrataFileTmp-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-4-rhnErrataFileTmp-checksum.sql
new file mode 100644
index 0000000..c0b4e41
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/014-4-rhnErrataFileTmp-checksum.sql
@@ -0,0 +1 @@
+alter table rhnErrataFileTmp modify checksum_id NUMBER NOT NULL;
commit 7a80eaa514cd2d184ba501e0723f5c4e855a96a7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 13:38:51 2009 +0200
upgrade script for rhnErrataFile
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-1-rhnErrataFile-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-1-rhnErrataFile-checksum.sql
new file mode 100644
index 0000000..ba57710
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-1-rhnErrataFile-checksum.sql
@@ -0,0 +1,3 @@
+alter table rhnErrataFile add checksum_id NUMBER
+ CONSTRAINT rhn_erratafile_chsum_fk
+ REFERENCES rhnChecksum (id);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-2-rhnErrataFile-data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-2-rhnErrataFile-data.sql
new file mode 100644
index 0000000..166e7d5
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-2-rhnErrataFile-data.sql
@@ -0,0 +1,11 @@
+insert into rhnChecksum (id, checksum_type_id, checksum)
+ (select e.id, md5.id, e.md5sum
+ from rhnErrataFile e,
+ (select id from rhnChecksumType where label = 'md5') md5
+ );
+
+update rhnErrataFile e
+ set checksum_id = (select c.id from rhnChecksum c where c.checksum = e.md5sum);
+
+commit;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-3-rhnErrataFile-md5.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-3-rhnErrataFile-md5.sql
new file mode 100644
index 0000000..17a8c2f
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-3-rhnErrataFile-md5.sql
@@ -0,0 +1 @@
+alter table rhnErrataFile drop column md5sum;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-4-rhnErrataFile-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-4-rhnErrataFile-checksum.sql
new file mode 100644
index 0000000..41a9318
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/013-4-rhnErrataFile-checksum.sql
@@ -0,0 +1 @@
+alter table rhnErrataFile modify checksum_id NUMBER NOT NULL;
commit 3a383da1cb324bf19297cab723da545643c4f12f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 13:34:12 2009 +0200
upgrade script for rhnPackageFile
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-1-rhnPackageFile-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-1-rhnPackageFile-checksum.sql
new file mode 100644
index 0000000..20462ea
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-1-rhnPackageFile-checksum.sql
@@ -0,0 +1,3 @@
+alter table rhnPackageFile add checksum_id NUMBER
+ CONSTRAINT rhn_package_file_chsum_fk
+ REFERENCES rhnChecksum (id);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-2-rhnPackageFile-data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-2-rhnPackageFile-data.sql
new file mode 100644
index 0000000..190f03b
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-2-rhnPackageFile-data.sql
@@ -0,0 +1,11 @@
+insert into rhnChecksum (id, checksum_type_id, checksum)
+ (select p.id, md5.id, p.md5sum
+ from rhnPackageFile p,
+ (select id from rhnChecksumType where label = 'md5') md5
+ );
+
+update rhnPackageFile p
+ set checksum_id = (select c.id from rhnChecksum c where c.checksum = p.md5sum);
+
+commit;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-3-rhnPackageFile-md5.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-3-rhnPackageFile-md5.sql
new file mode 100644
index 0000000..f8ad8db
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-3-rhnPackageFile-md5.sql
@@ -0,0 +1 @@
+alter table rhnPackageFile drop column md5;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-4-rhnPackageFile-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-4-rhnPackageFile-checksum.sql
new file mode 100644
index 0000000..b197ad7
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/012-4-rhnPackageFile-checksum.sql
@@ -0,0 +1 @@
+alter table rhnPackageFile modify checksum_id NUMBER NOT NULL;
commit dd9783007412b655af2611d951e97203d20a12bd
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 13:29:52 2009 +0200
upgrade script for rhnFile
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-1-rhnFile-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-1-rhnFile-checksum.sql
new file mode 100644
index 0000000..49abf2c
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-1-rhnFile-checksum.sql
@@ -0,0 +1,3 @@
+alter table rhnFile add checksum_id NUMBER
+ CONSTRAINT rhn_file_chsum_fk
+ REFERENCES rhnChecksum (id);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-2-rhnFile-data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-2-rhnFile-data.sql
new file mode 100644
index 0000000..7e5e185
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-2-rhnFile-data.sql
@@ -0,0 +1,10 @@
+insert into rhnChecksum (id, checksum_type_id, checksum)
+ (select f.id, md5.id, f.md5sum
+ from rhnFile f,
+ (select id from rhnChecksumType where label = 'md5') md5
+ );
+
+update rhnFile f
+ set checksum_id = (select id from rhnChecksum c where c.checksum = f.md5sum);
+
+commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-3-rhnFile-md5.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-3-rhnFile-md5.sql
new file mode 100644
index 0000000..8cfe5f8
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-3-rhnFile-md5.sql
@@ -0,0 +1,2 @@
+alter table rhnFile drop column md5sum;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-4-rhnFile-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-4-rhnFile-checksum.sql
new file mode 100644
index 0000000..d1c4b74
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/010-4-rhnFile-checksum.sql
@@ -0,0 +1 @@
+alter table rhnFile modify checksum_id NUMBER NOT NULL;
commit 76e00c0580aabc0f7ac48c4fd0b4d8f2cd5f4a3c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 13:26:17 2009 +0200
upgrade scripts for rhnPackage
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-1-rhnPackage-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-1-rhnPackage-checksum.sql
new file mode 100644
index 0000000..006cc7f
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-1-rhnPackage-checksum.sql
@@ -0,0 +1,3 @@
+alter table rhnPackage add checksum_id NUMBER
+ CONSTRAINT rhn_package_chsum_fk
+ REFERENCES rhnChecksum (id);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-2-rhnPackage-data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-2-rhnPackage-data.sql
new file mode 100644
index 0000000..eb5ab29
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-2-rhnPackage-data.sql
@@ -0,0 +1,11 @@
+insert into rhnChecksum (id, checksum_type_id, checksum)
+ (select p.id, md5.id, p.md5sum
+ from rhnPackage p,
+ (select id from rhnChecksumType where label = 'md5') md5
+ );
+
+update rhnPackage p
+ set checksum_id = (select c.id from rhnChecksum c where c.checksum = p.md5sum);
+
+commit;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-3-rhnPackage-md5.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-3-rhnPackage-md5.sql
new file mode 100644
index 0000000..df2eca0
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-3-rhnPackage-md5.sql
@@ -0,0 +1 @@
+alter table rhnPackage drop column md5sum;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-4-rhnPackage-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-4-rhnPackage-checksum.sql
new file mode 100644
index 0000000..b67d9cc
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/011-4-rhnPackage-checksum.sql
@@ -0,0 +1 @@
+alter table rhnPackage modify checksum_id NUMBER NOT NULL;
commit 3f85f7a97c0838d271309206506778bbaa58d2d2
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 12:11:20 2009 +0200
added index on rhnChecksum(checksum)
diff --git a/schema/spacewalk/common/tables/rhnChecksum.sql b/schema/spacewalk/common/tables/rhnChecksum.sql
index 815cc53..7eb526b 100644
--- a/schema/spacewalk/common/tables/rhnChecksum.sql
+++ b/schema/spacewalk/common/tables/rhnChecksum.sql
@@ -28,4 +28,6 @@ rhnChecksum
enable row movement
;
+CREATE INDEX rhnChecksum_chsum_idx on rhnChecksum(checksum);
+
CREATE SEQUENCE rhnChecksum_seq;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql
index 815cc53..7eb526b 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql
@@ -28,4 +28,6 @@ rhnChecksum
enable row movement
;
+CREATE INDEX rhnChecksum_chsum_idx on rhnChecksum(checksum);
+
CREATE SEQUENCE rhnChecksum_seq;
commit 12a3daefbd48b2b60de220d24b1854fe412d4d9e
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 11:54:26 2009 +0200
fixed rhnChecksumType data
diff --git a/schema/spacewalk/common/data/rhnChecksumType.sql b/schema/spacewalk/common/data/rhnChecksumType.sql
index a788487..8b0a71f 100644
--- a/schema/spacewalk/common/data/rhnChecksumType.sql
+++ b/schema/spacewalk/common/data/rhnChecksumType.sql
@@ -18,20 +18,17 @@
insert into rhnChecksumType (id, label, description) values
- (rhn_checksum_id_seq.nextval, 'md5', 'md5' );
+ (rhn_checksum_id_seq.nextval, 'md5', 'md5sum' );
insert into rhnChecksumType (id, label, description) values
- (rhn_checksum_id_seq.nextval, 'sha1', 'sha' );
+ (rhn_checksum_id_seq.nextval, 'sha1', 'sha1sum' );
insert into rhnChecksumType (id, label, description) values
- (rhn_checksum_id_seq.nextval, 'sha-256', 'sha256' );
+ (rhn_checksum_id_seq.nextval, 'sha224', 'sha224sum' );
insert into rhnChecksumType (id, label, description) values
- (rhn_checksum_id_seq.nextval, 'sha-384', 'sha384' );
+ (rhn_checksum_id_seq.nextval, 'sha256', 'sha256sum' );
insert into rhnChecksumType (id, label, description) values
- (rhn_checksum_id_seq.nextval, 'sha-512', 'sha512' );
+ (rhn_checksum_id_seq.nextval, 'sha384', 'sha384sum' );
+insert into rhnChecksumType (id, label, description) values
+ (rhn_checksum_id_seq.nextval, 'sha512', 'sha512sum' );
commit;
---
---
--- Revision 1.1 2009/06/26 11:00:17 pkilambi
---
-
commit ab59a1eda677f723a2d5fe545aedf03d0fb07d95
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 11:29:13 2009 +0200
renamed primary key to ID
diff --git a/schema/spacewalk/common/tables/rhnChecksum.sql b/schema/spacewalk/common/tables/rhnChecksum.sql
index 7f68b3c..815cc53 100644
--- a/schema/spacewalk/common/tables/rhnChecksum.sql
+++ b/schema/spacewalk/common/tables/rhnChecksum.sql
@@ -18,7 +18,7 @@
create table
rhnChecksum
(
- checksum_id number not null
+ id number not null
constraint rhnChecksum_pk primary key,
checksum_type_id number not null
constraint rhnChecksum_typeid_fk
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql
index 7f68b3c..815cc53 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql
@@ -18,7 +18,7 @@
create table
rhnChecksum
(
- checksum_id number not null
+ id number not null
constraint rhnChecksum_pk primary key,
checksum_type_id number not null
constraint rhnChecksum_typeid_fk
commit f4dc55f4e0ef5fd7d67c799d35cda381db5059d4
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 11:23:00 2009 +0200
added upgrade script for rhnChecksumType
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/004-rhnChecksumType-table.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/004-rhnChecksumType-table.sql
new file mode 100644
index 0000000..6543051
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/004-rhnChecksumType-table.sql
@@ -0,0 +1,37 @@
+--
+-- Copyright (c) 2008 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+CREATE TABLE rhnChecksumType
+(
+ id NUMBER NOT NULL
+ CONSTRAINT rhn_checksumtype_id_pk PRIMARY KEY
+ USING INDEX TABLESPACE [[64k_tbs]],
+ label VARCHAR2(32) NOT NULL,
+ description VARCHAR2(64) NOT NULL,
+ created DATE DEFAULT (sysdate) NOT NULL,
+ modified DATE DEFAULT (sysdate) NOT NULL
+)
+ENABLE ROW MOVEMENT
+;
+
+CREATE INDEX rhn_checksumtype_label_id_idx
+ ON rhnChecksumType( label, id )
+ TABLESPACE [[64k_tbs]];
+
+ALTER TABLE rhnChecksumType
+ ADD CONSTRAINT rhn_checksumtype_label_uq UNIQUE (label);
+
+CREATE SEQUENCE rhn_checksum_id_seq;
+
commit b500a2d5f1d6b69fa0609cd3e3daacccbc53c3b8
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 11:21:46 2009 +0200
fixed syntax (ORA-00907: missing right parenthesis)
diff --git a/schema/spacewalk/common/tables/rhnChecksumType.sql b/schema/spacewalk/common/tables/rhnChecksumType.sql
index da9908b..6543051 100644
--- a/schema/spacewalk/common/tables/rhnChecksumType.sql
+++ b/schema/spacewalk/common/tables/rhnChecksumType.sql
@@ -20,10 +20,8 @@ CREATE TABLE rhnChecksumType
USING INDEX TABLESPACE [[64k_tbs]],
label VARCHAR2(32) NOT NULL,
description VARCHAR2(64) NOT NULL,
- created DATE NOT NULL
- DEFAULT (sysdate),
- modified DATE NOT NULL
- DEFAULT (sysdate)
+ created DATE DEFAULT (sysdate) NOT NULL,
+ modified DATE DEFAULT (sysdate) NOT NULL
)
ENABLE ROW MOVEMENT
;
commit a872032cb6b24c460769c6dae285f4139347df9f
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 12 11:11:58 2009 +0200
upgrade script for rhnChecksum
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql
new file mode 100644
index 0000000..7f68b3c
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnChecksum-table.sql
@@ -0,0 +1,31 @@
+--
+-- Copyright (c) 2009 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+-- The checksum associated with a package/file/etc...
+
+create table
+rhnChecksum
+(
+ checksum_id number not null
+ constraint rhnChecksum_pk primary key,
+ checksum_type_id number not null
+ constraint rhnChecksum_typeid_fk
+ references rhnChecksumType(id),
+ checksum varchar2(128) not null
+)
+ enable row movement
+;
+
+CREATE SEQUENCE rhnChecksum_seq;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnPackageChecksum-table.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnPackageChecksum-table.sql
deleted file mode 100644
index cb99de1..0000000
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnPackageChecksum-table.sql
+++ /dev/null
@@ -1,39 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
---
--- The types of checksum associated with a package... md5sum, sha1, sha256...?
-
-create table
-rhnPackageChecksum
-(
- package_id number not null
- constraint rhn_pkgcs_id_fk
- references rhnPackage(id),
- checksum_type_id number not null
- constraint rhn_pkg_checksum_type_id_fk
- references rhnChecksumType(id),
- checksum varchar2(128)
- constraint rhn_pkgchecksum_type_name_nn not null
-)
- enable row movement
-;
-
-create index rhn_pkgcsum_id_n_idx
- on rhnPackageChecksum (package_id, checksum_type_id)
-
-alter table rhnPackageChecksum add constraint rhn_pkg_checksum_id_pk primary key (package_id, checksum_type_id);
-
commit 8c09b01823a65b9458561876904bba5466214671
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 9 16:43:20 2009 +0200
renamed md5 to checksum
diff --git a/schema/spacewalk/common/tables/rhnServerActionVerifyResult.sql b/schema/spacewalk/common/tables/rhnServerActionVerifyResult.sql
index 2e773a6..4404cec 100644
--- a/schema/spacewalk/common/tables/rhnServerActionVerifyResult.sql
+++ b/schema/spacewalk/common/tables/rhnServerActionVerifyResult.sql
@@ -44,9 +44,9 @@ CREATE TABLE rhnServerActionVerifyResult
mode_differs CHAR(1) NOT NULL
CONSTRAINT rhn_sactionvr_mode_ck
CHECK (mode_differs in ( 'Y' , 'N' , '?' )),
- md5_differs CHAR(1) NOT NULL
- CONSTRAINT rhn_sactionvr_md5_ck
- CHECK (md5_differs in ( 'Y' , 'N' , '?' )),
+ checksum_differs CHAR(1) NOT NULL
+ CONSTRAINT rhn_sactionvr_chsum_ck
+ CHECK (checksum_differs in ( 'Y' , 'N' , '?' )),
devnum_differs CHAR(1) NOT NULL
CONSTRAINT rhn_sactionvr_devnum_ck
CHECK (devnum_differs in ( 'Y' , 'N' , '?' )),
commit ec980222a7bfff9a28068bdadb90bcaa34bd7f64
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 9 16:41:56 2009 +0200
moved checksum from rhnAppInstallSession to rhnChecksum
diff --git a/schema/spacewalk/common/tables/rhnAppInstallSession.sql b/schema/spacewalk/common/tables/rhnAppInstallSession.sql
index 9b8871a..6f57b61 100644
--- a/schema/spacewalk/common/tables/rhnAppInstallSession.sql
+++ b/schema/spacewalk/common/tables/rhnAppInstallSession.sql
@@ -21,7 +21,9 @@ CREATE TABLE rhnAppInstallSession
CONSTRAINT rhn_appinst_session_iid_fk
REFERENCES rhnAppInstallInstance (id)
ON DELETE CASCADE,
- md5sum VARCHAR2(64),
+ checksum_id NUMBER NOT NULL
+ CONSTRAINT rhn_appinst_session_chsum_fk
+ REFERENCES rhnChecksum (id),
process_name VARCHAR2(32),
step_number NUMBER,
user_id NUMBER NOT NULL
commit 4567b381b991c30e4d4683bbcea39beaf1bedd9d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 9 16:33:49 2009 +0200
moved checksum from rhnPackageSource to rhnChecksum
diff --git a/schema/spacewalk/common/tables/rhnPackageSource.sql b/schema/spacewalk/common/tables/rhnPackageSource.sql
index 8727c74..d39e74a 100644
--- a/schema/spacewalk/common/tables/rhnPackageSource.sql
+++ b/schema/spacewalk/common/tables/rhnPackageSource.sql
@@ -33,11 +33,15 @@ CREATE TABLE rhnPackageSource
payload_size NUMBER NOT NULL,
build_host VARCHAR2(256) NOT NULL,
build_time DATE NOT NULL,
- sigmd5 VARCHAR2(64) NOT NULL,
+ sigchecksum_id NUMBER NOT NULL
+ CONSTRAINT rhn_pkgsrc_sigchsum_fk
+ REFERENCES rhnChecksum (id),
vendor VARCHAR2(64) NOT NULL,
cookie VARCHAR2(128) NOT NULL,
path VARCHAR2(1000),
- md5sum VARCHAR2(64) NOT NULL,
+ checksum_id NUMBER NOT NULL
+ CONSTRAINT rhn_pkgsrc_chsum_fk
+ REFERENCES rhnChecksum (id),
package_size NUMBER NOT NULL,
last_modified DATE
DEFAULT (sysdate) NOT NULL,
commit 745b3d77b1619ba01a3277c0997e3606e0112213
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 9 16:09:19 2009 +0200
removed index on md5
diff --git a/schema/spacewalk/common/tables/rhnConfigContent.sql b/schema/spacewalk/common/tables/rhnConfigContent.sql
index f566023..57ed53e 100644
--- a/schema/spacewalk/common/tables/rhnConfigContent.sql
+++ b/schema/spacewalk/common/tables/rhnConfigContent.sql
@@ -37,9 +37,5 @@ TABLESPACE [[blob]]
ENABLE ROW MOVEMENT
;
-CREATE INDEX rhn_confcontent_md5_uq
- ON rhnConfigContent (md5sum)
- TABLESPACE [[2m_tbs]];
-
CREATE SEQUENCE rhn_confcontent_id_seq;
commit cb58eaaa094c1d42133a274d7e108beb0caf76b7
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 9 16:08:07 2009 +0200
moved checksum from rhnConfigContent to rhnChecksum
diff --git a/schema/spacewalk/common/tables/rhnConfigContent.sql b/schema/spacewalk/common/tables/rhnConfigContent.sql
index 11a387f..f566023 100644
--- a/schema/spacewalk/common/tables/rhnConfigContent.sql
+++ b/schema/spacewalk/common/tables/rhnConfigContent.sql
@@ -21,7 +21,9 @@ CREATE TABLE rhnConfigContent
USING INDEX TABLESPACE [[2m_tbs]],
contents BLOB,
file_size NUMBER,
- md5sum VARCHAR2(64) NOT NULL,
+ checksum_id NUMBER NOT NULL
+ CONSTRAINT rhn_confcontent_chsum_fk
+ REFERENCES rhnChecksum (id),
is_binary CHAR(1)
DEFAULT ('N') NOT NULL
CONSTRAINT rhn_confcontent_isbin_ck
commit f8ce715a113192edd0bd2c672c859ae744b9897a
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Fri Oct 9 13:41:20 2009 +0200
moved checksum from rhnKSTreeFile to rhnChecksum
diff --git a/schema/spacewalk/common/tables/rhnKSTreeFile.sql b/schema/spacewalk/common/tables/rhnKSTreeFile.sql
index 323269d..791b254 100644
--- a/schema/spacewalk/common/tables/rhnKSTreeFile.sql
+++ b/schema/spacewalk/common/tables/rhnKSTreeFile.sql
@@ -21,7 +21,9 @@ CREATE TABLE rhnKSTreeFile
REFERENCES rhnKickstartableTree (id)
ON DELETE CASCADE,
relative_filename VARCHAR2(256) NOT NULL,
- md5sum VARCHAR2(64) NOT NULL,
+ checksum_id NUMBER NOT NULL
+ CONSTRAINT rhn_kstreefile_chsum_fk
+ REFERENCES rhnChecksum (id),
file_size NUMBER NOT NULL,
last_modified DATE
DEFAULT (sysdate) NOT NULL,
commit f1a0c508be7bcacc095bb9e4c7b5e65e9679ed00
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 8 16:00:12 2009 +0200
moved checksum from rhnErrataFileTmp to rhnChecksum
diff --git a/schema/spacewalk/common/tables/rhnErrataFileTmp.sql b/schema/spacewalk/common/tables/rhnErrataFileTmp.sql
index dffc00c..8d734f8 100644
--- a/schema/spacewalk/common/tables/rhnErrataFileTmp.sql
+++ b/schema/spacewalk/common/tables/rhnErrataFileTmp.sql
@@ -24,7 +24,9 @@ CREATE TABLE rhnErrataFileTmp
type NUMBER NOT NULL
CONSTRAINT rhn_erratafiletmp_type_fk
REFERENCES rhnErrataFileType (id),
- md5sum VARCHAR2(64) NOT NULL,
+ checksum_id NUMBER NOT NULL,
+ CONSTRAINT rhn_erratafiletmp_chsum_fk
+ REFERENCES rhnChecksum (id),
filename VARCHAR2(128) NOT NULL,
created DATE
DEFAULT (sysdate) NOT NULL,
commit 37c9909831154825ba91d160f151e8d9ec263b8d
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 8 15:42:41 2009 +0200
moved checksum from rhnErrataFile to rhnChecksum
diff --git a/schema/spacewalk/common/tables/rhnErrataFile.sql b/schema/spacewalk/common/tables/rhnErrataFile.sql
index 780bd7e..6865788 100644
--- a/schema/spacewalk/common/tables/rhnErrataFile.sql
+++ b/schema/spacewalk/common/tables/rhnErrataFile.sql
@@ -24,7 +24,9 @@ CREATE TABLE rhnErrataFile
type NUMBER NOT NULL
CONSTRAINT rhn_erratafile_type_fk
REFERENCES rhnErrataFileType (id),
- md5sum VARCHAR2(64) NOT NULL,
+ checksum_id NUMBER NOT NULL,
+ CONSTRAINT rhn_erratafile_chsum_fk
+ REFERENCES rhnChecksum (id),
filename VARCHAR2(1024) NOT NULL,
created DATE
DEFAULT (sysdate) NOT NULL,
commit f27f9aa2f8c672c82b1f93c331f514172053b2bc
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 8 15:41:16 2009 +0200
moved checksum from rhnPackageFile to rhnChecksum
diff --git a/schema/spacewalk/common/tables/rhnPackageFile.sql b/schema/spacewalk/common/tables/rhnPackageFile.sql
index b60cf3f..896b872 100644
--- a/schema/spacewalk/common/tables/rhnPackageFile.sql
+++ b/schema/spacewalk/common/tables/rhnPackageFile.sql
@@ -31,7 +31,9 @@ CREATE TABLE rhnPackageFile
rdev NUMBER NOT NULL,
file_size NUMBER NOT NULL,
mtime DATE NOT NULL,
- md5 VARCHAR2(32),
+ checksum_id NUMBER NOT NULL,
+ CONSTRAINT rhn_package_file_chsum_fk
+ REFERENCES rhnChecksum (id),
linkto VARCHAR2(256),
flags NUMBER NOT NULL,
verifyflags NUMBER NOT NULL,
commit be72cab38d65fbf83e35619ba7ab346b6b78f868
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 8 15:36:56 2009 +0200
moved checksum from rhnPackage to rhnChecksum
diff --git a/schema/spacewalk/common/tables/rhnPackage.sql b/schema/spacewalk/common/tables/rhnPackage.sql
index 274e8e0..223eab8 100644
--- a/schema/spacewalk/common/tables/rhnPackage.sql
+++ b/schema/spacewalk/common/tables/rhnPackage.sql
@@ -45,6 +45,9 @@ CREATE TABLE rhnPackage
source_rpm_id NUMBER
CONSTRAINT rhn_package_srcrpmid_fk
REFERENCES rhnSourceRPM (id),
+ checksum_id NUMBER NOT NULL,
+ CONSTRAINT rhn_package_chsum_fk
+ REFERENCES rhnChecksum (id),
vendor VARCHAR2(64) NOT NULL,
payload_format VARCHAR2(32),
compat NUMBER(1)
commit 545723c5864c795c652a315d7fa0a53fb46f6743
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 8 15:36:14 2009 +0200
moved checksum from rhnFile to rhnChecksum
diff --git a/schema/spacewalk/common/tables/rhnFile.sql b/schema/spacewalk/common/tables/rhnFile.sql
index e7c9cb0..b2c8b00 100644
--- a/schema/spacewalk/common/tables/rhnFile.sql
+++ b/schema/spacewalk/common/tables/rhnFile.sql
@@ -24,7 +24,9 @@ CREATE TABLE rhnFile
REFERENCES web_customer (id)
ON DELETE CASCADE,
file_size NUMBER NOT NULL,
- md5sum VARCHAR2(64) NOT NULL,
+ checksum_id NUMBER NOT NULL,
+ CONSTRAINT rhn_file_chsum_fk
+ REFERENCES rhnChecksum (id),
path VARCHAR2(1000) NOT NULL,
created DATE
DEFAULT (sysdate) NOT NULL,
commit 7f535658c1ef9ddf580e9927c16d3f1798142e21
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Oct 8 15:23:21 2009 +0200
renamed rhnPackageChecksum to generic rhnChecksum
checksum of any package/file/kickstart/whatever will be stored
there along with checksum type
diff --git a/schema/spacewalk/common/tables/rhnChecksum.sql b/schema/spacewalk/common/tables/rhnChecksum.sql
new file mode 100644
index 0000000..7f68b3c
--- /dev/null
+++ b/schema/spacewalk/common/tables/rhnChecksum.sql
@@ -0,0 +1,31 @@
+--
+-- Copyright (c) 2009 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+-- The checksum associated with a package/file/etc...
+
+create table
+rhnChecksum
+(
+ checksum_id number not null
+ constraint rhnChecksum_pk primary key,
+ checksum_type_id number not null
+ constraint rhnChecksum_typeid_fk
+ references rhnChecksumType(id),
+ checksum varchar2(128) not null
+)
+ enable row movement
+;
+
+CREATE SEQUENCE rhnChecksum_seq;
diff --git a/schema/spacewalk/common/tables/rhnPackageChecksum.sql b/schema/spacewalk/common/tables/rhnPackageChecksum.sql
deleted file mode 100644
index 093e0b9..0000000
--- a/schema/spacewalk/common/tables/rhnPackageChecksum.sql
+++ /dev/null
@@ -1,36 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
---
--- The types of checksum associated with a package... md5sum, sha1, sha256...?
-
-create table
-rhnPackageChecksum
-(
- package_id number not null
- constraint rhn_pkgcs_id_fk
- references rhnPackage(id),
- checksum_type_id number not null
- constraint rhn_pkg_checksum_type_id_fk
- references rhnChecksumType(id),
- checksum varchar2(128)
- constraint rhn_pkgchecksum_type_name_nn not null
-)
- enable row movement
-;
-
-alter table rhnPackageChecksum add constraint rhn_pkg_checksum_id_pk primary key (package_id, checksum_type_id);
-
commit f03ef9f26cbc057aba2462b1edebb80926d33da0
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 5 16:59:21 2009 +0200
fixed table reference (removed test schema)
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql
index 6dd4a9c..f43f20f 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql
@@ -1,7 +1,7 @@
insert into rhnPackageChecksum (package_id, checksum_type_id, checksum)
(select p.id, md5.id, md5sum
- from test1064.rhnPackage p,
+ from rhnPackage p,
(select id from rhnpackageChecksumType where label = 'md5') md5
);
commit 01ecd6ff00ddecaae90416e67ff50842f5c79635
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 5 12:15:00 2009 +0200
don't create index separately
diff --git a/schema/spacewalk/common/tables/rhnPackageChecksum.sql b/schema/spacewalk/common/tables/rhnPackageChecksum.sql
index cb99de1..093e0b9 100644
--- a/schema/spacewalk/common/tables/rhnPackageChecksum.sql
+++ b/schema/spacewalk/common/tables/rhnPackageChecksum.sql
@@ -32,8 +32,5 @@ rhnPackageChecksum
enable row movement
;
-create index rhn_pkgcsum_id_n_idx
- on rhnPackageChecksum (package_id, checksum_type_id)
-
alter table rhnPackageChecksum add constraint rhn_pkg_checksum_id_pk primary key (package_id, checksum_type_id);
commit f2db00c09dd4cafb36f2e93ce761dccdf835eaa6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 5 11:39:43 2009 +0200
fixed md5 checksum upgrade sql script
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql
index 26c8354..6dd4a9c 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql
@@ -1,6 +1,9 @@
insert into rhnPackageChecksum (package_id, checksum_type_id, checksum)
- values ( select id, (select id from rhnChecksumType where label = 'md5'), md5sum from rhnPackage );
+ (select p.id, md5.id, md5sum
+ from test1064.rhnPackage p,
+ (select id from rhnpackageChecksumType where label = 'md5') md5
+ );
commit;
commit 75aef8917e7d5a3c64cd3fb32879e04a4322184c
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 25 14:44:22 2009 +0200
more agressive merge uploadLib.py - from client/tools/rhnpush to proxy/proxy/pm
diff --git a/client/tools/rhnpush/uploadLib.py b/client/tools/rhnpush/uploadLib.py
index c87052a..fbcf63b 100644
--- a/client/tools/rhnpush/uploadLib.py
+++ b/client/tools/rhnpush/uploadLib.py
@@ -21,6 +21,7 @@ import string
import fnmatch
import getpass
import rhnpush_cache
+import struct
try:
import hashlib
diff --git a/proxy/proxy/pm/uploadLib.py b/proxy/proxy/pm/uploadLib.py
index e9cd7b1..936aa18 100644
--- a/proxy/proxy/pm/uploadLib.py
+++ b/proxy/proxy/pm/uploadLib.py
@@ -17,24 +17,14 @@
# system imports
import os
import sys
-import md5
import string
import fnmatch
import getpass
-import struct
-
-from rhn import rpclib
-Binary = rpclib.xmlrpclib.Binary
-Output = rpclib.transports.Output
# RHN imports
-from common import rhn_rpm
+from rhnpush import rhn_mpm
from rhnpush import uploadLib
-# Buffer size we use for copying
-BUFFER_SIZE = 65536
-HEADERS_PER_CALL = 25
-
class UploadClass(uploadLib.UploadClass):
""" Functionality for an uploading tool """
@@ -176,75 +166,15 @@ class UploadClass(uploadLib.UploadClass):
# Per-package post actions
self.processPackage(p, filename)
-def _processFile(filename, relativeDir=None, source=None, nosig=None):
- """ Processes a file
- Returns a hash containing:
- header
- packageSize
- md5sum
- relativePath
- nvrea
- """
-
- # Is this a file?
- if not os.access(filename, os.R_OK):
- raise UploadError("Could not stat the file %s" % filename)
- if not os.path.isfile(filename):
- raise UploadError("%s is not a file" % filename)
-
- # Size
- size = os.path.getsize(filename)
- # Open the file
- f = open(filename, "r")
- digest = computeMD5sum(None, f)
- # Rewind the file
- f.seek(0, 0)
- # Read the header
- h = get_header(None, f.fileno(), source)
- (header_start, header_end) = get_header_byte_range(f);
- f.close()
- if h is None:
- raise UploadError("%s is not a valid RPM file" % filename)
-
- if nosig is None and not h.is_signed():
- raise UploadError("ERROR: %s: unsigned rpm (use --nosig to force)"
- % filename)
-
- # Get the name, version, release, epoch, arch
- lh = []
- for k in ['name', 'version', 'release', 'epoch']:
- lh.append(h[k])
- # Fix the epoch
- if lh[3] is None:
- lh[3] = ""
- else:
- lh[3] = str(lh[3])
- if source:
- lh.append('src')
- else:
- lh.append(h['arch'])
-
- # Build the header hash to be sent
- hash = { 'header' : Binary(h.unload()),
- 'md5sum' : digest,
- 'packageSize' : size,
- 'header_start' : header_start,
- 'header_end' : header_end}
- if relativeDir:
- # Append the relative dir too
- hash["relativePath"] = "%s/%s" % (relativeDir,
- os.path.basename(filename))
- hash['nvrea'] = tuple(lh)
- return hash
# returns a header from a package file on disk.
def get_header(file, fildes=None, source=None):
- # rhn_rpm.get_package_header will choose the right thing to do - open the
+ # rhn_mpm.get_package_header will choose the right thing to do - open the
# file or use the provided open file descriptor)
try:
- h = rhn_rpm.get_package_header(filename=file, fd=fildes)
- except rhn_rpm.InvalidPackageError:
+ h = rhn_mpm.get_package_header(filename=file, fd=fildes)
+ except rhn_mpm.InvalidPackageError:
raise UploadError("Package is invalid")
# Verify that this is indeed a binary/source. xor magic
# xor doesn't work with None values, so compare the negated values - the
@@ -252,55 +182,3 @@ def get_header(file, fildes=None, source=None):
if (not source) ^ (not h.is_source):
raise UploadError("Unexpected RPM package type")
return h
-
-def get_header_byte_range(package_file):
- """
- Return the start and end bytes of the rpm header object.
-
- For details of the rpm file format, see:
- http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html
- """
-
- lead_size = 96
-
- # Move past the rpm lead
- package_file.seek(lead_size)
-
- sig_size = get_header_struct_size(package_file)
-
- # Now we can find the start of the actual header.
- header_start = lead_size + sig_size
-
- package_file.seek(header_start)
-
- header_size = get_header_struct_size(package_file)
-
- header_end = header_start + header_size
-
- return (header_start, header_end)
-
-def get_header_struct_size(package_file):
- """
- Compute the size in bytes of the rpm header struct starting at the current
- position in package_file.
- """
- # Move past the header preamble
- package_file.seek(8, 1)
-
- # Read the number of index entries
- header_index = package_file.read(4)
- (header_index_value, ) = struct.unpack('>I', header_index)
-
- # Read the the size of the header data store
- header_store = package_file.read(4)
- (header_store_value, ) = struct.unpack('>I', header_store)
-
- # The total size of the header. Each index entry is 16 bytes long.
- header_size = 8 + 4 + 4 + header_index_value * 16 + header_store_value
-
- # Headers end on an 8-byte boundary. Round out the extra data.
- round_out = header_size % 8
- if round_out != 0:
- header_size = header_size + (8 - round_out)
-
- return header_size
commit 360cd3374481dc198c086737f6d1c220b16250f8
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 25 14:33:01 2009 +0200
whitespace cleanup
diff --git a/proxy/proxy/pm/uploadLib.py b/proxy/proxy/pm/uploadLib.py
index 971d01b..e9cd7b1 100644
--- a/proxy/proxy/pm/uploadLib.py
+++ b/proxy/proxy/pm/uploadLib.py
@@ -14,7 +14,6 @@
# in this software or its documentation.
#
-
# system imports
import os
import sys
@@ -36,14 +35,9 @@ from rhnpush import uploadLib
BUFFER_SIZE = 65536
HEADERS_PER_CALL = 25
-
class UploadClass(uploadLib.UploadClass):
""" Functionality for an uploading tool """
-
-
-
-
def list(self):
# set the URL
self.setURL()
@@ -80,9 +74,6 @@ class UploadClass(uploadLib.UploadClass):
return self.get_newest_binary_packages()
-
-
-
def copyonly(self):
# Set the forcing factor
self.setForce()
@@ -185,8 +176,6 @@ class UploadClass(uploadLib.UploadClass):
# Per-package post actions
self.processPackage(p, filename)
-
-
def _processFile(filename, relativeDir=None, source=None, nosig=None):
""" Processes a file
Returns a hash containing:
@@ -249,12 +238,6 @@ def _processFile(filename, relativeDir=None, source=None, nosig=None):
hash['nvrea'] = tuple(lh)
return hash
-
-
-
-
-
-
# returns a header from a package file on disk.
def get_header(file, fildes=None, source=None):
# rhn_rpm.get_package_header will choose the right thing to do - open the
commit c754037b1d45500bdeff89b8d1bb700c60a0d497
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 25 14:31:34 2009 +0200
base UploadClass on uploadLib.UploadClass from rhnpush
diff --git a/proxy/proxy/pm/uploadLib.py b/proxy/proxy/pm/uploadLib.py
index 6243741..971d01b 100644
--- a/proxy/proxy/pm/uploadLib.py
+++ b/proxy/proxy/pm/uploadLib.py
@@ -37,7 +37,7 @@ BUFFER_SIZE = 65536
HEADERS_PER_CALL = 25
-class UploadClass:
+class UploadClass(uploadLib.UploadClass):
""" Functionality for an uploading tool """
commit 8088633dd9b362601411353a80eeafa60fe0b5b5
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 25 14:27:48 2009 +0200
merge uploadLib.py - from proxy/proxy/pm to client/tools/rhnpush
diff --git a/client/tools/rhnpush/uploadLib.py b/client/tools/rhnpush/uploadLib.py
index f420de3..c87052a 100644
--- a/client/tools/rhnpush/uploadLib.py
+++ b/client/tools/rhnpush/uploadLib.py
@@ -493,13 +493,14 @@ class UploadClass:
def _processFile(filename, relativeDir=None, source=None, nosig=None):
- # Processes a file
- # Returns a hash containing:
- # header
- # packageSize
- # md5sum
- # relativePath
- # nvrea
+ """ Processes a file
+ Returns a hash containing:
+ header
+ packageSize
+ md5sum
+ relativePath
+ nvrea
+ """
# Is this a file?
if not os.access(filename, os.R_OK):
@@ -516,10 +517,11 @@ def _processFile(filename, relativeDir=None, source=None, nosig=None):
f.seek(0, 0)
# Read the header
h = get_header(None, f.fileno(), source)
+ (header_start, header_end) = get_header_byte_range(f);
f.close()
if h is None:
raise UploadError("%s is not a valid RPM file" % filename)
-
+
if nosig is None and not h.is_signed():
raise UploadError("ERROR: %s: unsigned rpm (use --nosig to force)"
% filename)
@@ -542,7 +544,9 @@ def _processFile(filename, relativeDir=None, source=None, nosig=None):
# Build the header hash to be sent
hash = { 'header' : Binary(h.unload()),
'md5sum' : digest,
- 'packageSize' : size}
+ 'packageSize' : size,
+ 'header_start' : header_start,
+ 'header_end' : header_end}
if relativeDir:
# Append the relative dir too
hash["relativePath"] = "%s/%s" % (relativeDir,
@@ -747,3 +751,54 @@ def get_header(file, fildes=None, source=None):
def ReportError(*args):
sys.stderr.write(string.join(map(str, args)) + "\n")
+def get_header_byte_range(package_file):
+ """
+ Return the start and end bytes of the rpm header object.
+
+ For details of the rpm file format, see:
+ http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html
+ """
+
+ lead_size = 96
+
+ # Move past the rpm lead
+ package_file.seek(lead_size)
+
+ sig_size = get_header_struct_size(package_file)
+
+ # Now we can find the start of the actual header.
+ header_start = lead_size + sig_size
+
+ package_file.seek(header_start)
+
+ header_size = get_header_struct_size(package_file)
+
+ header_end = header_start + header_size
+
+ return (header_start, header_end)
+
+def get_header_struct_size(package_file):
+ """
+ Compute the size in bytes of the rpm header struct starting at the current
+ position in package_file.
+ """
+ # Move past the header preamble
+ package_file.seek(8, 1)
+
+ # Read the number of index entries
+ header_index = package_file.read(4)
+ (header_index_value, ) = struct.unpack('>I', header_index)
+
+ # Read the the size of the header data store
+ header_store = package_file.read(4)
+ (header_store_value, ) = struct.unpack('>I', header_store)
+
+ # The total size of the header. Each index entry is 16 bytes long.
+ header_size = 8 + 4 + 4 + header_index_value * 16 + header_store_value
+
+ # Headers end on an 8-byte boundary. Round out the extra data.
+ round_out = header_size % 8
+ if round_out != 0:
+ header_size = header_size + (8 - round_out)
+
+ return header_size
diff --git a/proxy/proxy/pm/uploadLib.py b/proxy/proxy/pm/uploadLib.py
index 39aec0c..6243741 100644
--- a/proxy/proxy/pm/uploadLib.py
+++ b/proxy/proxy/pm/uploadLib.py
@@ -270,7 +270,6 @@ def get_header(file, fildes=None, source=None):
raise UploadError("Unexpected RPM package type")
return h
-
def get_header_byte_range(package_file):
"""
Return the start and end bytes of the rpm header object.
commit a9ddf5226a924f03068168ccf08dbfc7317ab445
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 25 14:15:42 2009 +0200
merget uploadLib.py - from client/tools/rhnpush to proxy/proxy/pm
diff --git a/proxy/proxy/pm/uploadLib.py b/proxy/proxy/pm/uploadLib.py
index 515da0f..39aec0c 100644
--- a/proxy/proxy/pm/uploadLib.py
+++ b/proxy/proxy/pm/uploadLib.py
@@ -13,7 +13,7 @@
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#
-# $Id: uploadLib.py,v 1.39 2005/07/05 17:39:03 wregglej Exp $
+
# system imports
import os
@@ -30,127 +30,19 @@ Output = rpclib.transports.Output
# RHN imports
from common import rhn_rpm
-
+from rhnpush import uploadLib
# Buffer size we use for copying
BUFFER_SIZE = 65536
HEADERS_PER_CALL = 25
-# Exception class
-class UploadError(Exception):
- pass
-
-
-class ServerFault(Exception):
- def __init__(self, faultCode=None, faultString="", faultExplanation=""):
- Exception.__init__(self)
- self.faultCode = faultCode
- self.faultString = faultString
- self.faultExplanation = faultExplanation
+class UploadClass:
+ """ Functionality for an uploading tool """
-class UploadClass:
- """ Functionality for an uploading tool """
- def __init__(self, options, files=None):
- #CmdlineClass.__init__(self, table, argsDescription, aliasing)
- self.options = options
- self.username = None
- self.password = None
- self.proxy = None
- self.proxyUsername = None
- self.proxyPassword = None
- self.ca_chain = None
- self.force = None
- self.files = files or []
-
- def warn(self, verbose, *args):
- if self.options.verbose >= verbose:
- apply(ReportError, args)
-
- def die(self, errcode, *args):
- apply(ReportError, args)
- sys.exit(errcode)
-
- def setURL(self):
- # Redefine this in derived classes
- self.url = None
-
- def setUsernamePassword(self):
- # Use the stored values, if available
- username = self.username or self.options.username
- password = self.password or self.options.password
- self.username, self.password = getUsernamePassword(username, password)
-
- def setProxyUsernamePassword(self):
- self.proxyUsername = None
- self.proxyPassword = None
-
- def setCAchain(self):
- self.ca_chain = None
-
- def setProxy(self):
- self.proxy = None
-
- def setForce(self):
- self.force = None
-
- def setServer(self):
- self.warn(1, "Connecting to %s" % self.url)
- # set the proxy
- self.setProxy()
- # set the CA chain
- self.setCAchain()
- # set the proxy username and password
- self.setProxyUsernamePassword()
- self.server = getServer(self.url, self.proxy, self.proxyUsername,
- self.proxyPassword, self.ca_chain)
- # Compress the output, just to be fast
- self.server.set_transport_flags(
- transfer=Output.TRANSFER_BINARY,
- encoding=Output.ENCODE_GZIP)
-
- def setChannels(self):
- if not self.options.channel:
- self.die(-1, "No channel was specified")
- self.channels = self.options.channel
- self.warn(1, "Channels: %s" % string.join(self.channels))
-
- setNoChannels = setChannels
-
- def setOrg(self):
- self.orgId = -1
-
- def setCount(self):
- if not self.options.count:
- self.count = HEADERS_PER_CALL
- else:
- self.count = self.options.count
-
- def setRelativeDir(self):
- self.relativeDir = None
-
- def directory(self):
- # Set the args (pretend we read them from the command line)
- self.warn(2, "Uploading files from directory", self.options.dir)
- self.files = listdir(self.options.dir)
-
- def filter_excludes(self):
- if not self.options.exclude:
- return self
- for f in self.files[:]:
- bf = os.path.basename(f)
- for pattern in self.options.exclude:
- if fnmatch.fnmatch(bf, pattern):
- self.warn(1, "Ignoring %s" % f)
- self.files.remove(f)
- return self
-
- def readStdin(self):
- self.warn(1, "Reading package names from stdin")
- self.files = readStdin()
def list(self):
# set the URL
@@ -189,107 +81,7 @@ class UploadClass:
return self.get_newest_binary_packages()
- def get_newest_binary_packages(self):
- # Loop through the args and only keep the newest ones
- localPackagesHash = {}
- for filename in self.files:
- nvrea = _processFile(filename, nosig=1)['nvrea']
- name = nvrea[0]
- if not localPackagesHash.has_key(name):
- localPackagesHash[name] = {nvrea : filename}
- continue
-
- same_names_hash = localPackagesHash[name]
- # Already saw this name
- if same_names_hash.has_key(nvrea):
- # Already seen this nvrea
- continue
- skip_rpm = 0
- for local_nvrea in same_names_hash.keys():
- ret = packageCompare(local_nvrea, nvrea)
- if ret == 0 and local_nvrea[4] == nvrea[4]:
- # Weird case, we've already compared the two
- skip_rpm = 1
- break
-
- if ret > 0:
- # nvrea is older than local_nvrea
- skip_rpm = 1
- break
-
- if ret < 0:
- # nvrea is newer than local_nvrea
- del same_names_hash[local_nvrea]
-
- # Different arches - go on
-
- if skip_rpm:
- # Older
- continue
-
- same_names_hash[nvrea] = filename
- # Now get the list from the server
- pkglist = listChannel(self.server, self.username, self.password,
- self.channels)
-
- for p in pkglist:
- name = p[0]
- if not localPackagesHash.has_key(name):
- # Not in the local list
- continue
- same_names_hash = localPackagesHash[name]
- remote_nvrea = tuple(p[:5])
- if same_names_hash.has_key(remote_nvrea):
- # The same package is already uploaded
- del same_names_hash[remote_nvrea]
- continue
-
- for local_nvrea in same_names_hash.keys():
- ret = packageCompare(local_nvrea, remote_nvrea)
- if ret < 0:
- # The remote package is newer than the local one
- del same_names_hash[local_nvrea]
- continue
- if ret == 0 and local_nvrea[4] == remote_nvrea[4]:
- # Same arch
- del same_names_hash[local_nvrea]
- continue
- # This means local is newer
-
- # Return the list of files to push
- l = []
- for hash in localPackagesHash.values():
- for filename in hash.values():
- l.append(filename)
- l.sort()
- self.files = l
-
- def get_missing_source_packages(self):
- localPackagesHash = {}
- for filename in self.files:
- localPackagesHash[os.path.basename(filename)] = filename
-
- # Now get the list from the server
- pkglist = listMissingSourcePackages(self.server, self.username,
- self.password, self.channels)
-
- to_push = []
- for pkg in pkglist:
- pkg_name, pkg_channel = pkg[:2]
- if not localPackagesHash.has_key(pkg_name):
- # We don't have it
- continue
- to_push.append(localPackagesHash[pkg_name])
-
- to_push.sort()
- self.files = to_push
- return self.files
-
- def test(self):
- # Test only
- for p in self.files:
- print p
def copyonly(self):
# Set the forcing factor
@@ -393,8 +185,6 @@ class UploadClass:
# Per-package post actions
self.processPackage(p, filename)
- def processPackage(self, package, filename):
- pass
def _processFile(filename, relativeDir=None, source=None, nosig=None):
@@ -459,156 +249,10 @@ def _processFile(filename, relativeDir=None, source=None, nosig=None):
hash['nvrea'] = tuple(lh)
return hash
-def _processBatch(batch, relativeDir, source, verbose, nosig=None):
- sentPackages = {}
- headersList = []
- for filename in batch:
- if verbose:
- print "Uploading %s" % filename
- hash = _processFile(filename, relativeDir=relativeDir, source=source,
- nosig=nosig)
- # Get nvrea
- nvrea = hash['nvrea']
- del hash['nvrea']
-
- sentPackages[nvrea] = filename
-
- # Append the header to the list of headers to be sent out
- headersList.append(hash)
- return sentPackages, headersList
-
-def computeMD5sum(filename=None, f=None):
- if f is None:
- fd = open(filename, "r")
- else:
- fd = f
- fd.seek(0, 0)
- md5sum = md5.new()
- while 1:
- buf = fd.read(BUFFER_SIZE)
- if not buf:
- break
- md5sum.update(buf)
- if not f:
- fd.close()
- return string.join(map(lambda x: "%02x" % ord(x), md5sum.digest()), '')
-
-
-def readStdin():
- # Reads the standard input lines and returns a list
- l = []
- while 1:
- line = sys.stdin.readline()
- if not line:
- break
- l.append(string.strip(line))
- return l
-
-
-def getUsernamePassword(cmdlineUsername, cmdlinePassword):
- # Returns a username and password (either by returning the ones passed as
- # args, or the user's input
- if cmdlineUsername and cmdlinePassword:
- return cmdlineUsername, cmdlinePassword
-
- username = cmdlineUsername
- password = cmdlinePassword
-
- # Read the username, if not already specified
- tty = open("/dev/tty", "r+")
- while not username:
- tty.write("Red Hat Network username: ")
- try:
- username = tty.readline()
- except KeyboardInterrupt:
- tty.write("\n")
- sys.exit(0)
- if username is None:
- # EOF
- tty.write("\n")
- sys.exit(0)
- username = string.strip(username)
- if username:
- break
-
- # Now read the password
- try:
- password = getpass.getpass("Red Hat Network password: ")
- except KeyboardInterrupt:
- tty.write("\n")
- sys.exit(0)
- tty.close()
- return username, password
-
-
-def listdir(directory):
- directory = os.path.abspath(os.path.normpath(directory))
- if not os.access(directory, os.R_OK | os.X_OK):
- raise UploadError("Cannot read from directory %s" % directory)
- if not os.path.isdir(directory):
- raise UploadError("%s not a directory" % directory)
- # Build the package list
- packagesList = []
- for f in os.listdir(directory):
- packagesList.append("%s/%s" % (directory, f))
- return packagesList
-
-
-def call(function, *params):
- # Wrapper function
- try:
- ret = apply(function, params)
- except rpclib.Fault, e:
- x = parseXMLRPCfault(e)
- if x.faultString:
- print x.faultString
- if x.faultExplanation:
- print x.faultExplanation
- sys.exit(-1)
- except rpclib.ProtocolError, e:
- print e.errmsg
- sys.exit(-1)
-
- return ret
-
-
-def parseXMLRPCfault(fault):
- if not isinstance(fault, rpclib.Fault):
- return None
- faultCode = fault.faultCode
- if faultCode and isinstance(faultCode, type(1)):
- faultCode = -faultCode
- return ServerFault(faultCode, "", fault.faultString)
-
-
-def listChannel(server, username, password, channels):
- return call(server.packages.listChannel, channels, username, password)
-
-def listMissingSourcePackages(server, username, password, channels):
- return call(server.packages.listMissingSourcePackages, channels,
- username, password)
-
-def getServer(uri, proxy=None, username=None, password=None, ca_chain=None):
- s = rpclib.Server(uri, proxy=proxy, username=username, password=password)
- if ca_chain:
- s.add_trusted_cert(ca_chain)
- return s
-
-
-# compare two package [n,v,r,e] tuples
-def packageCompare(pkg1, pkg2):
- if pkg1[0] != pkg2[0]:
- raise ValueError("You should only compare packages with the same name")
- packages = []
- for pkg in (pkg1, pkg2):
- e = pkg[3]
- if e == "":
- e = None
- elif e is not None:
- e = str(e)
- evr = (e, str(pkg[1]), str(pkg[2]))
- packages.append(evr)
- return rhn_rpm.labelCompare(packages[0], packages[1])
+
+
+
+
# returns a header from a package file on disk.
@@ -627,9 +271,6 @@ def get_header(file, fildes=None, source=None):
return h
-def ReportError(*args):
- sys.stderr.write(string.join(map(str, args)) + "\n")
-
def get_header_byte_range(package_file):
"""
Return the start and end bytes of the rpm header object.
commit 2a6be5ccb12e6c93bcca746e44dd5d4fc651e95c
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 25 13:38:36 2009 +0200
require rhnpush to use its uploadLib.py
diff --git a/proxy/proxy/spacewalk-proxy.spec b/proxy/proxy/spacewalk-proxy.spec
index 518fac5..d87c1b1 100644
--- a/proxy/proxy/spacewalk-proxy.spec
+++ b/proxy/proxy/spacewalk-proxy.spec
@@ -126,6 +126,7 @@ Group: Applications/Internet
Requires: spacewalk-backend
Requires: rhnlib
Requires: python-optik
+Requires: rhnpush
BuildRequires: /usr/bin/docbook2man
Obsoletes: rhn_package_manager < 5.3.0
Obsoletes: rhns-proxy-package-manager < 5.3.0
commit 3effedce653073d024a73e94ef73c5d0c3d16bb3
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Oct 1 16:01:26 2009 +0200
Create table rhnPackageChecksum which will be store checksums for rhnPackage table
diff --git a/schema/spacewalk/common/tables/rhnPackage.sql b/schema/spacewalk/common/tables/rhnPackage.sql
index 8318474..274e8e0 100644
--- a/schema/spacewalk/common/tables/rhnPackage.sql
+++ b/schema/spacewalk/common/tables/rhnPackage.sql
@@ -45,7 +45,6 @@ CREATE TABLE rhnPackage
source_rpm_id NUMBER
CONSTRAINT rhn_package_srcrpmid_fk
REFERENCES rhnSourceRPM (id),
- md5sum VARCHAR2(64) NOT NULL,
vendor VARCHAR2(64) NOT NULL,
payload_format VARCHAR2(32),
compat NUMBER(1)
@@ -70,10 +69,6 @@ CREATE TABLE rhnPackage
ENABLE ROW MOVEMENT
;
-CREATE UNIQUE INDEX rhn_package_md5_oid_uq
- ON rhnPackage (md5sum, org_id)
- TABLESPACE [[2m_tbs]];
-
CREATE INDEX rhn_package_oid_id_idx
ON rhnPackage (org_id, id)
TABLESPACE [[64k_tbs]]
diff --git a/schema/spacewalk/common/tables/rhnPackageChecksum.sql b/schema/spacewalk/common/tables/rhnPackageChecksum.sql
new file mode 100644
index 0000000..cb99de1
--- /dev/null
+++ b/schema/spacewalk/common/tables/rhnPackageChecksum.sql
@@ -0,0 +1,39 @@
+--
+-- Copyright (c) 2008 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+-- The types of checksum associated with a package... md5sum, sha1, sha256...?
+
+create table
+rhnPackageChecksum
+(
+ package_id number not null
+ constraint rhn_pkgcs_id_fk
+ references rhnPackage(id),
+ checksum_type_id number not null
+ constraint rhn_pkg_checksum_type_id_fk
+ references rhnChecksumType(id),
+ checksum varchar2(128)
+ constraint rhn_pkgchecksum_type_name_nn not null
+)
+ enable row movement
+;
+
+create index rhn_pkgcsum_id_n_idx
+ on rhnPackageChecksum (package_id, checksum_type_id)
+
+alter table rhnPackageChecksum add constraint rhn_pkg_checksum_id_pk primary key (package_id, checksum_type_id);
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnPackageChecksum-table.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnPackageChecksum-table.sql
new file mode 100644
index 0000000..cb99de1
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/005-rhnPackageChecksum-table.sql
@@ -0,0 +1,39 @@
+--
+-- Copyright (c) 2008 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+-- The types of checksum associated with a package... md5sum, sha1, sha256...?
+
+create table
+rhnPackageChecksum
+(
+ package_id number not null
+ constraint rhn_pkgcs_id_fk
+ references rhnPackage(id),
+ checksum_type_id number not null
+ constraint rhn_pkg_checksum_type_id_fk
+ references rhnChecksumType(id),
+ checksum varchar2(128)
+ constraint rhn_pkgchecksum_type_name_nn not null
+)
+ enable row movement
+;
+
+create index rhn_pkgcsum_id_n_idx
+ on rhnPackageChecksum (package_id, checksum_type_id)
+
+alter table rhnPackageChecksum add constraint rhn_pkg_checksum_id_pk primary key (package_id, checksum_type_id);
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql
new file mode 100644
index 0000000..26c8354
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/006-move-checksum.sql
@@ -0,0 +1,11 @@
+
+insert into rhnPackageChecksum (package_id, checksum_type_id, checksum)
+ values ( select id, (select id from rhnChecksumType where label = 'md5'), md5sum from rhnPackage );
+
+commit;
+
+drop index rhn_package_md5_oid_uq;
+
+alter table rhnPackage drop column md5sum;
+
+
14 years, 4 months
Changes to 'refs/tags/spacewalk-certs-tools-0.8.1-1'
by Michael Mraka
Tag 'spacewalk-certs-tools-0.8.1-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2009-12-04 11:39 +0000
Tagging package [spacewalk-certs-tools] version [0.8.1-1] in directory [spacewalk/certs-tools/].
Changes since spacewalk-backend-0.8.1-1:
Michael Mraka (1):
Automatic commit of package [spacewalk-certs-tools] release [0.8.1-1].
---
rel-eng/packages/spacewalk-certs-tools | 2 +-
spacewalk/certs-tools/spacewalk-certs-tools.spec | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
---
14 years, 4 months